@@ -262,66 +262,64 @@ def _create_whl_repos(
262262 })
263263
264264 is_exposed = False
265- if get_index_urls :
266- # TODO @aignas 2024-05-26: move to a separate function
267- found_something = False
268- for requirement in requirements :
269- is_exposed = is_exposed or requirement .is_exposed
270- dists = requirement .whls
271- if not pip_attr .download_only and requirement .sdist :
272- dists = dists + [requirement .sdist ]
273-
274- for distribution in dists :
275- found_something = True
276- is_reproducible = False
277-
278- args = dict (whl_library_args )
279- if pip_attr .netrc :
280- args ["netrc" ] = pip_attr .netrc
281- if pip_attr .auth_patterns :
282- args ["auth_patterns" ] = pip_attr .auth_patterns
283-
284- if not distribution .filename .endswith (".whl" ):
285- # pip is not used to download wheels and the python
286- # `whl_library` helpers are only extracting things, however
287- # for sdists, they will be built by `pip`, so we still
288- # need to pass the extra args there.
289- args ["extra_pip_args" ] = requirement .extra_pip_args
290-
291- # This is no-op because pip is not used to download the wheel.
292- args .pop ("download_only" , None )
293-
294- repo_name = whl_repo_name (pip_name , distribution .filename , distribution .sha256 )
295- args ["requirement" ] = requirement .srcs .requirement
296- args ["urls" ] = [distribution .url ]
297- args ["sha256" ] = distribution .sha256
298- args ["filename" ] = distribution .filename
299- args ["experimental_target_platforms" ] = requirement .target_platforms
300-
301- # Pure python wheels or sdists may need to have a platform here
302- target_platforms = None
303- if distribution .filename .endswith ("-any.whl" ) or not distribution .filename .endswith (".whl" ):
304- if len (requirements ) > 1 :
305- target_platforms = requirement .target_platforms
306-
307- whl_libraries [repo_name ] = args
308-
309- whl_map .setdefault (whl_name , {})[whl_config_setting (
310- version = major_minor ,
311- filename = distribution .filename ,
312- target_platforms = target_platforms ,
313- )] = repo_name
314-
315- if found_something :
316- if is_exposed :
317- exposed_packages [whl_name ] = None
318- continue
265+
266+ # TODO @aignas 2024-05-26: move to a separate function
267+ found_something = False
268+ for requirement in requirements :
269+ is_exposed = is_exposed or requirement .is_exposed
270+ dists = requirement .whls
271+ if not pip_attr .download_only and requirement .sdist :
272+ dists = dists + [requirement .sdist ]
273+
274+ for distribution in dists :
275+ found_something = True
276+ is_reproducible = False
277+
278+ args = dict (whl_library_args )
279+ if pip_attr .netrc :
280+ args ["netrc" ] = pip_attr .netrc
281+ if pip_attr .auth_patterns :
282+ args ["auth_patterns" ] = pip_attr .auth_patterns
283+
284+ if not distribution .filename .endswith (".whl" ):
285+ # pip is not used to download wheels and the python
286+ # `whl_library` helpers are only extracting things, however
287+ # for sdists, they will be built by `pip`, so we still
288+ # need to pass the extra args there.
289+ args ["extra_pip_args" ] = requirement .extra_pip_args
290+
291+ # This is no-op because pip is not used to download the wheel.
292+ args .pop ("download_only" , None )
293+
294+ repo_name = whl_repo_name (pip_name , distribution .filename , distribution .sha256 )
295+ args ["requirement" ] = requirement .srcs .requirement
296+ args ["urls" ] = [distribution .url ]
297+ args ["sha256" ] = distribution .sha256
298+ args ["filename" ] = distribution .filename
299+ args ["experimental_target_platforms" ] = requirement .target_platforms
300+
301+ # Pure python wheels or sdists may need to have a platform here
302+ target_platforms = None
303+ if distribution .filename .endswith ("-any.whl" ) or not distribution .filename .endswith (".whl" ):
304+ if len (requirements ) > 1 :
305+ target_platforms = requirement .target_platforms
306+
307+ whl_libraries [repo_name ] = args
308+
309+ whl_map .setdefault (whl_name , {})[whl_config_setting (
310+ version = major_minor ,
311+ filename = distribution .filename ,
312+ target_platforms = target_platforms ,
313+ )] = repo_name
314+
315+ if found_something :
316+ if is_exposed :
317+ exposed_packages [whl_name ] = None
318+ continue
319319
320320 is_exposed = False
321321 for requirement in requirements :
322322 is_exposed = is_exposed or requirement .is_exposed
323- if get_index_urls :
324- logger .warn (lambda : "falling back to pip for installing the right file for {}" .format (requirement .srcs .requirement_line ))
325323
326324 args = dict (whl_library_args ) # make a copy
327325 args ["requirement" ] = requirement .srcs .requirement_line
0 commit comments