Skip to content

Commit 1c768ca

Browse files
committed
feat(pypi): enable pipstar by default on bzlmod
Extra fixes: - add more logging to the failure - better METADATA files in tests - fix tests
1 parent 9ba8c12 commit 1c768ca

File tree

8 files changed

+21
-2
lines changed

8 files changed

+21
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ END_UNRELEASED_TEMPLATE
6969
* (bootstrap) For {obj}`--bootstrap_impl=system_python`, the sys.path order has
7070
changed from `[app paths, stdlib, runtime site-packages]` to `[stdlib, app
7171
paths, runtime site-packages]`.
72+
* (pypi) `pipstar` flag has been flipped to be enabled by default for bzlmod
73+
([#2949](https://github.com/bazel-contrib/rules_python/issues/2949)).
7274

7375
{#v0-0-0-fixed}
7476
### Fixed

python/private/internal_config_repo.bzl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ settings for rules to later use.
2020

2121
load(":repo_utils.bzl", "repo_utils")
2222

23+
_BZLMOD_ENABLED = "@@" in str(Label("//:unused"))
2324
_ENABLE_PIPSTAR_ENVVAR_NAME = "RULES_PYTHON_ENABLE_PIPSTAR"
24-
_ENABLE_PIPSTAR_DEFAULT = "0"
25+
_ENABLE_PIPSTAR_DEFAULT = "1" if _BZLMOD_ENABLED else "0"
2526
_ENABLE_PYSTAR_ENVVAR_NAME = "RULES_PYTHON_ENABLE_PYSTAR"
2627
_ENABLE_PYSTAR_DEFAULT = "1"
2728
_ENABLE_DEPRECATION_WARNINGS_ENVVAR_NAME = "RULES_PYTHON_DEPRECATION_WARNINGS"

python/private/internal_dev_deps.bzl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ 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+
dep_template = "@rules_python//tests/support:support.bzl",
4344
)
4445

4546
# Setup for //tests/implicit_namespace_packages
@@ -53,6 +54,7 @@ def _internal_dev_deps_impl(mctx):
5354
whl_file = "@implicit_namespace_ns_sub1_whl//:ns_sub1-1.0-any-none-any.whl",
5455
requirement = "ns-sub1",
5556
enable_implicit_namespace_pkgs = False,
57+
dep_template = "@rules_python//tests/support:support.bzl",
5658
)
5759

5860
whl_from_dir_repo(
@@ -65,6 +67,7 @@ def _internal_dev_deps_impl(mctx):
6567
whl_file = "@implicit_namespace_ns_sub2_whl//:ns_sub2-1.0-any-none-any.whl",
6668
requirement = "ns-sub2",
6769
enable_implicit_namespace_pkgs = False,
70+
dep_template = "@rules_python//tests/support:support.bzl",
6871
)
6972

7073
internal_dev_deps = module_extension(

python/private/pypi/whl_metadata.bzl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ def whl_metadata(*, install_dir, read_fn, logger):
2626
result = parse_whl_metadata(contents)
2727

2828
if not (result.name and result.version):
29-
logger.fail("Failed to parsed the wheel METADATA file:\n{}".format(contents))
29+
logger.fail("Failed to parsed the wheel METADATA file:\n{}\n{}\n{}".format(
30+
80 * "=",
31+
contents.rstrip("\n"),
32+
80 * "=",
33+
))
3034
return None
3135

3236
return result
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Name: ns-sub1
2+
Version: 1.0
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Name: ns-sub2
2+
Version: 1.0

tests/support/support.bzl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
load("//python/private:bzlmod_enabled.bzl", "BZLMOD_ENABLED") # buildifier: disable=bzl-visibility
2323
load("//python/private:util.bzl", "IS_BAZEL_7_OR_HIGHER") # buildifier: disable=bzl-visibility
2424

25+
# this is used in integration tests with `whl_library`
26+
whl_map = []
27+
2528
MAC = Label("//tests/support:mac")
2629
MAC_X86_64 = Label("//tests/support:mac_x86_64")
2730
LINUX = Label("//tests/support:linux")
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Name: somepkg
2+
Version: 1.0

0 commit comments

Comments
 (0)