Skip to content

Commit 6064ab7

Browse files
committed
wip
1 parent 4e754f7 commit 6064ab7

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

python/private/pypi/extension.bzl

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -518,24 +518,23 @@ You cannot use both the additive_build_content and additive_build_content_file a
518518
)
519519

520520
for hub in pip_hub_map.values():
521+
out = hub.build()
521522
hub_whl_map.setdefault(hub.name, {})
522-
for key, settings in hub.whl_map.items():
523+
for key, settings in out.whl_map.items():
523524
for setting, repo in settings.items():
524525
hub_whl_map[hub.name].setdefault(key, {}).setdefault(repo, []).append(setting)
525526

526-
for whl_name, aliases in hub.extra_aliases.items():
527-
extra_aliases[hub.name].setdefault(whl_name, {}).update(aliases)
528-
529-
whl_libraries.update(hub.whl_libraries)
530-
for whl_name, lib in hub.whl_libraries.items():
527+
for whl_name, lib in out.whl_libraries.items():
531528
if whl_name in lib:
532529
fail("'{}' already in created".format(whl_name))
533530
else:
534531
# replicate whl_libraries.update(out.whl_libraries)
535532
whl_libraries[whl_name] = lib
536533

537-
hub_group_map[hub.name] = hub.group_map
538-
exposed_packages[hub.name] = hub.exposed_packages
534+
hub_whl_map[hub.name] = out.whl_map
535+
extra_aliases[hub.name] = out.extra_aliases
536+
hub_group_map[hub.name] = out.group_map
537+
exposed_packages[hub.name] = out.exposed_packages
539538

540539
return struct(
541540
# 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: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ def hub_builder(
5959
exposed_packages = {},
6060
extra_aliases = {},
6161
whl_libraries = {},
62+
group_map = {},
6263
_evaluate_markers_fn = evaluate_markers_fn,
6364
_logger = logger,
6465
_minor_mapping = minor_mapping,
@@ -79,11 +80,21 @@ def hub_builder(
7980
python_version in self._get_index_urls,
8081
),
8182
evaluate_markers = lambda *a, **k: _evaluate_markers(self, *a, **k),
83+
build = lambda: _build(self),
8284
)
8385

8486
# buildifier: enable=uninitialized
8587
return self
8688

89+
def _build(self):
90+
return struct(
91+
whl_map = self.whl_map,
92+
exposed_packages = self.exposed_packages,
93+
extra_aliases = self.extra_aliases,
94+
whl_libraries = self.whl_libraries,
95+
group_map = self.group_map,
96+
)
97+
8798
def _add(self, *, pip_attr):
8899
python_version = pip_attr.python_version
89100
if python_version in self.python_versions:
@@ -114,7 +125,8 @@ def _add(self, *, pip_attr):
114125
# cycles for different abis/oses? For now we will need the users to
115126
# assume the same groups across all versions/platforms until we start
116127
# using an alternative cycle resolution strategy.
117-
self.group_map = pip_attr.experimental_requirement_cycles
128+
self.group_map.clear()
129+
self.group_map.update(pip_attr.experimental_requirement_cycles)
118130

119131
def _set_index_urls(self, pip_attr):
120132
if not pip_attr.experimental_index_url:

0 commit comments

Comments
 (0)