Skip to content

Commit d52b964

Browse files
gholmsaignas
andauthored
feat(pypi): Add extra_hub_aliases to pip_repository too (#2426)
The extra_hub_aliases feature from #2369 has bindings in the pip extension for bzlmod users, but not pip_repository for WORKSPACE users. But it _can_ work for either, so this patch moves it to the list of attrs the two share and makes it work with the latter. --------- Co-authored-by: Ignas Anikevicius <[email protected]>
1 parent 9766cb6 commit d52b964

File tree

5 files changed

+14
-12
lines changed

5 files changed

+14
-12
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ Unreleased changes template.
7171

7272
Other changes:
7373
* (python_repository) Start honoring the `strip_prefix` field for `zstd` archives.
74+
* (pypi) {bzl:obj}`pip_parse.extra_hub_aliases` now works in WORKSPACE files.
7475

7576
{#v0-0-0-fixed}
7677
### Fixed

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/attrs.bzl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,16 @@ Special values: `host` (for generating deps for the host platform only) and
141141
NOTE: this is not for cross-compiling Python wheels but rather for parsing the `whl` METADATA correctly.
142142
""",
143143
),
144+
"extra_hub_aliases": attr.string_list_dict(
145+
doc = """\
146+
Extra aliases to make for specific wheels in the hub repo. This is useful when
147+
paired with the {attr}`whl_modifications`.
148+
149+
:::{versionadded} 0.38.0
150+
:::
151+
""",
152+
mandatory = False,
153+
),
144154
"extra_pip_args": attr.string_list(
145155
doc = """Extra arguments to pass on to pip. Must not contain spaces.
146156

python/private/pypi/extension.bzl

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -750,16 +750,6 @@ The indexes must support Simple API as described here:
750750
https://packaging.python.org/en/latest/specifications/simple-repository-api/
751751
""",
752752
),
753-
"extra_hub_aliases": attr.string_list_dict(
754-
doc = """\
755-
Extra aliases to make for specific wheels in the hub repo. This is useful when
756-
paired with the {attr}`whl_modifications`.
757-
758-
:::{versionadded} 0.38.0
759-
:::
760-
""",
761-
mandatory = False,
762-
),
763753
"hub_name": attr.string(
764754
mandatory = True,
765755
doc = """

python/private/pypi/pip_repository.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ def _pip_repository_impl(rctx):
177177
pkg: [whl_alias(repo = rctx.attr.name + "_" + pkg)]
178178
for pkg in bzl_packages or []
179179
},
180+
extra_hub_aliases = rctx.attr.extra_hub_aliases,
180181
)
181182
for path, contents in aliases.items():
182183
rctx.file(path, contents)

0 commit comments

Comments
 (0)