Skip to content

Commit ba35fc2

Browse files
use Conda Meson instead of system Meson
Otherwise, Meson insists on getting Cython to include system Python headers which simply doesn't work: ----- Sanity check compile stderr: In file included from /usr/include/python3.10/Python.h:8, from sanity_check_for_cython.c:19: /usr/include/python3.10/pyconfig.h:9:12: fatal error: aarch64-linux-gnu/python3.10/pyconfig.h: No such file or directory 9 | # include <aarch64-linux-gnu/python3.10/pyconfig.h> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. ----- Also, avoid starting a new shell!
1 parent 1fdde70 commit ba35fc2

1 file changed

Lines changed: 44 additions & 13 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ jobs:
3434
miniforge-version: latest
3535
python-version: ${{ matrix.python-version }}
3636

37-
- name: Install compilers
38-
run: conda install -y c-compiler cxx-compiler
37+
- name: Install build dependencies and compilers
38+
run: |
39+
conda install -y python numpy cython meson meson-python ninja c-compiler cxx-compiler
3940
4041
- name: Install clang
4142
if: matrix.platform == 'macos-15-large'
@@ -47,21 +48,33 @@ jobs:
4748
conda config --show-sources
4849
conda list --show-channel-urls
4950
51+
- name: Meson args - prefer Conda over system Python (Ubuntu)
52+
if: startsWith(matrix.platform, 'ubuntu')
53+
run: |
54+
echo "MESONPY_PYTHON=$(python -c 'import sys; print(sys.executable)')" >> $GITHUB_ENV
55+
PY_INC="$(python -c 'import sysconfig; print(sysconfig.get_path("include"))')"
56+
echo "CFLAGS=-I${PY_INC} -I${CONDA_PREFIX}/include ${CFLAGS:-}" >> $GITHUB_ENV
57+
echo "CPPFLAGS=-I${PY_INC} -I${CONDA_PREFIX}/include ${CPPFLAGS:-}" >> $GITHUB_ENV
58+
echo "LDFLAGS=-L${CONDA_PREFIX}/lib ${LDFLAGS:-}" >> $GITHUB_ENV
59+
5060
- name: Install numcodecs
5161
run: |
5262
# TODO: Remove this conditional when pcodec supports Python 3.14
5363
if [[ "${{ matrix.python-version }}" == "3.14" ]]; then
54-
python -m pip install -v ".[test,test_extras,msgpack,google_crc32c,crc32c,zfpy]"
64+
python -m pip install -v \
65+
".[test,test_extras,msgpack,google_crc32c,crc32c,zfpy]" \
66+
pytest
5567
else
56-
python -m pip install -v ".[test,test_extras,msgpack,google_crc32c,crc32c,pcodec,zfpy]"
68+
python -m pip install -v \
69+
".[test,test_extras,msgpack,google_crc32c,crc32c,pcodec,zfpy]" \
70+
pytest
5771
fi
5872
5973
- name: List installed packages
6074
run: python -m pip list
6175

6276
- name: Run tests
63-
shell: "bash -l {0}"
64-
run: pytest -v
77+
run: python -m pytest -v
6578

6679
- uses: codecov/codecov-action@v5
6780
with:
@@ -100,8 +113,17 @@ jobs:
100113
miniforge-version: latest
101114
python-version: "3.13"
102115

103-
- name: Install compilers
104-
run: conda install -y c-compiler cxx-compiler
116+
- name: Install build dependencies and compilers
117+
run: |
118+
conda install -y python numpy cython meson meson-python ninja c-compiler cxx-compiler
119+
120+
- name: Meson args - prefer Conda over system Python (Ubuntu)
121+
run: |
122+
echo "MESONPY_PYTHON=$(python -c 'import sys; print(sys.executable)')" >> $GITHUB_ENV
123+
PY_INC="$(python -c 'import sysconfig; print(sysconfig.get_path("include"))')"
124+
echo "CFLAGS=-I${PY_INC} -I${CONDA_PREFIX}/include ${CFLAGS:-}" >> $GITHUB_ENV
125+
echo "CPPFLAGS=-I${PY_INC} -I${CONDA_PREFIX}/include ${CPPFLAGS:-}" >> $GITHUB_ENV
126+
echo "LDFLAGS=-L${CONDA_PREFIX}/lib ${LDFLAGS:-}" >> $GITHUB_ENV
105127
106128
- name: Install numcodecs
107129
run: |
@@ -115,7 +137,7 @@ jobs:
115137
run: python -m pip list
116138

117139
- name: Run checksum tests
118-
run: pytest -v tests/test_checksum32.py
140+
run: python -m pytest -v tests/test_checksum32.py
119141

120142
- uses: codecov/codecov-action@v5
121143
with:
@@ -154,17 +176,26 @@ jobs:
154176
miniforge-version: latest
155177
python-version: "3.13"
156178

157-
- name: Install compilers
158-
run: conda install -y c-compiler cxx-compiler
179+
- name: Install build dependencies and compilers
180+
run: |
181+
conda install -y python numpy cython meson meson-python ninja c-compiler cxx-compiler
182+
183+
- name: Meson args - prefer Conda over system Python (Ubuntu)
184+
run: |
185+
echo "MESONPY_PYTHON=$(python -c 'import sys; print(sys.executable)')" >> $GITHUB_ENV
186+
PY_INC="$(python -c 'import sysconfig; print(sysconfig.get_path("include"))')"
187+
echo "CFLAGS=-I${PY_INC} -I${CONDA_PREFIX}/include ${CFLAGS:-}" >> $GITHUB_ENV
188+
echo "CPPFLAGS=-I${PY_INC} -I${CONDA_PREFIX}/include ${CPPFLAGS:-}" >> $GITHUB_ENV
189+
echo "LDFLAGS=-L${CONDA_PREFIX}/lib ${LDFLAGS:-}" >> $GITHUB_ENV
159190
160191
- name: Install numcodecs and Zarr
161192
run: |
162-
python -m pip install -v ".[test,test_extras]" "${{ matrix.zarr-pkg }}" crc32c
193+
python -m pip install -v ".[test,test_extras]" "${{ matrix.zarr-pkg }}" crc32c
163194
- name: List installed packages
164195
run: python -m pip list
165196

166197
- name: Run Zarr integration tests
167-
run: pytest tests/test_zarr3.py tests/test_zarr3_import.py
198+
run: python -m pytest tests/test_zarr3.py tests/test_zarr3_import.py
168199

169200
- uses: codecov/codecov-action@v5
170201
with:

0 commit comments

Comments
 (0)