Skip to content

Commit

Permalink
Fix macOS detection when running standalone
Browse files Browse the repository at this point in the history
  • Loading branch information
ktf committed Oct 17, 2023
1 parent 30cec7e commit 5585c71
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
11 changes: 7 additions & 4 deletions alibuild_helpers/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,13 @@ def format(s, **kwds):
def doDetectArch(hasOsRelease, osReleaseLines, platformTuple, platformSystem, platformProcessor):
if platformSystem == "Darwin":
import platform
if platform.machine() == "x86_64":
return "osx_x86-64"
else:
return "osx_arm64"
processor = platformProcessor
if not processor:
if platform.machine() == "x86_64":
processor = "x86-64"

Check warning on line 140 in alibuild_helpers/utilities.py

View check run for this annotation

Codecov / codecov/patch

alibuild_helpers/utilities.py#L137-L140

Added lines #L137 - L140 were not covered by tests
else:
processor = "arm64"
return "osx_%s" % processor.replace("_", "-")

Check warning on line 143 in alibuild_helpers/utilities.py

View check run for this annotation

Codecov / codecov/patch

alibuild_helpers/utilities.py#L142-L143

Added lines #L142 - L143 were not covered by tests
distribution, version, flavour = platformTuple
distribution = distribution.lower()
# If platform.dist does not return something sensible,
Expand Down
1 change: 1 addition & 0 deletions tests/test_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@

architecturePayloads = [
['osx_x86-64', False, [], ('','',''), 'Darwin', 'x86-64'],
['osx_arm64', False, [], ('','',''), 'Darwin', 'arm64'],
['slc5_x86-64', False, [], ('redhat', '5.XX', 'Boron'), 'Linux', 'x86-64'],
['slc6_x86-64', False, [], ('centos', '6.X', 'Carbon'), 'Linux', 'x86-64'],
['slc7_x86-64', False, [], ('centos', '7.X', 'Ptor'), 'Linux', 'x86-64'],
Expand Down

0 comments on commit 5585c71

Please sign in to comment.