setup.py
branchstable
changeset 52242 124c944b71b2
parent 52236 2b7e3177f99c
child 52243 309f58964a9e
--- a/setup.py	Wed Nov 13 13:33:36 2024 +0100
+++ b/setup.py	Wed Nov 13 16:13:28 2024 +0100
@@ -1566,6 +1566,15 @@
 
             env['HOME'] = pwd.getpwuid(os.getuid()).pw_dir
 
+        # Wildy shooting in the dark to make sure rust-cpython use the right
+        # python
+        if not sys.executable:
+            msg = "Cannot determine which Python to compile Rust for"
+            raise RustCompilationError(msg)
+        env['PYTHON_SYS_EXECUTABLE'] = sys.executable
+        env['PYTHONEXECUTABLE'] = sys.executable
+        env['PYTHON'] = sys.executable
+
         cargocmd = ['cargo', 'rustc', '--release']
 
         rust_features = env.get("HG_RUST_FEATURES")