Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into add_req_reading
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewAnnex committed Feb 5, 2025
2 parents c5634f5 + 6d0168e commit 3852d32
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 34 deletions.
43 changes: 11 additions & 32 deletions .github/workflows/publish-to-test-and-live-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ jobs:
matrix:
include:
- config: {"name": "Linux", "os": "ubuntu-latest", "arch": "x86_64"}
- config: {"name": "Linux", "os": "ubuntu-latest", "arch": "aarch64"}
- config: {"name": "macOS", "os": "macos-14", "arch": "x86_64"}
- config: {"name": "Linux", "os": "ubuntu-22.04-arm", "arch": "aarch64"}
- config: {"name": "macOS", "os": "macos-13", "arch": "x86_64"}
- config: {"name": "macOS", "os": "macos-14", "arch": "arm64"}
- config: {"name": "Windows", "os": "windows-latest", "arch": "AMD64"}
name: Build SpiceyPy 🌶️ 🥧 Python 🐍 wheels for ${{ matrix.config.os }} ${{ matrix.config.arch }}
env:
CSPICE_CACHE: 1
CSPICE_CACHE: 2
CIBW_ARCHS: ${{ matrix.config.arch }}
runs-on: ${{ matrix.config.os }}
steps:
Expand All @@ -71,26 +71,20 @@ jobs:
if: runner.os == 'Windows'
uses: ilammy/[email protected]
- name: set additional environment variables for macOS arm
if: runner.name == 'macOS' && matrix.config.arch == 'arm64'
if: runner.os == 'macOS' && matrix.config.arch == 'arm64'
run: |
echo "CIBW_ARCHS_MACOS=arm64" >> $GITHUB_ENV
echo "ARCHFLAGS='-arch arm64'" >> $GITHUB_ENV
- name: set additional environment variables for macOS x86
if: runner.name == 'macOS' && matrix.config.arch == 'x86_64'
if: runner.os == 'macOS' && matrix.config.arch == 'x86_64'
run: |
echo "CIBW_ARCHS_MACOS=x86_64" >> $GITHUB_ENV
echo "ARCHFLAGS='-arch x86_64'" >> $GITHUB_ENV
- name: Set up QEMU for arm64 builds
if: matrix.config.arch == 'aarch64'
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Cache libcspice.so for aarch64 builds because they take an hour to build with qemu
if: matrix.config.arch == 'aarch64'
uses: actions/cache@v4
with:
path: ./src/spiceypy/utils/libcspice.so
key: ${{ env.CSPICE_CACHE }}-${{ matrix.config.os }}-${{ matrix.config.arch }}-${{ hashFiles('get_spice.py') }}-${{ hashFiles('setup.cfg') }}
- name: set additional environment variables for linux aarch64
if: runner.os == 'Linux' && matrix.config.arch == 'aarch64'
run: |
echo "CIBW_ARCHS_LINUX=aarch64" >> $GITHUB_ENV
echo "ARCHFLAGS='-arch aarch64'" >> $GITHUB_ENV
- name: Set up Python 🐍 3.13
uses: actions/setup-python@v5
with:
Expand All @@ -101,28 +95,13 @@ jobs:
run: |
python -m pip install --upgrade pip
python -m pip install -r ci-requirements.txt
python -m pip install cibuildwheel==2.21.3
- name: See if libcspice.so is available from cache
if: matrix.config.arch == 'aarch64'
run: |
pwd
ls src/spiceypy/utils -lahtr
python -m pip install cibuildwheel==2.22.0
- name: Build wheels for SpiceyPy 🌶️ 🥧
timeout-minutes: 120
run: |
env | grep CIBW
env | grep ARCH
python -m cibuildwheel --output-dir wheelhouse
- name: Extract libcspice.so for aarch64 builds
if: matrix.config.arch == 'aarch64'
run: |
pwd
ls -lahtr
ls src/ -lahtr
ls src/spiceypy/ -lahtr
ls src/spiceypy/utils -lahtr
ls wheelhouse/*
unzip -o wheelhouse/spiceypy-\*.whl 'spiceypy/utils/libcspice.so' -d src/
- name: Check dists
run: |
twine check wheelhouse/*
Expand Down
12 changes: 10 additions & 2 deletions get_spice.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@
# macos builds can occur on x86 or arm64 machines.
# but we need to support cross compilation either way
# so be a little pedantic here
requested_arch_x86 = os.environ.get("ARCHFLAGS", "") == "-arch x86_64"
requested_arch_arm = os.environ.get("ARCHFLAGS", "") == "-arch arm64"
requested_arch_x86 = os.environ.get("ARCHFLAGS", "").strip("'\"") == "-arch x86_64"
requested_arch_arm = os.environ.get("ARCHFLAGS", "").strip("'\"") == "-arch arm64"
# if both are false and on macos do something
if is_macos and (not requested_arch_arm and not requested_arch_x86):
# default to building arm on macos
Expand All @@ -119,6 +119,14 @@
spice_version = "N0067"
spice_num_v = "67"

if is_macos:
print(f"On macOS {host_OS}, host arch {host_arch}")
print(f"requested_arch_x86: {requested_arch_x86}")
print(f"requested_arch_arm: {requested_arch_arm}")
print(f"build_macox_x86: {build_macos_x86}")
print(f"build_macos_arm: {build_macos_arm}")
print(f"is_macos_arm: {is_macos_arm}")


class GetCSPICE(object):
"""
Expand Down

0 comments on commit 3852d32

Please sign in to comment.