From abe2699e3d4c8a523f82154afd101d5b26bc8f0b Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Wed, 28 Jan 2026 00:11:07 +0900 Subject: [PATCH] fix(pip): simply extract whl contents to the current directory (#3549) 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 | 5 ++--- 2 files changed, 10 insertions(+), 3 deletions(-) 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..75c5686cb8 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, @@ -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 = whl_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)