# HG changeset patch # User Pierre-Yves David # Date 1731510808 -3600 # Node ID 124c944b71b293057649cb1983ee4a9e0d8eeb37 # Parent d57d1606049c4acf46aff2639c3f2d4031dfd3a8 setup: make sure Rust build its extension for the right python Strictly speaking, only "PYTHON_SYS_EXECUTABLE" seems to be necessary, but I don't want to take a chances, as in testing "PYTHON" also had an effect. diff -r d57d1606049c -r 124c944b71b2 setup.py --- 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")