Skip to content

Commit b3d9b42

Browse files
fix(pip): Only directly extract .whl files in Bazel >9 (#3452)
Directly extracting .whl files is only supported in Bazel >=8.3.0 (see bazelbuild/bazel#26323). This change applies the workaround for Bazel <8.0.0 to all versions <9.0.0 for broader compatibility. Work towards #2948
1 parent d3ff1d1 commit b3d9b42

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

python/private/pypi/whl_library.bzl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,10 @@ def _whl_library_impl(rctx):
377377
#
378378
# Remove non-pipstar and config_load check when we release rules_python 2.
379379
if enable_pipstar:
380-
if rp_config.bazel_8_or_later:
380+
# Extracting .whl files requires Bazel 8.3.0 or later, so require a
381+
# minimum of Bazel 9.0.0 to ensure compatibilty with earlier versions
382+
# of Bazel 8.
383+
if rp_config.bazel_9_or_later:
381384
extract_path = whl_path
382385
else:
383386
extract_path = rctx.path(whl_path.basename + ".zip")
@@ -386,7 +389,7 @@ def _whl_library_impl(rctx):
386389
archive = extract_path,
387390
output = "site-packages",
388391
)
389-
if not rp_config.bazel_8_or_later:
392+
if not rp_config.bazel_9_or_later:
390393
rctx.delete(extract_path)
391394

392395
metadata = whl_metadata(

0 commit comments

Comments
 (0)