Skip to content

Commit 7ee62e7

Browse files
committed
refactor: store the whl_map on the builder itself
1 parent 863243b commit 7ee62e7

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

python/private/pypi/extension.bzl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ def _create_whl_repos(
102102
interpreter = hub.detect_interpreter(pip_attr)
103103

104104
# containers to aggregate outputs from this function
105-
whl_map = {}
106105
extra_aliases = {
107106
whl_name: {alias: True for alias in aliases}
108107
for whl_name, aliases in pip_attr.extra_hub_aliases.items()
@@ -290,7 +289,7 @@ def _create_whl_repos(
290289
}),
291290
}
292291

293-
mapping = whl_map.setdefault(whl.name, {})
292+
mapping = hub.whl_map.setdefault(whl.name, {})
294293
if repo.config_setting in mapping and mapping[repo.config_setting] != repo_name:
295294
fail(
296295
"attempting to override an existing repo '{}' for config setting '{}' with a new repo '{}'".format(
@@ -303,7 +302,6 @@ def _create_whl_repos(
303302
mapping[repo.config_setting] = repo_name
304303

305304
return struct(
306-
whl_map = whl_map,
307305
exposed_packages = exposed_packages,
308306
extra_aliases = extra_aliases,
309307
whl_libraries = whl_libraries,
@@ -620,10 +618,6 @@ You cannot use both the additive_build_content and additive_build_content_file a
620618
**kwargs
621619
)
622620

623-
hub_whl_map.setdefault(hub_name, {})
624-
for key, settings in out.whl_map.items():
625-
for setting, repo in settings.items():
626-
hub_whl_map[hub_name].setdefault(key, {}).setdefault(repo, []).append(setting)
627621
extra_aliases.setdefault(hub_name, {})
628622
for whl_name, aliases in out.extra_aliases.items():
629623
extra_aliases[hub_name].setdefault(whl_name, {}).update(aliases)
@@ -653,6 +647,12 @@ You cannot use both the additive_build_content and additive_build_content_file a
653647
# using an alternative cycle resolution strategy.
654648
hub_group_map[hub_name] = pip_attr.experimental_requirement_cycles
655649

650+
for hub in pip_hub_map.values():
651+
hub_whl_map.setdefault(hub.name, {})
652+
for key, settings in hub.whl_map.items():
653+
for setting, repo in settings.items():
654+
hub_whl_map[hub.name].setdefault(key, {}).setdefault(repo, []).append(setting)
655+
656656
return struct(
657657
# We sort so that the lock-file remains the same no matter the order of how the
658658
# args are manipulated in the code going before.

0 commit comments

Comments
 (0)