diff --git a/autotest/t007_test.py b/autotest/t007_test.py index fc3b5a56..d27bc928 100644 --- a/autotest/t007_test.py +++ b/autotest/t007_test.py @@ -176,7 +176,8 @@ def clean_up(pth, exe): def test_download_exes(): - pymake.getmfexes(dstpth, version='3.0', exes=('mf2005', 'mfusg', 'mf6')) + version = pymake.repo_latest_version() + pymake.getmfexes(dstpth, version=version, exes=('mf2005', 'mfusg', 'mf6')) return diff --git a/autotest/t009_test.py b/autotest/t009_test.py index 6bd57d0e..3da8d965 100644 --- a/autotest/t009_test.py +++ b/autotest/t009_test.py @@ -112,7 +112,8 @@ def clean_up(pth, exe): def test_download_exes(): - pymake.getmfexes(dstpth, version='3.0', exes=('mfnwt', 'mf6')) + version = pymake.repo_latest_version() + pymake.getmfexes(dstpth, version=version, exes=('mfnwt', 'mf6')) return diff --git a/autotest/t999_test.py b/autotest/t999_test.py index 9d0e15fc..307f04d5 100644 --- a/autotest/t999_test.py +++ b/autotest/t999_test.py @@ -28,8 +28,7 @@ def is_exe(fpath): def test_latest_version(): - mfexes_repo_name = 'MODFLOW-USGS/executables' - version = pymake.repo_latest_version(mfexes_repo_name) + version = pymake.repo_latest_version() test_version = '3.0' msg = 'returned version ({}) '.format(version) + \ 'is not equal to defined version ({})'.format(test_version) diff --git a/pymake/build_program.py b/pymake/build_program.py index 6f2f82fb..75bb3a6c 100644 --- a/pymake/build_program.py +++ b/pymake/build_program.py @@ -1250,6 +1250,11 @@ def update_mfnwt_files(srcdir, fc, cc, arch, double): f.write(line) f.close() + # remove lrestart.f + fpth = os.path.join(srcdir, 'Irestart.f') + if os.path.exists(fpth): + os.remove(fpth) + def update_gsflow_files(srcdir, fc, cc, arch, double): # update gwf2swt7.f diff --git a/pymake/download.py b/pymake/download.py index 9b33ebf6..26a88d54 100644 --- a/pymake/download.py +++ b/pymake/download.py @@ -161,7 +161,7 @@ def repo_json_assets(github_repo): return assets -def repo_latest_assets(github_repo): +def repo_latest_assets(github_repo=None): """ Return a dictionary containing the file name and the link to the asset contained in a github repository. @@ -169,7 +169,8 @@ def repo_latest_assets(github_repo): Parameters ---------- github_repo : str - Repository name, such as MODFLOW-USGS/modflow6 + Repository name, such as MODFLOW-USGS/modflow6. If github_repo is + None set to 'MODFLOW-USGS/executables' Returns ------- @@ -177,6 +178,9 @@ def repo_latest_assets(github_repo): dictionary of file names and links """ + if github_repo is None: + github_repo = 'MODFLOW-USGS/executables' + assets = repo_json_assets(github_repo) result_dict = {} for asset in assets: @@ -187,7 +191,7 @@ def repo_latest_assets(github_repo): return result_dict -def repo_latest_version(github_repo): +def repo_latest_version(github_repo=None): """ Return a string of the latest version number (tag) contained in a github repository release. @@ -195,7 +199,8 @@ def repo_latest_version(github_repo): Parameters ---------- github_repo : str - Repository name, such as MODFLOW-USGS/modflow6 + Repository name, such as MODFLOW-USGS/modflow6. If github_repo is + None set to 'MODFLOW-USGS/executables' Returns ------- @@ -203,6 +208,9 @@ def repo_latest_version(github_repo): string with the latest version/tag number """ + if github_repo is None: + github_repo = 'MODFLOW-USGS/executables' + version = None assets = repo_json_assets(github_repo) @@ -221,7 +229,7 @@ def repo_latest_version(github_repo): return version -def getmfexes(pth='.', version=3.0, platform=None, exes=None): +def getmfexes(pth='.', version=None, platform=None, exes=None): """ Get the latest MODFLOW binary executables from a github site (https://github.com/MODFLOW-USGS/executables) for the specified @@ -233,7 +241,8 @@ def getmfexes(pth='.', version=3.0, platform=None, exes=None): Location to put the executables (default is current working directory) version : str - Version of the MODFLOW-USGS/executables release to use. + Version of the MODFLOW-USGS/executables release to use. If version is + None the github repo will be queried for the version number. platform : str Platform that will run the executables. Valid values include mac, @@ -244,6 +253,11 @@ def getmfexes(pth='.', version=3.0, platform=None, exes=None): executable or list of executables to retain """ + # determine latest version number if not passed + if version is None: + version = repo_latest_version('MODFLOW-USGS/executables') + + # set download directory to path in case a selection of files download_dir = pth # Determine the platform in order to construct the zip file name diff --git a/pymake/usgsprograms.txt b/pymake/usgsprograms.txt index 214f23fe..7ceeabfa 100644 --- a/pymake/usgsprograms.txt +++ b/pymake/usgsprograms.txt @@ -2,8 +2,8 @@ mf2000 1.19.01 True https://water.usgs.gov/nrp/gwsoftware/modflow2000/mf2k1_19_01.tar.gz mf2k.1_19 src mf2005 1.12.00 True https://water.usgs.gov/water-resources/software/MODFLOW-2005/MF2005.1_12u.zip MF2005.1_12u src mf2005.1.11 1.11.00 False https://water.usgs.gov/ogw/modflow/archive-mf2005/MODFLOW-2005_v1.11.00/mf2005v1_11_00_unix.zip Unix src -mfnwt 1.1.4 True https://water.usgs.gov/water-resources/software/MODFLOW-NWT/MODFLOW-NWT_1.1.4.zip MODFLOW-NWT_1.1.4 src -mfnwt1.2.0 1.2.0 False https://water.usgs.gov/water-resources/software/MODFLOW-NWT/MODFLOW-NWT_1.2.0.zip MODFLOW-NWT_1.2.0 src +mfnwt1.1.4 1.1.4 False https://water.usgs.gov/water-resources/software/MODFLOW-NWT/MODFLOW-NWT_1.1.4.zip MODFLOW-NWT_1.1.4 src +mfnwt 1.2.0 True https://water.usgs.gov/water-resources/software/MODFLOW-NWT/MODFLOW-NWT_1.2.0.zip MODFLOW-NWT_1.2.0 src mfusg 1.5 True https://water.usgs.gov/water-resources/software/MODFLOW-USG/mfusg1_5.zip mfusg1_5 src zonbudusg 1.5 True https://water.usgs.gov/water-resources/software/MODFLOW-USG/mfusg1_5.zip mfusg1_5 src/zonebudusg mf6 6.1.0 True https://water.usgs.gov/water-resources/software/MODFLOW-6/mf6.1.0.zip mf6.1.0 src