From 060d749418b69bd2ce4a6fd32b9d49fe0f8c9ce4 Mon Sep 17 00:00:00 2001 From: wpbonelli Date: Mon, 23 Nov 2026 05:25:33 -0800 Subject: [PATCH 1/3] fix(usgsprograms): update SEAWAT url to the legacy-software location water.usgs.gov/water-resources/software/SEAWAT now redirects to an HTML page, so the download is not a zip file. Co-Authored-By: Claude Opus 5.5 --- pymake/utils/usgsprograms.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pymake/utils/usgsprograms.toml b/pymake/utils/usgsprograms.toml index 33d32b8f..5cf020c5 100644 --- a/pymake/utils/usgsprograms.toml +++ b/pymake/utils/usgsprograms.toml @@ -162,7 +162,7 @@ shared_object = false [program."swtv4"] version = "4.00.05" current = true -url = "https://water.usgs.gov/water-resources/software/SEAWAT/swt_v4_00_05.zip" +url = "https://water.usgs.gov/water-resources/legacy-software/SEAWAT/swt_v4_00_05.zip" dirname = "swt_v4_00_05" srcdir = "source" standard_precision = false From be5c10d7c9c080898ccf83fd46ad4082ef94773a Mon Sep 17 00:00:00 2001 From: wpbonelli Date: Mon, 23 Nov 2026 15:33:10 -0800 Subject: [PATCH 2/3] fix(download): extract a distribution zip nested in the download The SEAWAT download at the legacy-software location wraps swt_v4_00_05.zip, with documentation, in an outer zip. If the target's directory is missing after download, extract a nested zip with its name and remove the rest of the outer archive. Co-Authored-By: Claude Opus 5.5 --- pymake/pymake.py | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/pymake/pymake.py b/pymake/pymake.py index dbd9ebab..b8bf2568 100644 --- a/pymake/pymake.py +++ b/pymake/pymake.py @@ -67,7 +67,7 @@ _get_osname, ) from .utils._usgs_src_update import _build_replace -from .utils.download import download_and_unzip, zip_all +from .utils.download import download_and_unzip, pymakeZipFile, zip_all from .utils.usgsprograms import usgs_program_data @@ -410,8 +410,37 @@ def download_url(self): timeout=self.timeout, verbose=self.verbose, ) + if self.download and not Path(self.download_dir).is_dir(): + self._extract_nested() return self.download + def _extract_nested(self): + """Extract a distribution zip nested in the downloaded archive. + + Some legacy USGS downloads wrap the distribution zip, with its + documentation, in an outer zip. If the expected directory is missing + after the download, look for a zip with the directory's name among the + extracted files and extract it in its place. + + Returns + ------- + + """ + download_path = Path(self.download_path) + name = Path(self.download_dir).name + for inner in download_path.rglob(f"{name}.zip"): + if self.verbose: + print(f"uncompressing nested...'{inner}'") + with pymakeZipFile(inner) as z: + z.extractall(download_path) + # remove what remains of the outer archive + wrapper = download_path / inner.relative_to(download_path).parts[0] + if wrapper == inner: + inner.unlink() + else: + shutil.rmtree(wrapper) + return + def _download_cleanup(self): """Remove the temporary download directory. From 942deed7b2ae8c9de6164637e5e35ac3d4b49a8e Mon Sep 17 00:00:00 2001 From: wpbonelli Date: Wed, 25 Nov 2026 04:21:41 -0800 Subject: [PATCH 3/3] test(mp7): replace IMS keywords removed in MODFLOW 6.8.0 The MODPATH 7 examples use OUTER_HCLOSE and INNER_HCLOSE, which MODFLOW 6.8.0 removed in favor of OUTER_DVCLOSE and INNER_DVCLOSE, so mf6 fails to read their .ims files. Rewrite the keywords before running the examples. Co-Authored-By: Claude Opus 5.5 --- autotest/test_mp7.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/autotest/test_mp7.py b/autotest/test_mp7.py index ae68f819..d8125605 100644 --- a/autotest/test_mp7.py +++ b/autotest/test_mp7.py @@ -1,4 +1,5 @@ import os +import re import shutil from pathlib import Path from platform import system @@ -98,6 +99,15 @@ def replace_data(dpth): with open(fpth, "w") as f: f.writelines(content) + # MODFLOW 6.8.0 removed the IMS keywords OUTER_HCLOSE and INNER_HCLOSE, + # which the examples still use, in favor of OUTER_DVCLOSE and INNER_DVCLOSE + for fname in fpths: + if not fname.lower().endswith(".ims"): + continue + fpth = Path(dpth) / fname + text = fpth.read_text() + fpth.write_text(re.sub(r"(?i)\b(outer|inner)_hclose\b", r"\1_DVCLOSE", text)) + def set_lowercase(fpth): with open(fpth, "r") as f: