From 35ee55fc0f5c5225d0017d8126bf168aeb96462c Mon Sep 17 00:00:00 2001 From: matsjoyce Date: Wed, 5 Jun 2024 09:36:07 +0100 Subject: [PATCH] Canonicalize base executable path when finding interpreter --- setuptools_rust/build.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/setuptools_rust/build.py b/setuptools_rust/build.py index a1611679..7b17519c 100644 --- a/setuptools_rust/build.py +++ b/setuptools_rust/build.py @@ -610,8 +610,10 @@ def _replace_vendor_with_unknown(target: str) -> Optional[str]: def _prepare_build_environment() -> Dict[str, str]: """Prepares environment variables to use when executing cargo build.""" - executable = getattr(sys, "_base_executable", sys.executable) - if not os.path.exists(executable): + base_executable = getattr(sys, "_base_executable") + if base_executable and os.path.exists(base_executable): + executable = os.path.realpath(base_executable) + else: executable = sys.executable # Make sure that if pythonXX-sys is used, it builds against the current