@@ -19,7 +19,7 @@ load("//python/private:envsubst.bzl", "envsubst")
1919load ("//python/private:is_standalone_interpreter.bzl" , "is_standalone_interpreter" )
2020load ("//python/private:repo_utils.bzl" , "REPO_DEBUG_ENV_VAR" , "repo_utils" )
2121load (":attrs.bzl" , "ATTRS" , "use_isolated" )
22- load (":deps.bzl" , "all_repo_names" )
22+ load (":deps.bzl" , "all_repo_names" , "record_files" )
2323load (":generate_whl_library_build_bazel.bzl" , "generate_whl_library_build_bazel" )
2424load (":parse_whl_name.bzl" , "parse_whl_name" )
2525load (":patch_whl.bzl" , "patch_whl" )
@@ -242,14 +242,15 @@ def _whl_library_impl(rctx):
242242 else :
243243 op_tmpl = "whl_library.ResolveRequirement({name}, {requirement})"
244244
245- repo_utils .execute_checked (
245+ pypi_repo_utils .execute_checked (
246246 rctx ,
247247 # truncate the requirement value when logging it / reporting
248248 # progress since it may contain several ' --hash=sha256:...
249249 # --hash=sha256:...' substrings that fill up the console
250250 op = op_tmpl .format (name = rctx .attr .name , requirement = rctx .attr .requirement .split (" " , 1 )[0 ]),
251251 arguments = args ,
252252 environment = environment ,
253+ srcs = rctx .attr ._python_srcs ,
253254 quiet = rctx .attr .quiet ,
254255 timeout = rctx .attr .timeout ,
255256 logger = logger ,
@@ -291,13 +292,14 @@ def _whl_library_impl(rctx):
291292 )
292293 ]
293294
294- repo_utils .execute_checked (
295+ pypi_repo_utils .execute_checked (
295296 rctx ,
296297 op = "whl_library.ExtractWheel({}, {})" .format (rctx .attr .name , whl_path ),
297298 arguments = args + [
298299 "--whl-file" ,
299300 whl_path ,
300301 ] + ["--platform={}" .format (p ) for p in target_platforms ],
302+ srcs = rctx .attr ._python_srcs ,
301303 environment = environment ,
302304 quiet = rctx .attr .quiet ,
303305 timeout = rctx .attr .timeout ,
@@ -450,6 +452,16 @@ attr makes `extra_pip_args` and `download_only` ignored.""",
450452 for repo in all_repo_names
451453 ],
452454 ),
455+ "_python_srcs" : attr .label_list (
456+ # Used as a default value in a rule to ensure we fetch the dependencies.
457+ default = [
458+ Label ("//python/private/pypi/whl_installer:platform.py" ),
459+ Label ("//python/private/pypi/whl_installer:wheel.py" ),
460+ Label ("//python/private/pypi/whl_installer:wheel_installer.py" ),
461+ Label ("//python/private/pypi/whl_installer:arguments.py" ),
462+ Label ("//python/private/pypi/whl_installer:namespace_pkgs.py" ),
463+ ] + record_files .values (),
464+ ),
453465 "_rule_name" : attr .string (default = "whl_library" ),
454466}, ** ATTRS )
455467whl_library_attrs .update (AUTH_ATTRS )
0 commit comments