From a431f7e4ae0a3b0ffc7d9d05e0203d458008daaa Mon Sep 17 00:00:00 2001 From: messense Date: Tue, 12 Oct 2021 20:55:26 +0800 Subject: [PATCH] Fix cross compilation for Python 3.10 --- .github/workflows/test.yml | 17 +++++++++++------ src/cross_compile.rs | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 052796ef9..20a0de88a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -201,11 +201,16 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - platform: [ - { target: "aarch64-unknown-linux-gnu", arch: "aarch64" }, - { target: "armv7-unknown-linux-gnueabihf", arch: "armv7" }, - { target: "s390x-unknown-linux-gnu", arch: "s390x" }, - ] + platform: + - target: aarch64-unknown-linux-gnu + arch: aarch64 + abi: cp36-cp36m + - target: armv7-unknown-linux-gnueabihf + arch: armv7 + abi: cp39-cp39 + - target: s390x-unknown-linux-gnu + arch: s390x + abi: cp310-cp310 steps: - uses: actions/checkout@v2 - name: Build Wheels @@ -213,7 +218,7 @@ jobs: echo 'curl -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable --profile minimal source ~/.cargo/env rustup target add ${{ matrix.platform.target }} - export PYO3_CROSS_LIB_DIR=/opt/python/cp36-cp36m/lib + export PYO3_CROSS_LIB_DIR=/opt/python/${{ matrix.platform.abi }}/lib cargo run --target x86_64-unknown-linux-gnu -- build -i python3.9 --release --out dist --no-sdist --target ${{ matrix.platform.target }} -m test-crates/pyo3-mixed/Cargo.toml ' > build-wheel.sh docker run --rm -v "$PWD":/io -w /io messense/manylinux2014-cross:${{ matrix.platform.arch }} bash build-wheel.sh diff --git a/src/cross_compile.rs b/src/cross_compile.rs index 2f992d178..8cc972926 100644 --- a/src/cross_compile.rs +++ b/src/cross_compile.rs @@ -49,7 +49,7 @@ pub fn parse_sysconfigdata( let mut script = fs::read_to_string(config_path)?; script += r#" print("version_major", build_time_vars["VERSION"][0]) # 3 -print("version_minor", build_time_vars["VERSION"][2]) # E.g., 8 +print("version_minor", build_time_vars["VERSION"][2:]) # E.g., 8, 10 KEYS = [ "ABIFLAGS", "EXT_SUFFIX",