Skip to content

Commit 54b5627

Browse files
committed
refactor: flatten the whl_map
1 parent c20d69f commit 54b5627

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

examples/bzlmod/MODULE.bazel.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

python/private/pypi/extension.bzl

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,6 @@ def _create_whl_repos(
103103
)
104104
major_minor = _major_minor_version(pip_attr.python_version)
105105

106-
if hub_name not in whl_map:
107-
whl_map[hub_name] = {}
108-
109106
whl_modifications = {}
110107
if pip_attr.whl_modifications != None:
111108
for mod, whl_name in pip_attr.whl_modifications.items():
@@ -260,7 +257,7 @@ def _create_whl_repos(
260257

261258
whl_libraries[repo_name] = dict(whl_library_args.items())
262259

263-
whl_map[hub_name].setdefault(whl_name, []).append(
260+
whl_map.setdefault(whl_name, []).append(
264261
whl_alias(
265262
repo = repo_name,
266263
version = major_minor,
@@ -297,7 +294,7 @@ def _create_whl_repos(
297294
# args are manipulated in the code going before.
298295
repo_name = "{}_{}".format(pip_name, whl_name)
299296
whl_libraries[repo_name] = dict(whl_library_args.items())
300-
whl_map[hub_name].setdefault(whl_name, []).append(
297+
whl_map.setdefault(whl_name, []).append(
301298
whl_alias(
302299
repo = repo_name,
303300
version = major_minor,
@@ -462,9 +459,8 @@ You cannot use both the additive_build_content and additive_build_content_file a
462459
get_index_urls = get_index_urls,
463460
)
464461
whl_libraries.update(result.whl_libraries)
465-
for hub, config_settings in result.whl_map.items():
466-
for whl, settings in config_settings.items():
467-
hub_whl_map.setdefault(hub, {}).setdefault(whl, []).extend(settings)
462+
for whl, aliases in result.whl_map.items():
463+
hub_whl_map.setdefault(pip_attr.hub_name, {}).setdefault(whl, []).extend(aliases)
468464

469465
# TODO @aignas 2024-04-05: how do we support different requirement
470466
# cycles for different abis/oses? For now we will need the users to

0 commit comments

Comments
 (0)