Skip to content

Commit 4e15de8

Browse files
authored
Merge pull request #352 from abravalheri/change-examples
Change examples in accordance to review comments in #348
2 parents fa7de9c + 85df414 commit 4e15de8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+556
-489
lines changed

.github/workflows/ci.yml

Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ jobs:
120120
PYO3_CROSS_LIB_DIR: /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib
121121
run: |
122122
cd examples/namespace_package
123-
pip install wheel
124-
python setup.py bdist_wheel
123+
pip install build wheel
124+
python -m build --no-isolation
125125
ls -l dist/
126126
pip install --force-reinstall dist/namespace_package*_universal2.whl
127127
cd -
@@ -159,16 +159,18 @@ jobs:
159159

160160
- name: Build an abi3 wheel
161161
shell: bash
162+
env:
163+
# https://github.com/actions/setup-python/issues/26
164+
MACOSX_DEPLOYMENT_TARGET: 10.9
165+
DIST_EXTRA_CONFIG: /tmp/build-opts.cfg
162166
run: |
163167
set -e
164168
cd examples/rust_with_cffi/
165169
python --version
166-
pip install -U wheel
167-
python setup.py bdist_wheel --py-limited-api=cp39
170+
pip install -U build cffi wheel
171+
echo -e "[bdist_wheel]\npy_limited_api=cp39" > $DIST_EXTRA_CONFIG
172+
python -m build --no-isolation
168173
ls -la dist/
169-
env:
170-
# https://github.com/actions/setup-python/issues/26
171-
MACOSX_DEPLOYMENT_TARGET: 10.9
172174
173175
# Now we switch to a differnet Python version and ensure we can install
174176
# the wheel we just built.
@@ -222,12 +224,20 @@ jobs:
222224
python3.9 -m pip install crossenv
223225
python3.9 -m crossenv "/opt/python/cp39-cp39/bin/python3" --cc $TARGET_CC --cxx $TARGET_CXX --sysroot $TARGET_SYSROOT --env LIBRARY_PATH= --manylinux manylinux1 venv
224226
. venv/bin/activate
225-
build-pip install cffi wheel "setuptools>=62.4"
227+
228+
build-pip install -U pip>=23.2.1 setuptools>=68.0.0 wheel>=0.41.1
229+
cross-pip install -U pip>=23.2.1 setuptools>=68.0.0 wheel>=0.41.1
230+
build-pip install cffi
226231
cross-expose cffi
227-
pip install wheel
228-
pip install -e ../../
229-
python setup.py bdist_wheel --py-limited-api=cp37
232+
cross-pip install -e ../../
233+
cross-pip list
234+
235+
export DIST_EXTRA_CONFIG=/tmp/build-opts.cfg
236+
echo -e "[bdist_wheel]\npy_limited_api=cp37" > $DIST_EXTRA_CONFIG
237+
238+
cross-pip wheel --no-build-isolation --no-deps --wheel-dir dist .
230239
ls -la dist/
240+
python -m zipfile -l dist/*.whl # debug all files inside wheel file
231241
' > build-wheels.sh
232242
233243
docker run --rm -v "$PWD":/io -w /io messense/manylinux2014-cross:${{ matrix.platform.arch }} bash build-wheels.sh
@@ -269,12 +279,15 @@ jobs:
269279
CARGO: cross
270280
CARGO_BUILD_TARGET: aarch64-unknown-linux-gnu
271281
PYO3_CROSS_LIB_DIR: /opt/python/cp38-cp38/lib
282+
DIST_EXTRA_CONFIG: /tmp/build-opts.cfg
272283
run: |
273284
cd examples/namespace_package
274285
docker build -t cross-pyo3:aarch64-unknown-linux-gnu .
275-
python -m pip install wheel
276-
python setup.py bdist_wheel --plat-name manylinux2014_aarch64
286+
python -m pip install build wheel
287+
echo -e "[bdist_wheel]\nplat_name=manylinux2014_aarch64" > $DIST_EXTRA_CONFIG
288+
python -m build --no-isolation
277289
ls -la dist/
290+
unzip -l dist/*.whl # debug all files inside wheel file
278291
- uses: uraimo/[email protected]
279292
name: Install built wheel
280293
with:
@@ -313,13 +326,16 @@ jobs:
313326
CARGO: cargo-zigbuild
314327
CARGO_BUILD_TARGET: aarch64-unknown-linux-gnu
315328
PYO3_CROSS_LIB_DIR: /opt/python/cp38-cp38/lib
329+
DIST_EXTRA_CONFIG: /tmp/build-opts.cfg
316330
run: |
317331
mkdir -p $PYO3_CROSS_LIB_DIR
318332
docker cp -L $(docker create --rm quay.io/pypa/manylinux2014_aarch64:latest):/opt/python/cp38-cp38 /opt/python
319333
cd examples/namespace_package
320-
python -m pip install wheel
321-
python setup.py bdist_wheel --plat-name manylinux2014_aarch64
334+
python -m pip install build wheel
335+
echo -e "[bdist_wheel]\nplat_name=manylinux2014_aarch64" > $DIST_EXTRA_CONFIG
336+
python -m build --no-isolation
322337
ls -la dist/
338+
unzip -l dist/*.whl # debug all files inside wheel file
323339
- uses: uraimo/[email protected]
324340
name: Install built wheel
325341
with:
@@ -346,9 +362,15 @@ jobs:
346362
- uses: pypa/[email protected]
347363
env:
348364
CIBW_BUILD: cp39-*
349-
CIBW_BEFORE_BUILD: pip install -e .
365+
CIBW_BEFORE_BUILD: pip install -U 'pip>=23.2.1' 'setuptools>=68.0.0' 'wheel<=0.37.1' && pip install -e . && pip list
366+
# ^-- cap on `wheel` is a workaround for pypa/auditwheel#436
367+
# setuptools needs to be upgraded before installing setuptools-rust
350368
CIBW_ARCHS_MACOS: "x86_64 universal2 arm64"
351-
CIBW_BUILD_VERBOSITY: 1
369+
CIBW_BUILD_VERBOSITY: 3
370+
CIBW_BUILD_FRONTEND: pip # pip allows disabling isolation via env var
371+
CIBW_ENVIRONMENT: PIP_NO_BUILD_ISOLATION=false
372+
# ^-- necessary to use working copy of setuptools-rust,
373+
# (however PIP_NO_BUILD_ISOLATION is counter-intuitive: see pypa/pip#5735)
352374
with:
353375
package-dir: examples/namespace_package
354376

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
### Added
99
- Add support for `pyproject.toml` configuration using `[tool.setuptools-rust]` options. [#348](https://github.com/PyO3/setuptools-rust/pull/348)
1010

11+
### Fixed
12+
- Fix `plat_name` handling in the case `bdist_wheel.plat_name` is set via configuration file (e.g., `setup.cfg`). [#352](https://github.com/PyO3/setuptools-rust/pull/352)
13+
1114
## 1.6.0 (2023-04-27)
1215
### Changed
1316
- Prefer passing `--crate-type` option to cargo if "toolchain >= 1.64". [#322](https://github.com/PyO3/setuptools-rust/pull/322)

examples/hello-world-pyprojecttoml/Cargo.lock

Lines changed: 0 additions & 274 deletions
This file was deleted.

0 commit comments

Comments
 (0)