From 060d8b4b4ad5f3a5173466a2f47ea74eda70f6e7 Mon Sep 17 00:00:00 2001 From: Markus Gerstel Date: Sat, 14 Nov 2020 17:42:27 +0000 Subject: [PATCH 1/2] Use target CARGO_BUILD_TARGET if specified rust will pick up the environment variable anyway, but if we don't pick up on it, too, then we won't find the build artifacts. --- setuptools_rust/build.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/setuptools_rust/build.py b/setuptools_rust/build.py index 907fb609..e4528232 100644 --- a/setuptools_rust/build.py +++ b/setuptools_rust/build.py @@ -92,10 +92,14 @@ def build_extension(self, ext): # If we are on a 64-bit machine, but running a 32-bit Python, then # we'll target a 32-bit Rust build. + # Automatic target detection can be overridden via the CARGO_BUILD_TARGET + # environment variable. # TODO: include --target for all platforms so env vars can't break the build target_triple = None target_args = [] - if self.plat_name == "win32": + if os.getenv("CARGO_BUILD_TARGET"): + target_triple = os.environ["CARGO_BUILD_TARGET"] + elif self.plat_name == "win32": target_triple = "i686-pc-windows-msvc" elif self.plat_name == "win-amd64": target_triple = "x86_64-pc-windows-msvc" From 3cd83ecad88b16d2c574ce57380b290623aff18c Mon Sep 17 00:00:00 2001 From: David Hewitt <1939362+davidhewitt@users.noreply.github.com> Date: Sun, 15 Nov 2020 19:23:22 +0000 Subject: [PATCH 2/2] Add changelog entry for #90 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 04fb8611..e8268c73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Unreleased + + - Respect `CARGO_BUILD_TARGET` environment variable if set. [#90](https://github.com/PyO3/setuptools-rust/pull/90) + ## 0.11.5 (2020-11-10) - Fix support for Python 3.5. [#86](https://github.com/PyO3/setuptools-rust/pull/86)