Skip to content

Commit 5e44939

Browse files
authored
Merge pull request SciTools#2263 from greglucas/move-feature-download-script
MNT: Move cartopy feature download script into the package
2 parents da6a8c5 + 30b4135 commit 5e44939

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

.github/workflows/ci-testing.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ jobs:
7272
shell: bash
7373
run: |
7474
# Check that the downloader tool at least knows where to get the data from (but don't actually download it)
75-
python tools/cartopy_feature_download.py gshhs physical --dry-run
75+
python -m cartopy.feature.download gshhs physical --dry-run
76+
# It should also be available as a script
77+
cartopy_feature_download gshhs physical --dry-run
7678
CARTOPY_GIT_DIR=$PWD
7779
pytest -ra -n 4 \
7880
--color=yes \

tools/cartopy_feature_download.py renamed to lib/cartopy/feature/download/__main__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
1111
For detail on how to use this tool, execute it with the `-h` option:
1212
13-
python cartopy_feature_download.py -h
13+
python -m cartopy.feature.download -h
1414
1515
"""
1616

@@ -107,7 +107,7 @@ def download_features(group_names, dry_run=True):
107107
''.format(category, name, scale, len(geoms)))
108108

109109

110-
if __name__ == '__main__':
110+
def main():
111111
parser = argparse.ArgumentParser(description='Download feature datasets.')
112112
parser.add_argument('group_names', nargs='+',
113113
choices=FEATURE_DEFN_GROUPS,
@@ -146,3 +146,7 @@ def download_features(group_names, dry_run=True):
146146
config['downloaders'][SHP_NE_SPEC].url_template = URL_TEMPLATE
147147

148148
download_features(args.group_names, dry_run=args.dry_run)
149+
150+
151+
if __name__ == '__main__':
152+
main()

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ srtm = ["beautifulsoup4"]
5858
test = ["pytest>=5.1.2", "pytest-mpl>=0.11", "pytest-xdist", "pytest-cov", "coveralls"]
5959

6060
[project.scripts]
61-
feature_download = "tools.cartopy_feature_download.py:__main__"
61+
cartopy_feature_download = "cartopy.feature.download.__main__:main"
6262

6363
[project.urls]
6464
documentation='https://scitools.org.uk/cartopy/docs/latest/'

0 commit comments

Comments
 (0)