Skip to content

Commit 47b80c4

Browse files
committed
add extra docs to the changelog and adjust a bit
1 parent e096244 commit 47b80c4

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ END_UNRELEASED_TEMPLATE
7272
* (pypi) `pipstar` flag has been flipped to be enabled by default, to turn it
7373
off use `RULES_PYTHON_ENABLE_PIPSTAR=0` environment variable. If you do, please
7474
add a comment to
75-
[#2949](https://github.com/bazel-contrib/rules_python/issues/2949).
75+
[#2949](https://github.com/bazel-contrib/rules_python/issues/2949). On `WORKSPACE`
76+
you will see `whl_library` re-fetching if the list of packages in the
77+
`requirements.txt` file changes, to workaround this in cases where you are not
78+
vendoring the requirements you can set
79+
{obj}`pip_repository.use_hub_alias_dependencies` to `True`.
7680

7781
{#v0-0-0-fixed}
7882
### Fixed

python/private/pypi/generate_whl_library_build_bazel.bzl

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,15 @@ def generate_whl_library_build_bazel(
8585
]
8686
dep_template = kwargs.get("dep_template")
8787
packages = kwargs.pop("packages", [])
88-
if kwargs.get("requires_dist"):
88+
if not kwargs.get("requires_dist"):
89+
# no deps, we can leave the extra loads out
90+
pass
91+
elif packages:
92+
kwargs["include"] = render.list(packages)
93+
else:
8994
packages_load = dep_template.format(name = "", target = "requirements.bzl")
90-
if "_//" in packages_load:
91-
kwargs["include"] = render.list(packages)
92-
else:
93-
loads.append("""load("{}", "{}")""".format(packages_load, "packages"))
94-
kwargs["include"] = "packages"
95+
loads.append("""load("{}", "{}")""".format(packages_load, "packages"))
96+
kwargs["include"] = "packages"
9597

9698
for arg in unsupported_args:
9799
if kwargs.get(arg):

python/private/pypi/whl_library.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ def _whl_library_impl(rctx):
428428
dep_template = rctx.attr.dep_template or "@{}{{name}}//:{{target}}".format(
429429
rctx.attr.repo_prefix,
430430
),
431-
packages = rctx.attr.packages,
431+
packages = rctx.attr.packages if rctx.attr.repo_prefix else [],
432432
entry_points = entry_points,
433433
metadata_name = metadata.name,
434434
metadata_version = metadata.version,

0 commit comments

Comments
 (0)