Skip to content

Commit d9e75ac

Browse files
committed
Install the freshly built wheel in macOS CI
Non-static macOS jobs could fail at import with "lxml & xmlsec libxml2 library version mismatch". The static and non-static jobs share a uv cache, since the key only uses the Python version and lockfile, and they build wheels with the same filename. uv then installed the cached wheel from the other job instead of the one in dist/, so a static wheel with libxml2 2.14.6 ended up next to an lxml built against Homebrew's 2.15.4. Pass --refresh-package xmlsec so each job installs the wheel it just built. This corrects the diagnosis in the previous commit, which blamed preinstalled Pythons. Remove the CONTRIBUTING.md advice based on it, and keep UV_PYTHON_PREFERENCE=only-managed only so every job uses the same kind of Python.
1 parent dc29cfd commit d9e75ac

2 files changed

Lines changed: 5 additions & 9 deletions

File tree

‎.github/workflows/macosx.yml‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ jobs:
1717
runs-on: macos-latest
1818

1919
env:
20-
# Runners preinstall several Pythons. Without this, uv can pick one of them (for example
21-
# the universal2 build of 3.11), and lxml and xmlsec can end up on different libxml2 versions.
20+
# Runners preinstall several Pythons. Use uv's own so every job in the matrix gets the same kind of build.
2221
UV_PYTHON_PREFERENCE: only-managed
2322
LIBICONV_VERSION: ${{ needs.cache_libs.outputs.LIBICONV_VERSION }}
2423
LIBXML2_VERSION: ${{ needs.cache_libs.outputs.LIBXML2_VERSION }}
@@ -70,18 +69,20 @@ jobs:
7069
shell: bash
7170
run: echo "LLVM_PROFILE_FILE=pyxmlsec.profraw" >> $GITHUB_ENV
7271

72+
# Static and non-static jobs share a uv cache and build wheels with the same filename, so uv can
73+
# install the other job's cached wheel from dist/. --refresh-package makes it use the one just built.
7374
- name: Install test dependencies (static only)
7475
if: matrix.static_deps == 'static'
7576
run: |
7677
uv sync --locked --no-default-groups --group test --group coverage --no-install-project
77-
uv pip install xmlsec --only-binary xmlsec --no-index --find-links dist/
78+
uv pip install xmlsec --only-binary xmlsec --no-index --find-links dist/ --refresh-package xmlsec
7879
7980
- name: Install test dependencies (non-static only)
8081
if: matrix.static_deps != 'static'
8182
run: |
8283
export PKG_CONFIG_PATH="$(brew --prefix)/opt/libxml2/lib/pkgconfig"
8384
uv sync --locked --no-default-groups --group test --group coverage --no-install-project --no-binary-package lxml
84-
uv pip install xmlsec --only-binary xmlsec --no-index --find-links dist/
85+
uv pip install xmlsec --only-binary xmlsec --no-index --find-links dist/ --refresh-package xmlsec
8586
# Assign separately so that a failed import stops this step.
8687
PYXMLSEC_LIBFILE="$(uv run --no-sync python -c 'import xmlsec; print(xmlsec.__file__)')"
8788
echo "PYXMLSEC_LIBFILE=$PYXMLSEC_LIBFILE" >> $GITHUB_ENV

‎CONTRIBUTING.md‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,6 @@ in [Option B](#option-b-system-libraries).
219219
the variables for your chosen option, then rebuild both packages as described in
220220
[Switching between options](#switching-between-options).
221221

222-
If that doesn't help on macOS, uv may have picked a preinstalled Python, such as
223-
a universal2 build in `/usr/local/bin`. Check with `uv python find`, then
224-
`export UV_PYTHON_PREFERENCE=only-managed` to use uv's own Python, delete `.venv`
225-
and rebuild.
226-
227222
### C changes don't seem to take effect
228223

229224
Force a rebuild with `uv sync --reinstall-package xmlsec`. This also refreshes

0 commit comments

Comments
 (0)