Skip to content

Commit 8fc665e

Browse files
committed
a better included packages passing
1 parent 320b65f commit 8fc665e

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

python/private/internal_dev_deps.bzl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ def _internal_dev_deps_impl(mctx):
4040
name = "somepkg_with_build_files",
4141
whl_file = "@whl_with_build_files//:somepkg-1.0-any-none-any.whl",
4242
requirement = "somepkg",
43-
packages = ["dummy"],
4443
)
4544

4645
# Setup for //tests/implicit_namespace_packages
@@ -54,7 +53,6 @@ def _internal_dev_deps_impl(mctx):
5453
whl_file = "@implicit_namespace_ns_sub1_whl//:ns_sub1-1.0-any-none-any.whl",
5554
requirement = "ns-sub1",
5655
enable_implicit_namespace_pkgs = False,
57-
packages = ["dummy"],
5856
)
5957

6058
whl_from_dir_repo(
@@ -67,7 +65,6 @@ def _internal_dev_deps_impl(mctx):
6765
whl_file = "@implicit_namespace_ns_sub2_whl//:ns_sub2-1.0-any-none-any.whl",
6866
requirement = "ns-sub2",
6967
enable_implicit_namespace_pkgs = False,
70-
packages = ["dummy"],
7168
)
7269

7370
internal_dev_deps = module_extension(

python/private/pypi/generate_whl_library_build_bazel.bzl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,7 @@ def generate_whl_library_build_bazel(
8585
]
8686
dep_template = kwargs.get("dep_template")
8787
packages = kwargs.pop("packages", [])
88-
if packages:
89-
kwargs["include"] = render.list(packages)
90-
else:
88+
if dep_template:
9189
loads.append(
9290
"""load("{}", "{}")""".format(
9391
dep_template.format(
@@ -98,6 +96,8 @@ def generate_whl_library_build_bazel(
9896
),
9997
)
10098
kwargs["include"] = "packages"
99+
elif packages:
100+
kwargs["include"] = render.list(packages)
101101

102102
for arg in unsupported_args:
103103
if kwargs.get(arg):

python/private/pypi/whl_library.bzl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,10 +419,18 @@ def _whl_library_impl(rctx):
419419
logger = logger,
420420
)
421421

422+
dep_template = rctx.attr.dep_template
423+
424+
# packages will be set in tests or WORKSPACE
425+
if rctx.attr.packages:
426+
dep_template = dep_template or "@{}{{name}}//:{{target}}".format(
427+
rctx.attr.repo_prefix,
428+
)
429+
422430
build_file_contents = generate_whl_library_build_bazel(
423431
name = whl_path.basename,
424432
sdist_filename = sdist_filename,
425-
dep_template = rctx.attr.dep_template or "@{}{{name}}//:{{target}}".format(rctx.attr.repo_prefix),
433+
dep_template = dep_template,
426434
packages = rctx.attr.packages,
427435
entry_points = entry_points,
428436
metadata_name = metadata.name,

0 commit comments

Comments
 (0)