From ee71acd1e47edb33c0306a004e75347dded4f529 Mon Sep 17 00:00:00 2001 From: Joseph Hughes Date: Mon, 10 Aug 2026 22:14:54 -0500 Subject: [PATCH] fix(download): request the macarm asset on Apple Silicon The executables and modflow6-nightly-build releases stopped building a mac.zip asset after release 25.0 and now ship macarm.zip as the only macOS asset, so getmfexes and getmfnightly asked for an asset that no longer exists and failed with a 404 on Apple Silicon. The macOS asset is now selected from the machine architecture, and macarm is accepted as a platform value. A test asserts that the asset detected for the current platform exists in the release, which fails on develop. --- autotest/test_requests.py | 15 +++++++++++++++ pymake/utils/download.py | 23 ++++++++++++++--------- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/autotest/test_requests.py b/autotest/test_requests.py index c625b105..67850287 100644 --- a/autotest/test_requests.py +++ b/autotest/test_requests.py @@ -103,6 +103,21 @@ def test_latest_assets(): assert key in test_keys, msg +@flaky(max_runs=RERUNS) +@pytest.mark.requests +def test_detected_asset(): + """The asset detected for the current platform must exist in the release.""" + from pymake.utils.download import _get_zipname + + zipname = _get_zipname(None) + assets = pymake.get_repo_assets("MODFLOW-USGS/executables") + print(f"evaluating the availability of...{zipname}") + assert zipname in assets, ( + f"asset ({zipname}) detected for {sys.platform} is not in the release " + f"assets ({', '.join(assets.keys())})" + ) + + @pytest.mark.dependency("previous_assets") @flaky(max_runs=RERUNS) @pytest.mark.requests diff --git a/pymake/utils/download.py b/pymake/utils/download.py index 9ad028d0..afb5fe7a 100644 --- a/pymake/utils/download.py +++ b/pymake/utils/download.py @@ -14,6 +14,7 @@ """ import os +import platform as _platform import shutil import sys import tarfile @@ -551,8 +552,8 @@ def _get_zipname(platform): ---------- platform : str Platform that will run the executables. Valid values include mac, - linux, win32 and win64. If platform is None, then routine will - download the latest asset from the github repository. + macarm, linux, win32 and win64. If platform is None, then routine + will download the latest asset from the github repository. Returns ------- @@ -562,7 +563,11 @@ def _get_zipname(platform): """ if platform is None: if sys.platform.lower() == "darwin": - platform = "mac" + # only arm64 assets are built for macOS + if _platform.machine().lower() in ("arm64", "aarch64"): + platform = "macarm" + else: + platform = "mac" elif sys.platform.lower().startswith("linux"): platform = "linux" elif "win" in sys.platform.lower(): @@ -576,7 +581,7 @@ def _get_zipname(platform): raise Exception(errmsg) else: msg = f"unknown platform detected ({platform})" - success = platform in ["mac", "linux", "win32", "win64"] + success = platform in ["mac", "macarm", "linux", "win32", "win64"] if not success: raise ValueError(msg) return f"{platform}.zip" @@ -631,7 +636,7 @@ def _get_default_json(tag_name=None): url += f"{tag_name}/" # define asset names and paths for assets - names = ["mac.zip", "linux.zip", "win32.zip", "win64.zip"] + names = ["mac.zip", "macarm.zip", "linux.zip", "win32.zip", "win64.zip"] paths = [url + p for p in names] assets_list = [] @@ -869,8 +874,8 @@ def getmfexes( None the github repo will be queried for the version number. platform : str Platform that will run the executables. Valid values include mac, - linux, win32 and win64. If platform is None, then routine will - download the latest asset from the github repository. + macarm, linux, win32 and win64. If platform is None, then routine + will download the latest asset from the github repository. exes : str or list of strings executable or list of executables to retain verbose : bool @@ -951,8 +956,8 @@ def getmfnightly( Location to put the executables (default is current working directory) platform : str Platform that will run the executables. Valid values include mac, - linux, win32 and win64. If platform is None, then routine will - download the latest asset from the github repository. + macarm, linux, win32 and win64. If platform is None, then routine + will download the latest asset from the github repository. exes : str or list of strings executable or list of executables to retain verbose : bool