1616
1717load ("@bazel_features//:features.bzl" , "bazel_features" )
1818load ("@pythons_hub//:interpreters.bzl" , "INTERPRETER_LABELS" )
19- load ("//python/private:auth.bzl" , "AUTH_ATTRS" )
2019load ("//python/private:normalize_name.bzl" , "normalize_name" )
2120load ("//python/private:repo_utils.bzl" , "repo_utils" )
2221load ("//python/private:semver.bzl" , "semver" )
@@ -86,7 +85,14 @@ You cannot use both the additive_build_content and additive_build_content_file a
8685 whl_mods = whl_mods ,
8786 )
8887
89- def _create_whl_repos (module_ctx , pip_attr , whl_map , whl_overrides , group_map , simpleapi_cache , exposed_packages ):
88+ def _create_whl_repos (
89+ module_ctx ,
90+ pip_attr ,
91+ whl_map ,
92+ whl_overrides ,
93+ group_map ,
94+ simpleapi_cache ,
95+ exposed_packages ):
9096 logger = repo_utils .logger (module_ctx , "pypi:create_whl_repos" )
9197 python_interpreter_target = pip_attr .python_interpreter_target
9298 is_hub_reproducible = True
@@ -151,9 +157,6 @@ def _create_whl_repos(module_ctx, pip_attr, whl_map, whl_overrides, group_map, s
151157
152158 get_index_urls = None
153159 if getattr (pip_attr , "index_url" , None ):
154- if pip_attr .download_only :
155- fail ("Currently unsupported to use `download_only` and `index_url`" )
156-
157160 get_index_urls = lambda ctx , distributions : simpleapi_download (
158161 ctx ,
159162 attr = struct (
@@ -229,7 +232,7 @@ def _create_whl_repos(module_ctx, pip_attr, whl_map, whl_overrides, group_map, s
229232 maybe_args = dict (
230233 # The following values are safe to omit if they have false like values
231234 annotation = annotation ,
232- download_only = pip_attr . download_only ,
235+ download_only = getattr ( pip_attr , " download_only" , None ) ,
233236 enable_implicit_namespace_pkgs = pip_attr .enable_implicit_namespace_pkgs ,
234237 environment = pip_attr .environment ,
235238 envsubst = pip_attr .envsubst ,
@@ -284,9 +287,6 @@ def _create_whl_repos(module_ctx, pip_attr, whl_map, whl_overrides, group_map, s
284287 # need to pass the extra args there.
285288 pass
286289
287- # This is no-op because pip is not used to download the wheel.
288- whl_library_args .pop ("download_only" , None )
289-
290290 repo_name = whl_repo_name (pip_name , distribution .filename , distribution .sha256 )
291291 whl_library_args ["requirement" ] = requirement .srcs .requirement
292292 whl_library_args ["urls" ] = [distribution .url ]
@@ -318,7 +318,7 @@ def _create_whl_repos(module_ctx, pip_attr, whl_map, whl_overrides, group_map, s
318318
319319 requirement = select_requirement (
320320 requirements ,
321- platform = None if pip_attr . download_only else repository_platform ,
321+ platform = None if getattr ( pip_attr , " download_only" , None ) else repository_platform ,
322322 )
323323 if not requirement :
324324 # Sometimes the package is not present for host platform if there
@@ -553,23 +553,6 @@ hubs can be created, and each program can use its respective hub's targets.
553553Targets from different hubs should not be used together.
554554""" ,
555555 ),
556- "parallel_download" : attr .bool (
557- doc = """\
558- The flag allows to make use of parallel downloading feature in bazel 7.1 and above
559- when the bazel downloader is used. This is by default enabled as it improves the
560- performance by a lot, but in case the queries to the simple API are very expensive
561- or when debugging authentication issues one may want to disable this feature.
562-
563- NOTE, This will download (potentially duplicate) data for multiple packages if
564- there is more than one index available, but in general this should be negligible
565- because the simple API calls are very cheap and the user should not notice any
566- extra overhead.
567-
568- If we are in synchronous mode, then we will use the first result that we
569- find in case extra indexes are specified.
570- """ ,
571- default = True ,
572- ),
573556 "python_version" : attr .string (
574557 mandatory = True ,
575558 doc = """
@@ -596,7 +579,6 @@ code will be re-evaluated when any of files in the default changes.
596579""" ,
597580 ),
598581 }, ** ATTRS )
599- attrs .update (AUTH_ATTRS )
600582
601583 return attrs
602584
0 commit comments