Skip to content

Commit 2128d54

Browse files
committed
return direct url in parse_requirements
1 parent 8a3480d commit 2128d54

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

python/private/pypi/parse_requirements.bzl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,18 @@ def _add_dists(*, requirement, index_urls, logger = None):
292292
index_urls: The result of simpleapi_download.
293293
logger: A logger for printing diagnostic info.
294294
"""
295+
# Handle direct URLs in requirements
296+
if hasattr(requirement.srcs, "url"):
297+
# Create a struct that matches the expected format for direct URLs
298+
direct_url_dist = struct(
299+
url = requirement.srcs.url,
300+
filename = requirement.srcs.filename,
301+
# TODO: if more than one hash is present, we should use all of them
302+
sha256 = requirement.srcs.shas[0] if requirement.srcs.shas else "", # Use hash if provided
303+
yanked = False,
304+
)
305+
return [direct_url_dist], None
306+
295307
if not index_urls:
296308
return [], None
297309

0 commit comments

Comments
 (0)