Skip to content

Commit 700cfc3

Browse files
committed
use config.bzl to pipe the list of available values
1 parent e6ca2ed commit 700cfc3

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ with your usecase. This may change in between rules_python versions without any
66
@generated by rules_python pip.parse bzlmod extension.
77
"""
88

9-
target_platforms = %%TARGET_PLATFORMS%%
9+
whl_map = %%WHL_MAP%%

python/private/pypi/generate_whl_library_build_bazel.bzl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,12 @@ def generate_whl_library_build_bazel(
8787
"""load("{}", "{}")""".format(
8888
dep_template.format(
8989
name = "",
90-
target = "requirements.bzl",
90+
target = "config.bzl",
9191
),
92-
"all_whl_requirements_by_package",
92+
"whl_map",
9393
),
9494
)
95-
kwargs["include"] = "sorted(all_whl_requirements_by_package)"
95+
kwargs["include"] = "whl_map"
9696

9797
for arg in unsupported_args:
9898
if kwargs.get(arg):

python/private/pypi/hub_repository.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def _impl(rctx):
4949
"config.bzl",
5050
rctx.attr._config_template,
5151
substitutions = {
52-
"%%TARGET_PLATFORMS%%": render.list(rctx.attr.target_platforms),
52+
"%%WHL_MAP%%": render.dict(rctx.attr.whl_map, value_repr = lambda x: "None"),
5353
},
5454
)
5555
rctx.template("requirements.bzl", rctx.attr._requirements_bzl_template, substitutions = {

tests/pypi/generate_whl_library_build_bazel/generate_whl_library_build_bazel_tests.bzl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ _tests.append(_test_all_legacy)
8585

8686
def _test_all(env):
8787
want = """\
88-
load("@pypi//:requirements.bzl", "all_whl_requirements_by_package")
88+
load("@pypi//:config.bzl", "whl_map")
8989
load("@rules_python//python/private/pypi:whl_library_targets.bzl", "whl_library_targets_from_requires")
9090
9191
package(default_visibility = ["//visibility:public"])
@@ -112,7 +112,7 @@ whl_library_targets_from_requires(
112112
"qux",
113113
],
114114
group_name = "qux",
115-
include = sorted(all_whl_requirements_by_package),
115+
include = whl_map,
116116
name = "foo.whl",
117117
requires_dist = [
118118
"foo",
@@ -149,7 +149,7 @@ _tests.append(_test_all)
149149

150150
def _test_all_with_loads(env):
151151
want = """\
152-
load("@pypi//:requirements.bzl", "all_whl_requirements_by_package")
152+
load("@pypi//:config.bzl", "whl_map")
153153
load("@rules_python//python/private/pypi:whl_library_targets.bzl", "whl_library_targets_from_requires")
154154
155155
package(default_visibility = ["//visibility:public"])
@@ -176,7 +176,7 @@ whl_library_targets_from_requires(
176176
"qux",
177177
],
178178
group_name = "qux",
179-
include = sorted(all_whl_requirements_by_package),
179+
include = whl_map,
180180
name = "foo.whl",
181181
requires_dist = [
182182
"foo",

0 commit comments

Comments
 (0)