66
66
from urllib .request import urlretrieve
67
67
68
68
69
- def ensure_installed (name ):
69
+ def ensure_installed (name , * extra ):
70
70
try :
71
71
return importlib .import_module (name )
72
72
except ImportError :
73
- subprocess .check_call ([sys .executable , "-m" , "pip" , "install" , name ])
73
+ subprocess .check_call ([sys .executable , "-m" , "pip" , "install" , name , * extra ])
74
74
return importlib .import_module (name )
75
75
76
76
@@ -170,11 +170,12 @@ def build_wheels(pip):
170
170
171
171
def repair_wheels ():
172
172
whls = glob ("*graalpy*.whl" )
173
+ env = os .environ .copy ()
174
+ env ["PYTHONUTF8" ] = "1"
175
+ env ["PATH" ] = abspath (dirname (sys .executable )) + os .pathsep + env ["PATH" ]
173
176
for whl in whls :
174
177
if sys .platform == "win32" :
175
178
ensure_installed ("delvewheel" )
176
- env = os .environ .copy ()
177
- env ["PYTHONUTF8" ] = "1"
178
179
p = subprocess .run (
179
180
[
180
181
sys .executable ,
@@ -191,7 +192,7 @@ def repair_wheels():
191
192
env = env ,
192
193
)
193
194
elif sys .platform == "linux" :
194
- ensure_installed ("auditwheel" )
195
+ ensure_installed ("auditwheel" , "patchelf" )
195
196
p = subprocess .run (
196
197
[
197
198
join (dirname (sys .executable ), "auditwheel" ),
@@ -201,7 +202,8 @@ def repair_wheels():
201
202
"-w" ,
202
203
"wheelhouse" ,
203
204
whl
204
- ]
205
+ ],
206
+ env = env ,
205
207
)
206
208
elif sys .platform == "darwin" :
207
209
ensure_installed ("delocate" )
@@ -215,7 +217,8 @@ def repair_wheels():
215
217
"-w" ,
216
218
"wheelhouse" ,
217
219
whl
218
- ]
220
+ ],
221
+ env = env ,
219
222
)
220
223
if p .returncode != 0 :
221
224
print ("Repairing" , whl , "failed, copying as is." )
0 commit comments