From 6756f2a822fcdaf344778c44b901cd8f2b950f86 Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Tue, 27 Jan 2026 15:37:46 +0900 Subject: [PATCH 1/3] fix(pip): simply extract whl contents to the current directory Before we would try to get the whl path and extract to the sibling directory. Whilst this is not failing right now, technically this is not the best behaviour because the whl itself may come from elsewhere. This PR is simplifying code to see if it helps solve an issue on Windows. Fixes #3543 --- CHANGELOG.md | 8 ++++++++ python/private/pypi/whl_extract.bzl | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 683235b7f3..1cf27d07ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -83,6 +83,14 @@ END_UNRELEASED_TEMPLATE that are associated with the target's `srcs` are present. ([#3354](https://github.com/bazel-contrib/rules_python/issues/3354)). +{#v1-8-3} +## [1.8.3] - 2026-01-27 + +{#v1-8-3-fixed} +### Fixed +* (pipstar) Fix whl extraction on Windows when bazelrc has XX flags. + Fixes [#3543](https://github.com/bazel-contrib/rules_python/issues/3543). + {#v1-8-2} ## [1.8.2] - 2026-01-24 diff --git a/python/private/pypi/whl_extract.bzl b/python/private/pypi/whl_extract.bzl index 6b2e0507ac..142231319d 100644 --- a/python/private/pypi/whl_extract.bzl +++ b/python/private/pypi/whl_extract.bzl @@ -12,7 +12,7 @@ def whl_extract(rctx, *, whl_path, logger): whl_path: the whl path to extract. logger: The logger to use """ - install_dir_path = whl_path.dirname.get_child("site-packages") + install_dir_path = rctx.path("site-packages") repo_utils.extract( rctx, archive = whl_path, From c9be44ddd27d27ccd3b6fe1c5915c5a0ddfd1eb8 Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Tue, 27 Jan 2026 15:54:12 +0900 Subject: [PATCH 2/3] fixup --- python/private/pypi/whl_extract.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/private/pypi/whl_extract.bzl b/python/private/pypi/whl_extract.bzl index 142231319d..eda03637a6 100644 --- a/python/private/pypi/whl_extract.bzl +++ b/python/private/pypi/whl_extract.bzl @@ -30,7 +30,7 @@ def whl_extract(rctx, *, whl_path, logger): dist_info_dir.get_child("INSTALLER"), "https://github.com/bazel-contrib/rules_python#pipstar", ) - repo_root_dir = whl_path.dirname + repo_root_dir = install_dir_path.dirname # Get the .dist_info dir name data_dir = dist_info_dir.dirname.get_child(dist_info_dir.basename[:-len(".dist-info")] + ".data") From a171cff75c6ac1ea6ab37634f46d3bf9f74f51dc Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Tue, 27 Jan 2026 15:57:56 +0900 Subject: [PATCH 3/3] another fixp --- python/private/pypi/whl_extract.bzl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/python/private/pypi/whl_extract.bzl b/python/private/pypi/whl_extract.bzl index eda03637a6..75c5686cb8 100644 --- a/python/private/pypi/whl_extract.bzl +++ b/python/private/pypi/whl_extract.bzl @@ -30,7 +30,6 @@ def whl_extract(rctx, *, whl_path, logger): dist_info_dir.get_child("INSTALLER"), "https://github.com/bazel-contrib/rules_python#pipstar", ) - repo_root_dir = install_dir_path.dirname # Get the .dist_info dir name data_dir = dist_info_dir.dirname.get_child(dist_info_dir.basename[:-len(".dist-info")] + ".data") @@ -54,7 +53,7 @@ def whl_extract(rctx, *, whl_path, logger): # The prefix does not exist in the wheel, we can continue continue - for (src, dest) in merge_trees(src, repo_root_dir.get_child(dest_prefix)): + for (src, dest) in merge_trees(src, rctx.path(dest_prefix)): logger.debug(lambda: "Renaming: {} -> {}".format(src, dest)) rctx.rename(src, dest)