@@ -107,6 +107,7 @@ class Pep517HookCaller(object):
107107 pyproject.toml.
108108 backend_path : The backend path, as per PEP 517, from pyproject.toml.
109109 runner : A callable that invokes the wrapper subprocess.
110+ python_executable : The Python executable used to invoke the backend
110111
111112 The 'runner', if provided, must expect the following:
112113 cmd : a list of strings representing the command and arguments to
@@ -122,6 +123,7 @@ def __init__(
122123 build_backend ,
123124 backend_path = None ,
124125 runner = None ,
126+ python_executable = None ,
125127 ):
126128 if runner is None :
127129 runner = default_subprocess_runner
@@ -134,6 +136,9 @@ def __init__(
134136 ]
135137 self .backend_path = backend_path
136138 self ._subprocess_runner = runner
139+ if not python_executable :
140+ python_executable = sys .executable
141+ self .python_executable = python_executable
137142
138143 @contextmanager
139144 def subprocess_runner (self , runner ):
@@ -253,7 +258,7 @@ def _call_hook(self, hook_name, kwargs):
253258 # Run the hook in a subprocess
254259 with _in_proc_script_path () as script :
255260 self ._subprocess_runner (
256- [sys . executable , str (script ), hook_name , td ],
261+ [self . python_executable , str (script ), hook_name , td ],
257262 cwd = self .source_dir ,
258263 extra_environ = extra_environ
259264 )
0 commit comments