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 17b7599 commit c1b5032
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ permissions: {}
jobs:
unittest:
name: python${{ matrix.python-version }}
runs-on: ubuntu-20.04
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [macos-latest, ubuntu-20.04]
python-version:
- '3.6.8' # slc7, slc8 and cs8 containers
- '3.7'
Expand Down
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"
else:
processor = "arm64"
return "osx_%s" % processor.replace("_", "-")
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 c1b5032

Please sign in to comment.