Skip to content

Commit 6aacdc1

Browse files
authored
Use uv to build macos wheels (pyca#11561)
refs pyca#11548
1 parent 32a0e53 commit 6aacdc1

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

.github/workflows/wheel-builder.yml

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -222,46 +222,41 @@ jobs:
222222
toolchain: stable
223223
# Add the arm64 target in addition to the native arch (x86_64)
224224
target: aarch64-apple-darwin
225-
- run: ${{ matrix.PYTHON.BIN_PATH }} -m venv venv
226-
- name: Install Python dependencies
227-
run: venv/bin/pip install --require-hashes -r ${{ env.BUILD_REQUIREMENTS_PATH }}
228-
229225
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
230226
with:
231227
name: cryptography-sdist
228+
229+
- run: ${{ matrix.PYTHON.BIN_PATH }} -m pip install uv
232230
- run: mkdir wheelhouse
233231
- name: Build the wheel
234232
run: |
235233
if [ -n "${{ matrix.PYTHON.ABI_VERSION }}" ]; then
236-
PY_LIMITED_API="--config-settings=build-args=--features=pyo3/abi3-${{ matrix.PYTHON.ABI_VERSION }} --no-build-isolation"
234+
PY_LIMITED_API="--config-settings=build-args=--features=pyo3/abi3-${{ matrix.PYTHON.ABI_VERSION }}"
237235
fi
238236
239-
# `maturin` has a binary that needs to be on the $PATH, so we
240-
# activate the venv.
241-
source venv/bin/activate
242237
OPENSSL_DIR="$(readlink -f ../openssl-macos-universal2/)" \
243238
OPENSSL_STATIC=1 \
244-
venv/bin/python -m pip wheel -v --no-deps $PY_LIMITED_API cryptograph*.tar.gz -w dist/
245-
mv dist/cryptography*.whl wheelhouse
239+
uv build --wheel --require-hashes --build-constraint=$BUILD_REQUIREMENTS_PATH $PY_LIMITED_API cryptography*.tar.gz -o wheelhouse/
246240
env:
247241
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.PYTHON.DEPLOYMENT_TARGET }}
248242
ARCHFLAGS: ${{ matrix.PYTHON.ARCHFLAGS }}
249243
_PYTHON_HOST_PLATFORM: ${{ matrix.PYTHON._PYTHON_HOST_PLATFORM }}
250-
- run: venv/bin/pip install -f wheelhouse/ --no-index cryptography
244+
245+
- run: uv venv
246+
- run: uv pip install --require-hashes -r $BUILD_REQUIREMENTS_PATH
247+
- run: uv pip install cryptography --no-index -f wheelhouse/
251248
- name: Show the wheel's minimum macOS SDK and architectures
252249
run: |
253-
find venv/lib/*/site-packages/cryptography/hazmat/bindings -name '*.so' -exec vtool -show {} \;
250+
find .venv/lib/*/site-packages/cryptography/hazmat/bindings -name '*.so' -exec vtool -show {} \;
254251
- run: |
255-
venv/bin/python -c "from cryptography.hazmat.backends.openssl.backend import backend;print('Loaded: ' + backend.openssl_version_text());print('Linked Against: ' + backend._ffi.string(backend._lib.OPENSSL_VERSION_TEXT).decode('ascii'))"
252+
.venv/bin/python -c "from cryptography.hazmat.backends.openssl.backend import backend;print('Loaded: ' + backend.openssl_version_text());print('Linked Against: ' + backend._ffi.string(backend._lib.OPENSSL_VERSION_TEXT).decode('ascii'))"
256253
257-
- run: mkdir cryptography-wheelhouse
258-
- run: mv wheelhouse/cryptography*.whl cryptography-wheelhouse/
259254
- run: |
260-
echo "CRYPTOGRAPHY_WHEEL_NAME=$(basename $(ls cryptography-wheelhouse/cryptography*.whl))" >> $GITHUB_ENV
255+
echo "CRYPTOGRAPHY_WHEEL_NAME=$(basename $(ls wheelhouse/cryptography*.whl))" >> $GITHUB_ENV
261256
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
262257
with:
263258
name: "${{ env.CRYPTOGRAPHY_WHEEL_NAME }}"
264-
path: cryptography-wheelhouse/
259+
path: wheelhouse/
265260

266261
windows:
267262
needs: [sdist]

0 commit comments

Comments
 (0)