@@ -116,6 +116,7 @@ class Pep517HookCaller(object):
116116 pyproject.toml.
117117 backend_path : The backend path, as per PEP 517, from pyproject.toml.
118118 runner : A callable that invokes the wrapper subprocess.
119+ python_executable : The Python executable used to invoke the backend
119120
120121 The 'runner', if provided, must expect the following:
121122 cmd : a list of strings representing the command and arguments to
@@ -131,6 +132,7 @@ def __init__(
131132 build_backend ,
132133 backend_path = None ,
133134 runner = None ,
135+ python_executable = None ,
134136 ):
135137 if runner is None :
136138 runner = default_subprocess_runner
@@ -143,6 +145,9 @@ def __init__(
143145 ]
144146 self .backend_path = backend_path
145147 self ._subprocess_runner = runner
148+ if not python_executable :
149+ python_executable = sys .executable
150+ self .python_executable = python_executable
146151
147152 @contextmanager
148153 def subprocess_runner (self , runner ):
@@ -262,7 +267,7 @@ def _call_hook(self, hook_name, kwargs):
262267 # Run the hook in a subprocess
263268 with _in_proc_script_path () as script :
264269 self ._subprocess_runner (
265- [sys . executable , str (script ), hook_name , td ],
270+ [self . python_executable , str (script ), hook_name , td ],
266271 cwd = self .source_dir ,
267272 extra_environ = extra_environ
268273 )
0 commit comments