6666from urllib .request import urlretrieve
6767
6868
69- def ensure_installed (name ):
69+ def ensure_installed (name , * extra ):
7070 try :
7171 return importlib .import_module (name )
7272 except ImportError :
73- subprocess .check_call ([sys .executable , "-m" , "pip" , "install" , name ])
73+ subprocess .check_call ([sys .executable , "-m" , "pip" , "install" , name , * extra ])
7474 return importlib .import_module (name )
7575
7676
@@ -170,11 +170,12 @@ def build_wheels(pip):
170170
171171def repair_wheels ():
172172 whls = glob ("*graalpy*.whl" )
173+ env = os .environ .copy ()
174+ env ["PYTHONUTF8" ] = "1"
175+ env ["PATH" ] = abspath (dirname (sys .executable )) + os .pathsep + env ["PATH" ]
173176 for whl in whls :
174177 if sys .platform == "win32" :
175178 ensure_installed ("delvewheel" )
176- env = os .environ .copy ()
177- env ["PYTHONUTF8" ] = "1"
178179 p = subprocess .run (
179180 [
180181 sys .executable ,
@@ -191,7 +192,7 @@ def repair_wheels():
191192 env = env ,
192193 )
193194 elif sys .platform == "linux" :
194- ensure_installed ("auditwheel" )
195+ ensure_installed ("auditwheel" , "patchelf" )
195196 p = subprocess .run (
196197 [
197198 join (dirname (sys .executable ), "auditwheel" ),
@@ -201,7 +202,8 @@ def repair_wheels():
201202 "-w" ,
202203 "wheelhouse" ,
203204 whl
204- ]
205+ ],
206+ env = env ,
205207 )
206208 elif sys .platform == "darwin" :
207209 ensure_installed ("delocate" )
@@ -215,7 +217,8 @@ def repair_wheels():
215217 "-w" ,
216218 "wheelhouse" ,
217219 whl
218- ]
220+ ],
221+ env = env ,
219222 )
220223 if p .returncode != 0 :
221224 print ("Repairing" , whl , "failed, copying as is." )
0 commit comments