@@ -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 ,
@@ -389,6 +389,7 @@ def _create_whl_repos(
389389 is_reproducible = is_reproducible ,
390390 whl_map = whl_map ,
391391 exposed_packages = exposed_packages ,
392+ extra_aliases = extra_aliases ,
392393 whl_libraries = whl_libraries ,
393394 )
394395
@@ -473,6 +474,7 @@ You cannot use both the additive_build_content and additive_build_content_file a
473474 hub_whl_map = {}
474475 hub_group_map = {}
475476 exposed_packages = {}
477+ extra_aliases = {}
476478 whl_libraries = {}
477479
478480 is_reproducible = True
@@ -522,6 +524,9 @@ You cannot use both the additive_build_content and additive_build_content_file a
522524 hub_whl_map .setdefault (hub_name , {})
523525 for key , settings in out .whl_map .items ():
524526 hub_whl_map [hub_name ].setdefault (key , []).extend (settings )
527+ extra_aliases .setdefault (hub_name , {})
528+ for whl_name , aliases in out .extra_aliases .items ():
529+ extra_aliases [hub_name ].setdefault (whl_name , {}).update (aliases )
525530 exposed_packages .setdefault (hub_name , {}).update (out .exposed_packages )
526531 whl_libraries .update (out .whl_libraries )
527532 is_reproducible = is_reproducible and out .is_reproducible
@@ -554,6 +559,13 @@ You cannot use both the additive_build_content and additive_build_content_file a
554559 k : sorted (v )
555560 for k , v in sorted (exposed_packages .items ())
556561 },
562+ extra_aliases = {
563+ hub_name : {
564+ whl_name : sorted (aliases )
565+ for whl_name , aliases in extra_whl_aliases .items ()
566+ }
567+ for hub_name , extra_whl_aliases in extra_aliases .items ()
568+ },
557569 whl_libraries = {
558570 k : dict (sorted (args .items ()))
559571 for k , args in sorted (whl_libraries .items ())
@@ -639,6 +651,7 @@ def _pip_impl(module_ctx):
639651 hub_repository (
640652 name = hub_name ,
641653 repo_name = hub_name ,
654+ extra_hub_aliases = mods .extra_aliases .get (hub_name , {}),
642655 whl_map = {
643656 key : json .encode (value )
644657 for key , value in whl_map .items ()
@@ -725,6 +738,16 @@ The indexes must support Simple API as described here:
725738https://packaging.python.org/en/latest/specifications/simple-repository-api/
726739""" ,
727740 ),
741+ "extra_hub_aliases" : attr .string_list_dict (
742+ doc = """\
743+ Extra aliases to make for specific wheels in the hub repo. This is useful when
744+ paired with the {attr}`whl_modifications`.
745+
746+ :::{versionadded} 0.38.0
747+ :::
748+ """ ,
749+ mandatory = False ,
750+ ),
728751 "hub_name" : attr .string (
729752 mandatory = True ,
730753 doc = """
0 commit comments