Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion autotest/t007_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
3 changes: 2 additions & 1 deletion autotest/t009_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
3 changes: 1 addition & 2 deletions autotest/t999_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions pymake/build_program.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 20 additions & 6 deletions pymake/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,22 +161,26 @@ 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.

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
-------
result_dict : dict
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:
Expand All @@ -187,22 +191,26 @@ 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.

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
-------
version : str
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)

Expand All @@ -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
Expand All @@ -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,
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pymake/usgsprograms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down