Skip to content

Commit

Permalink
python
Browse files Browse the repository at this point in the history
  • Loading branch information
b8raoult committed Feb 3, 2024
1 parent daf51c2 commit c66f22e
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 42 deletions.
59 changes: 20 additions & 39 deletions .github/workflows/build-macos-arm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ on:
- 'scripts/wheel-macos.sh'
- 'tools/copy-licences.py'

# We don't use "actions/setup-python@v4" as it installs a universal python
# which creates universal wheels. We want to create wheels for the specific
# architecture we are running on.

jobs:

build:
Expand All @@ -42,69 +46,50 @@ jobs:

- uses: actions/checkout@v2

- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"

- run: ./scripts/select-python.sh "3.10"
- run: ./scripts/build-macos.sh


################################################################
- name: Set up Python 3.10
uses: actions/setup-python@v4
- run: ./scripts/select-python.sh "3.9"
- run: ./scripts/wheel-macos.sh "3.9"
- uses: actions/upload-artifact@v2
name: Upload wheel 3.9
with:
python-version: "3.10"
- run: ./scripts/wheel-macos.sh 3.10
name: wheel-macos-3.9
path: wheelhouse/*.whl

################################################################
- run: ./scripts/select-python.sh "3.10"
- run: ./scripts/wheel-macos.sh "3.10"
- uses: actions/upload-artifact@v2
name: Upload wheel 3.10
with:
name: wheel-macos-3.10
path: wheelhouse/*.whl

################################################################
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
- run: ./scripts/wheel-macos.sh 3.11
- run: ./scripts/select-python.sh "3.10"
- run: ./scripts/wheel-macos.sh "3.11"
- uses: actions/upload-artifact@v2
name: Upload wheel 3.11
with:
name: wheel-macos-3.11
path: wheelhouse/*.whl

################################################################
# - name: Set up Python 3.12
# uses: actions/setup-python@v4
# with:
# python-version: "3.12"
# - run: ./scripts/wheel-macos-arm.sh "3.12"
# - uses: actions/upload-artifact@v2
# name: Upload wheel 3.12
# with:
# name: wheel-macos-3.12
# path: wheelhouse/*.whl

test:
needs: build
runs-on: macos-latest
strategy:
fail-fast: true
matrix:
python-version: ["3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11"]

name: Test with Python ${{ matrix.python-version }}

steps:

- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- run: ./scripts/select-python.sh ${{ matrix.python-version }}
- uses: actions/download-artifact@v2
with:
name: wheel-macos-${{ matrix.python-version }}
Expand Down Expand Up @@ -150,11 +135,7 @@ jobs:

steps:

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- run: ./scripts/select-python.sh ${{ matrix.python-version }}
- run: pip install twine

- uses: actions/download-artifact@v2
Expand Down
2 changes: 1 addition & 1 deletion ecmwflibs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

from findlibs import find as _find_library

__version__ = "0.6.0"
__version__ = "0.6.1"


_here = os.path.join(os.path.dirname(__file__))
Expand Down
4 changes: 4 additions & 0 deletions scripts/select-python.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
version=$1

brew install python@$1
7 changes: 5 additions & 2 deletions scripts/wheel-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
# nor does it submit to any jurisdiction.

set -eaux
VERSION=$1

PATH=/opt/homebrew/opt/python@$VERSION/libexec/bin:$PATH

# PATH=/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin
# unset PKG_CONFIG_PATH
Expand All @@ -19,8 +22,8 @@ pip3 install wheel delocate setuptools

# https://setuptools.pypa.io/en/latest/userguide/ext_modules.html#cross-platform-compilation
# Prevent ext_modules from being built as universal
CXX=./scripts/cxx-no-arch.sh
CC=./scripts/c-no-arch.sh
# CXX=./scripts/cxx-no-arch.sh
# CC=./scripts/c-no-arch.sh

which python3
python3 --version
Expand Down

0 comments on commit c66f22e

Please sign in to comment.