Skip to content

Commit

Permalink
Merge pull request #352 from abravalheri/change-examples
Browse files Browse the repository at this point in the history
Change examples in accordance to review comments in #348
  • Loading branch information
davidhewitt committed Aug 19, 2023
2 parents fa7de9c + 85df414 commit 4e15de8
Show file tree
Hide file tree
Showing 56 changed files with 556 additions and 489 deletions.
56 changes: 39 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ jobs:
PYO3_CROSS_LIB_DIR: /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib
run: |
cd examples/namespace_package
pip install wheel
python setup.py bdist_wheel
pip install build wheel
python -m build --no-isolation
ls -l dist/
pip install --force-reinstall dist/namespace_package*_universal2.whl
cd -
Expand Down Expand Up @@ -159,16 +159,18 @@ jobs:

- name: Build an abi3 wheel
shell: bash
env:
# https://github.com/actions/setup-python/issues/26
MACOSX_DEPLOYMENT_TARGET: 10.9
DIST_EXTRA_CONFIG: /tmp/build-opts.cfg
run: |
set -e
cd examples/rust_with_cffi/
python --version
pip install -U wheel
python setup.py bdist_wheel --py-limited-api=cp39
pip install -U build cffi wheel
echo -e "[bdist_wheel]\npy_limited_api=cp39" > $DIST_EXTRA_CONFIG
python -m build --no-isolation
ls -la dist/
env:
# https://github.com/actions/setup-python/issues/26
MACOSX_DEPLOYMENT_TARGET: 10.9
# Now we switch to a differnet Python version and ensure we can install
# the wheel we just built.
Expand Down Expand Up @@ -222,12 +224,20 @@ jobs:
python3.9 -m pip install crossenv
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
. venv/bin/activate
build-pip install cffi wheel "setuptools>=62.4"
build-pip install -U pip>=23.2.1 setuptools>=68.0.0 wheel>=0.41.1
cross-pip install -U pip>=23.2.1 setuptools>=68.0.0 wheel>=0.41.1
build-pip install cffi
cross-expose cffi
pip install wheel
pip install -e ../../
python setup.py bdist_wheel --py-limited-api=cp37
cross-pip install -e ../../
cross-pip list
export DIST_EXTRA_CONFIG=/tmp/build-opts.cfg
echo -e "[bdist_wheel]\npy_limited_api=cp37" > $DIST_EXTRA_CONFIG
cross-pip wheel --no-build-isolation --no-deps --wheel-dir dist .
ls -la dist/
python -m zipfile -l dist/*.whl # debug all files inside wheel file
' > build-wheels.sh
docker run --rm -v "$PWD":/io -w /io messense/manylinux2014-cross:${{ matrix.platform.arch }} bash build-wheels.sh
Expand Down Expand Up @@ -269,12 +279,15 @@ jobs:
CARGO: cross
CARGO_BUILD_TARGET: aarch64-unknown-linux-gnu
PYO3_CROSS_LIB_DIR: /opt/python/cp38-cp38/lib
DIST_EXTRA_CONFIG: /tmp/build-opts.cfg
run: |
cd examples/namespace_package
docker build -t cross-pyo3:aarch64-unknown-linux-gnu .
python -m pip install wheel
python setup.py bdist_wheel --plat-name manylinux2014_aarch64
python -m pip install build wheel
echo -e "[bdist_wheel]\nplat_name=manylinux2014_aarch64" > $DIST_EXTRA_CONFIG
python -m build --no-isolation
ls -la dist/
unzip -l dist/*.whl # debug all files inside wheel file
- uses: uraimo/run-on-arch-action@v2.5.0
name: Install built wheel
with:
Expand Down Expand Up @@ -313,13 +326,16 @@ jobs:
CARGO: cargo-zigbuild
CARGO_BUILD_TARGET: aarch64-unknown-linux-gnu
PYO3_CROSS_LIB_DIR: /opt/python/cp38-cp38/lib
DIST_EXTRA_CONFIG: /tmp/build-opts.cfg
run: |
mkdir -p $PYO3_CROSS_LIB_DIR
docker cp -L $(docker create --rm quay.io/pypa/manylinux2014_aarch64:latest):/opt/python/cp38-cp38 /opt/python
cd examples/namespace_package
python -m pip install wheel
python setup.py bdist_wheel --plat-name manylinux2014_aarch64
python -m pip install build wheel
echo -e "[bdist_wheel]\nplat_name=manylinux2014_aarch64" > $DIST_EXTRA_CONFIG
python -m build --no-isolation
ls -la dist/
unzip -l dist/*.whl # debug all files inside wheel file
- uses: uraimo/run-on-arch-action@v2.5.0
name: Install built wheel
with:
Expand All @@ -346,9 +362,15 @@ jobs:
- uses: pypa/cibuildwheel@v2.3.1
env:
CIBW_BUILD: cp39-*
CIBW_BEFORE_BUILD: pip install -e .
CIBW_BEFORE_BUILD: pip install -U 'pip>=23.2.1' 'setuptools>=68.0.0' 'wheel<=0.37.1' && pip install -e . && pip list
# ^-- cap on `wheel` is a workaround for pypa/auditwheel#436
# setuptools needs to be upgraded before installing setuptools-rust
CIBW_ARCHS_MACOS: "x86_64 universal2 arm64"
CIBW_BUILD_VERBOSITY: 1
CIBW_BUILD_VERBOSITY: 3
CIBW_BUILD_FRONTEND: pip # pip allows disabling isolation via env var
CIBW_ENVIRONMENT: PIP_NO_BUILD_ISOLATION=false
# ^-- necessary to use working copy of setuptools-rust,
# (however PIP_NO_BUILD_ISOLATION is counter-intuitive: see pypa/pip#5735)
with:
package-dir: examples/namespace_package

Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
### Added
- Add support for `pyproject.toml` configuration using `[tool.setuptools-rust]` options. [#348](https://github.com/PyO3/setuptools-rust/pull/348)

### Fixed
- 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)

## 1.6.0 (2023-04-27)
### Changed
- Prefer passing `--crate-type` option to cargo if "toolchain >= 1.64". [#322](https://github.com/PyO3/setuptools-rust/pull/322)
Expand Down
274 changes: 0 additions & 274 deletions examples/hello-world-pyprojecttoml/Cargo.lock

This file was deleted.

0 comments on commit 4e15de8

Please sign in to comment.