Skip to content

Commit 7f7f635

Browse files
committed
refactor: move extra aliases to the hub builder
1 parent f902694 commit 7f7f635

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

python/private/pypi/extension.bzl

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,6 @@ def _create_whl_repos(
207207

208208
return struct(
209209
exposed_packages = exposed_packages,
210-
extra_aliases = {
211-
whl_name: {alias: True for alias in aliases}
212-
for whl_name, aliases in pip_attr.extra_hub_aliases.items()
213-
},
214210
)
215211

216212
def _whl_repo(
@@ -524,10 +520,6 @@ You cannot use both the additive_build_content and additive_build_content_file a
524520
minor_mapping = kwargs.get("minor_mapping", MINOR_MAPPING),
525521
)
526522

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)
530-
531523
if hub_name not in exposed_packages:
532524
exposed_packages[hub_name] = out.exposed_packages
533525
else:
@@ -553,6 +545,7 @@ You cannot use both the additive_build_content and additive_build_content_file a
553545
whl_libraries[whl_name] = lib
554546

555547
hub_group_map[hub.name] = hub.group_map
548+
extra_aliases[hub.name] = hub.extra_aliases
556549

557550
return struct(
558551
# We sort so that the lock-file remains the same no matter the order of how the

python/private/pypi/hub_builder.bzl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ def _add(self, *, pip_attr):
101101
self.group_map.clear()
102102
self.group_map.update(pip_attr.experimental_requirement_cycles)
103103

104+
for whl_name, aliases in pip_attr.extra_hub_aliases.items():
105+
self.extra_aliases.setdefault(whl_name, {}).update(
106+
{alias: True for alias in aliases},
107+
)
108+
104109
def _set_index_urls(self, pip_attr):
105110
if not pip_attr.experimental_index_url:
106111
if pip_attr.experimental_extra_index_urls:

0 commit comments

Comments
 (0)