Skip to content

Commit 0057883

Browse files
committed
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 (cherry picked from commit abe2699)
1 parent a053b56 commit 0057883

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ BEGIN_UNRELEASED_TEMPLATE
4747
END_UNRELEASED_TEMPLATE
4848
-->
4949

50+
{#v1-8-3}
51+
## [1.8.3] - 2026-01-27
52+
53+
{#v1-8-3-fixed}
54+
### Fixed
55+
* (pipstar) Fix whl extraction on Windows when bazelrc has XX flags.
56+
Fixes [#3543](https://github.com/bazel-contrib/rules_python/issues/3543).
57+
5058
{#v1-8-2}
5159
## [1.8.2] - 2026-01-24
5260

python/private/pypi/whl_extract.bzl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def whl_extract(rctx, *, whl_path, logger):
1212
whl_path: the whl path to extract.
1313
logger: The logger to use
1414
"""
15-
install_dir_path = whl_path.dirname.get_child("site-packages")
15+
install_dir_path = rctx.path("site-packages")
1616
repo_utils.extract(
1717
rctx,
1818
archive = whl_path,
@@ -30,7 +30,6 @@ def whl_extract(rctx, *, whl_path, logger):
3030
dist_info_dir.get_child("INSTALLER"),
3131
"https://github.com/bazel-contrib/rules_python#pipstar",
3232
)
33-
repo_root_dir = whl_path.dirname
3433

3534
# Get the <prefix>.dist_info dir name
3635
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):
5453
# The prefix does not exist in the wheel, we can continue
5554
continue
5655

57-
for (src, dest) in merge_trees(src, repo_root_dir.get_child(dest_prefix)):
56+
for (src, dest) in merge_trees(src, rctx.path(dest_prefix)):
5857
logger.debug(lambda: "Renaming: {} -> {}".format(src, dest))
5958
rctx.rename(src, dest)
6059

0 commit comments

Comments
 (0)