@@ -234,7 +234,7 @@ def _package_srcs(
234234 platforms .keys (),
235235 ))
236236
237- dist , can_fallback = _add_dists (
237+ dist = _add_dists (
238238 requirement = r ,
239239 target_platform = platforms .get (target_platform ),
240240 index_urls = index_urls .get (name ),
@@ -244,16 +244,14 @@ def _package_srcs(
244244
245245 if extract_url_srcs and dist :
246246 req_line = r .srcs .requirement
247- elif can_fallback :
247+ else :
248248 dist = struct (
249249 url = "" ,
250250 filename = "" ,
251251 sha256 = "" ,
252252 yanked = False ,
253253 )
254254 req_line = r .srcs .requirement_line
255- else :
256- continue
257255
258256 key = (
259257 dist .filename ,
@@ -339,22 +337,14 @@ def _add_dists(*, requirement, index_urls, target_platform, logger = None):
339337 index_urls: The result of simpleapi_download.
340338 target_platform: The target_platform information.
341339 logger: A logger for printing diagnostic info.
342-
343- Returns:
344- (dist, can_fallback_to_pip): a struct with distribution details and how to fetch
345- it and a boolean flag to tell the other layers if we should add an entry to
346- fallback for pip if there are no supported whls found - if there is an sdist, we
347- can attempt the fallback, otherwise better to not, because the pip command will
348- fail and the error message will be confusing. What is more that would lead to
349- breakage of the bazel query.
350340 """
351341
352342 if requirement .srcs .url :
353343 if not requirement .srcs .filename :
354344 logger .debug (lambda : "Could not detect the filename from the URL, falling back to pip: {}" .format (
355345 requirement .srcs .url ,
356346 ))
357- return None , True
347+ return None
358348
359349 # Handle direct URLs in requirements
360350 dist = struct (
@@ -365,12 +355,12 @@ def _add_dists(*, requirement, index_urls, target_platform, logger = None):
365355 )
366356
367357 if dist .filename .endswith (".whl" ):
368- return dist , False
358+ return dist
369359 else :
370- return dist , False
360+ return dist
371361
372362 if not index_urls :
373- return None , True
363+ return None
374364
375365 whls = []
376366 sdist = None
@@ -423,4 +413,4 @@ def _add_dists(*, requirement, index_urls, target_platform, logger = None):
423413 whl_abi_tags = target_platform .whl_abi_tags ,
424414 whl_platform_tags = target_platform .whl_platform_tags ,
425415 logger = logger ,
426- ) or sdist , sdist != None
416+ ) or sdist
0 commit comments