Skip to content

Commit

Permalink
feat(get-modflow): support ARM mac distributions (#2110)
Browse files Browse the repository at this point in the history
  • Loading branch information
wpbonelli authored Feb 19, 2024
1 parent dda482b commit 4c5e2ee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion autotest/test_get_modflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ def test_get_release(repo):
tag = "latest"
release = get_release(repo=repo, tag=tag)
assets = release["assets"]

expected_assets = ["linux.zip", "mac.zip", "win64.zip"]
expected_ostags = [a.replace(".zip", "") for a in expected_assets]
actual_assets = [asset["name"] for asset in assets]
Expand All @@ -129,6 +128,8 @@ def test_get_release(repo):
assert {a.rpartition("_")[2] for a in actual_assets} >= {
a for a in expected_assets if not a.startswith("win")
}
elif repo == "modflow6-nightly-build":
expected_assets.append("macarm.zip")
else:
for ostag in expected_ostags:
assert any(
Expand Down
7 changes: 4 additions & 3 deletions flopy/utils/get_modflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import zipfile
from importlib.util import find_spec
from pathlib import Path
from platform import processor

__all__ = ["run_main"]
__license__ = "CC0"
Expand All @@ -33,7 +34,7 @@
"modflow6-nightly-build": "modflow6_nightly",
}
available_repos = list(renamed_prefix.keys())
available_ostags = ["linux", "mac", "win32", "win64"]
available_ostags = ["linux", "mac", "macarm", "win32", "win64"]
max_http_tries = 3

# Check if this is running from flopy
Expand All @@ -60,7 +61,7 @@ def get_ostag() -> str:
elif sys.platform.startswith("win"):
return "win" + ("64" if sys.maxsize > 2**32 else "32")
elif sys.platform.startswith("darwin"):
return "mac"
return "macarm" if processor() == "arm" else "mac"
raise ValueError(f"platform {sys.platform!r} not supported")


Expand All @@ -69,7 +70,7 @@ def get_suffixes(ostag) -> Tuple[str, str]:
return ".exe", ".dll"
elif ostag == "linux":
return "", ".so"
elif ostag == "mac":
elif "mac" in ostag:
return "", ".dylib"
else:
raise KeyError(
Expand Down

0 comments on commit 4c5e2ee

Please sign in to comment.