@@ -104,6 +104,10 @@ def _create_whl_repos(
104104 # containers to aggregate outputs from this function
105105 whl_map = {}
106106 exposed_packages = {}
107+ extra_aliases = {
108+ whl_name : {alias : True for alias in aliases }
109+ for whl_name , aliases in pip_attr .extra_hub_aliases .items ()
110+ }
107111 whl_libraries = {}
108112
109113 # if we do not have the python_interpreter set in the attributes
@@ -136,7 +140,7 @@ def _create_whl_repos(
136140 whl_modifications = {}
137141 if pip_attr .whl_modifications != None :
138142 for mod , whl_name in pip_attr .whl_modifications .items ():
139- whl_modifications [whl_name ] = mod
143+ whl_modifications [normalize_name ( whl_name ) ] = mod
140144
141145 if pip_attr .experimental_requirement_cycles :
142146 requirement_cycles = {
@@ -214,10 +218,6 @@ def _create_whl_repos(
214218
215219 repository_platform = host_platform (module_ctx )
216220 for whl_name , requirements in requirements_by_platform .items ():
217- # We are not using the "sanitized name" because the user
218- # would need to guess what name we modified the whl name
219- # to.
220- annotation = whl_modifications .get (whl_name )
221221 whl_name = normalize_name (whl_name )
222222
223223 group_name = whl_group_mapping .get (whl_name )
@@ -231,7 +231,7 @@ def _create_whl_repos(
231231 )
232232 maybe_args = dict (
233233 # The following values are safe to omit if they have false like values
234- annotation = annotation ,
234+ annotation = whl_modifications . get ( whl_name ) ,
235235 download_only = pip_attr .download_only ,
236236 enable_implicit_namespace_pkgs = pip_attr .enable_implicit_namespace_pkgs ,
237237 environment = pip_attr .environment ,
@@ -353,6 +353,7 @@ def _create_whl_repos(
353353 is_reproducible = is_reproducible ,
354354 whl_map = whl_map ,
355355 exposed_packages = exposed_packages ,
356+ extra_aliases = extra_aliases ,
356357 whl_libraries = whl_libraries ,
357358 )
358359
@@ -437,6 +438,7 @@ You cannot use both the additive_build_content and additive_build_content_file a
437438 hub_whl_map = {}
438439 hub_group_map = {}
439440 exposed_packages = {}
441+ extra_aliases = {}
440442 whl_libraries = {}
441443
442444 is_reproducible = True
@@ -486,6 +488,9 @@ You cannot use both the additive_build_content and additive_build_content_file a
486488 hub_whl_map .setdefault (hub_name , {})
487489 for key , settings in out .whl_map .items ():
488490 hub_whl_map [hub_name ].setdefault (key , []).extend (settings )
491+ extra_aliases .setdefault (hub_name , {})
492+ for whl_name , aliases in out .extra_aliases .items ():
493+ extra_aliases [hub_name ].setdefault (whl_name , {}).update (aliases )
489494 exposed_packages .setdefault (hub_name , {}).update (out .exposed_packages )
490495 whl_libraries .update (out .whl_libraries )
491496 is_reproducible = is_reproducible and out .is_reproducible
@@ -514,6 +519,13 @@ You cannot use both the additive_build_content and additive_build_content_file a
514519 for hub_name , group_map in sorted (hub_group_map .items ())
515520 },
516521 exposed_packages = {k : sorted (v ) for k , v in sorted (exposed_packages .items ())},
522+ extra_aliases = {
523+ hub_name : {
524+ whl_name : sorted (aliases )
525+ for whl_name , aliases in extra_whl_aliases .items ()
526+ }
527+ for hub_name , extra_whl_aliases in extra_aliases .items ()
528+ },
517529 whl_libraries = dict (sorted (whl_libraries .items ())),
518530 is_reproducible = is_reproducible ,
519531 )
@@ -598,6 +610,7 @@ def _pip_impl(module_ctx):
598610 hub_repository (
599611 name = hub_name ,
600612 repo_name = hub_name ,
613+ extra_hub_aliases = mods .extra_aliases .get (hub_name , {}),
601614 whl_map = {
602615 key : json .encode (value )
603616 for key , value in whl_map .items ()
@@ -684,6 +697,16 @@ The indexes must support Simple API as described here:
684697https://packaging.python.org/en/latest/specifications/simple-repository-api/
685698""" ,
686699 ),
700+ "extra_hub_aliases" : attr .string_list_dict (
701+ doc = """\
702+ Extra aliases to make for specific wheels in the hub repo. This is useful when
703+ paired with the {attr}`whl_modifications`.
704+
705+ :::{versionadded} 0.38.0
706+ :::
707+ """ ,
708+ mandatory = False ,
709+ ),
687710 "hub_name" : attr .string (
688711 mandatory = True ,
689712 doc = """
0 commit comments