From 0b5f1991fa7ae32c87e13408aa393a5457f68ccf Mon Sep 17 00:00:00 2001 From: David Hewitt <1939362+davidhewitt@users.noreply.github.com> Date: Thu, 6 Aug 2020 11:50:09 +0100 Subject: [PATCH] Add support for PYO3_PYTHON variable --- CHANGELOG.md | 7 ++++--- README.md | 2 -- build-wheels.sh | 4 ---- html-py-ever/build-wheels.sh | 2 -- setup.cfg | 2 +- setuptools_rust/build.py | 4 +++- 6 files changed, 8 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b824bfa..8da918fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,14 @@ # Changelog -## 0.11 +## Unreleased - - Removed python 2 support + - Remove python 2 support. + - Add support for pyo3 `0.12`'s `PYO3_PYTHON` setting. ## 0.10.6 (2018-11-07) - Fix tomlgen\_rust generating invalid `Cargo.toml` files. - - Fix tomlgen\_rust setting wrong path in `.cargo/config` + - Fix tomlgen\_rust setting wrong path in `.cargo/config`. ## 0.10.5 (2018-09-09) diff --git a/README.md b/README.md index a753967f..e7424019 100644 --- a/README.md +++ b/README.md @@ -62,8 +62,6 @@ export PATH="$HOME/.cargo/bin:$PATH" cd /io for PYBIN in /opt/python/cp{35,36,37,38,39}*/bin; do - export PYTHON_SYS_EXECUTABLE="$PYBIN/python" - "${PYBIN}/pip" install -U setuptools wheel setuptools-rust "${PYBIN}/python" setup.py bdist_wheel done diff --git a/build-wheels.sh b/build-wheels.sh index 648a7eba..52c54ba6 100755 --- a/build-wheels.sh +++ b/build-wheels.sh @@ -9,10 +9,6 @@ export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$HOME/rust/lib" # Compile wheels for PYBIN in /opt/python/cp{35,36,37,38,39}*/bin; do - export PYTHON_SYS_EXECUTABLE="$PYBIN/python" - export PYTHON_LIB=$(${PYBIN}/python -c "import sysconfig; print(sysconfig.get_config_var('LIBDIR'))") - export LIBRARY_PATH="$LIBRARY_PATH:$PYTHON_LIB" - export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PYTHON_LIB" rm -f /io/build/lib.* "${PYBIN}/pip" install -U setuptools setuptools-rust wheel "${PYBIN}/pip" wheel /io/ -w /io/dist/ diff --git a/html-py-ever/build-wheels.sh b/html-py-ever/build-wheels.sh index 3f122227..8bbca803 100755 --- a/html-py-ever/build-wheels.sh +++ b/html-py-ever/build-wheels.sh @@ -7,8 +7,6 @@ export PATH="$HOME/.cargo/bin:$PATH" cd /io for PYBIN in /opt/python/cp{35,36,37,38,39}*/bin; do - export PYTHON_SYS_EXECUTABLE="$PYBIN/python" - "${PYBIN}/pip" install -U setuptools wheel setuptools-rust "${PYBIN}/python" setup.py bdist_wheel done diff --git a/setup.cfg b/setup.cfg index eeb8ac48..8885f289 100644 --- a/setup.cfg +++ b/setup.cfg @@ -35,4 +35,4 @@ distutils.commands = test_rust=setuptools_rust:test_rust tomlgen_rust=setuptools_rust:tomlgen_rust distutils.setup_keywords = - rust_extensions=setuptools_rust.setuptools_ext:rust_extensions \ No newline at end of file + rust_extensions=setuptools_rust.setuptools_ext:rust_extensions diff --git a/setuptools_rust/build.py b/setuptools_rust/build.py index 46554d0d..3e2156b1 100644 --- a/setuptools_rust/build.py +++ b/setuptools_rust/build.py @@ -78,7 +78,9 @@ def build_extension(self, ext): # disables rust's pkg-config seeking for specified packages, # which causes pythonXX-sys to fall back to detecting the # interpreter from the path. - "PATH": os.path.join(bindir, os.environ.get("PATH", "")) + "PATH": os.path.join(bindir, os.environ.get("PATH", "")), + "PYTHON_SYS_EXECUTABLE": sys.executable, + "PYO3_PYTHON": sys.executable, } )