@@ -121,29 +121,42 @@ def build_wheels(pip):
121
121
available_scripts = {s .lower (): s for s in os .listdir (scriptdir )}
122
122
else :
123
123
available_scripts = {}
124
- for spec in packages_to_build :
125
- name , version = spec .split ("==" )
126
- whl_count = len (glob ("*.whl" ))
127
- script = f"{ name } .{ version } .{ script_ext } " .lower ()
128
- if script not in available_scripts :
129
- script = f"{ name } .{ script_ext } " .lower ()
130
- if script in available_scripts :
131
- script = join (scriptdir , available_scripts [script ])
132
- env = os .environ .copy ()
133
- env ["PATH" ] = abspath (dirname (pip )) + os .pathsep + env ["PATH" ]
134
- env ["VIRTUAL_ENV" ] = abspath (dirname (dirname (pip )))
135
- print ("Building" , name , version , "with" , script , flush = True )
136
- if sys .platform == "win32" :
137
- cmd = [script , version ] # Python's subprocess.py does the quoting we need
138
- else :
139
- cmd = f"{ os .environ .get ('SHELL' , '/bin/sh' )} { shlex .quote (script )} { version } "
140
- subprocess .check_call (cmd , shell = True , env = env )
141
- if not len (glob ("*.whl" )) > whl_count :
142
- print ("Building wheel for" , name , version , "after" , script , "did not" , flush = True )
143
- subprocess .check_call ([pip , "wheel" , spec ])
144
- else :
124
+ remaining_packages = 0
125
+ while remaining_packages != len (packages_to_build ):
126
+ remaining_packages = len (packages_to_build )
127
+ for spec in packages_to_build .copy ():
128
+ name , version = spec .split ("==" )
129
+ whl_count = len (glob ("*.whl" ))
130
+ script = f"{ name } .{ version } .{ script_ext } " .lower ()
131
+ if script not in available_scripts :
132
+ script = f"{ name } .{ script_ext } " .lower ()
133
+ if script in available_scripts :
134
+ script = join (scriptdir , available_scripts [script ])
135
+ env = os .environ .copy ()
136
+ env ["PATH" ] = abspath (dirname (pip )) + os .pathsep + env ["PATH" ]
137
+ env ["VIRTUAL_ENV" ] = abspath (dirname (dirname (pip )))
138
+ print ("Building" , name , version , "with" , script , flush = True )
139
+ if sys .platform == "win32" :
140
+ cmd = [script , version ] # Python's subprocess.py does the quoting we need
141
+ else :
142
+ cmd = f"{ os .environ .get ('SHELL' , '/bin/sh' )} { shlex .quote (script )} { version } "
143
+ p = subprocess .run (cmd , shell = True , env = env )
144
+ if p .returncode != 0 :
145
+ continue
146
+ if len (glob ("*.whl" )) > whl_count :
147
+ packages_to_build .remove (spec )
148
+ continue
149
+ print (script , "did not build a wheel, we will do so now" , flush = True )
145
150
print ("Building" , name , version , flush = True )
146
- subprocess .check_call ([pip , "wheel" , spec ])
151
+ p = subprocess .run ([pip , "wheel" , spec ])
152
+ if p .returncode == 0 :
153
+ packages_to_build .remove (spec )
154
+ if packages_to_build :
155
+ print ("Failed to build all packages, the following packages failed" )
156
+ print (packages_to_build )
157
+ return False
158
+ else :
159
+ return True
147
160
148
161
149
162
def repair_wheels ():
@@ -188,5 +201,7 @@ def repair_wheels():
188
201
download (args .graalpy_url , outpath )
189
202
extract (outpath )
190
203
pip = create_venv ()
191
- build_wheels (pip )
204
+ success = build_wheels (pip )
192
205
repair_wheels ()
206
+ if not success :
207
+ sys .exit (1 )
0 commit comments