Skip to content

Commit abe2699

Browse files
authored
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
1 parent 09acaaa commit abe2699

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
@@ -83,6 +83,14 @@ END_UNRELEASED_TEMPLATE
8383
that are associated with the target's `srcs` are present.
8484
([#3354](https://github.com/bazel-contrib/rules_python/issues/3354)).
8585

86+
{#v1-8-3}
87+
## [1.8.3] - 2026-01-27
88+
89+
{#v1-8-3-fixed}
90+
### Fixed
91+
* (pipstar) Fix whl extraction on Windows when bazelrc has XX flags.
92+
Fixes [#3543](https://github.com/bazel-contrib/rules_python/issues/3543).
93+
8694
{#v1-8-2}
8795
## [1.8.2] - 2026-01-24
8896

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)