Skip to content

Commit e6f09b5

Browse files
committed
further cleanup to prepare for final review
1 parent a61e676 commit e6f09b5

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

python/private/pypi/config.bzl.tmpl.bzlmod renamed to python/private/pypi/config.bzl.tmpl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
NOTE: This is internal `rules_python` API and if you would like to depend on it, please raise an issue
44
with your usecase. This may change in between rules_python versions without any notice.
5-
6-
@generated by rules_python pip.parse bzlmod extension.
75
"""
86

97
packages = %%PACKAGES%%

python/private/pypi/hub_repository.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ in the pip.parse tag class.
100100
""",
101101
),
102102
"_config_template": attr.label(
103-
default = ":config.bzl.tmpl.bzlmod",
103+
default = ":config.bzl.tmpl",
104104
),
105105
"_requirements_bzl_template": attr.label(
106106
default = ":requirements.bzl.tmpl.bzlmod",

python/private/pypi/pip_repository.bzl

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def _pip_repository_impl(rctx):
193193
aliases = render_pkg_aliases(
194194
aliases = {
195195
pkg: rctx.attr.name + "_" + pkg
196-
for pkg in bzl_packages or []
196+
for pkg in bzl_packages
197197
},
198198
extra_hub_aliases = rctx.attr.extra_hub_aliases,
199199
requirement_cycles = requirement_cycles,
@@ -202,6 +202,17 @@ def _pip_repository_impl(rctx):
202202
rctx.file(path, contents)
203203

204204
rctx.file("BUILD.bazel", _BUILD_FILE_CONTENTS)
205+
if rctx.attr.use_hub_alias_dependencies:
206+
rctx.template(
207+
"config.bzl",
208+
rctx.attr._config_template,
209+
substitutions = {
210+
"%%PACKAGES%%": render.dict({
211+
pkg: None
212+
for pkg in bzl_packages
213+
}, value_repr = lambda x: "None"),
214+
},
215+
)
205216
rctx.template("requirements.bzl", rctx.attr._template, substitutions = {
206217
" # %%CONFIG_REPO%%": """\
207218
config_repo = "{name}__config"
@@ -255,6 +266,9 @@ generated using the `package_name` macro. For example usage, see [this WORKSPACE
255266
file](https://github.com/bazel-contrib/rules_python/blob/main/examples/pip_repository_annotations/WORKSPACE).
256267
""",
257268
),
269+
_config_template = attr.label(
270+
default = ":config.bzl.tmpl",
271+
),
258272
_template = attr.label(
259273
default = ":requirements.bzl.tmpl.workspace",
260274
),

python/private/pypi/whl_config_repository.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ in the pip.parse tag class.
3333
""",
3434
),
3535
"_config_template": attr.label(
36-
default = ":config.bzl.tmpl.bzlmod",
36+
default = ":config.bzl.tmpl",
3737
),
3838
},
3939
doc = """

0 commit comments

Comments
 (0)