Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
296 changes: 0 additions & 296 deletions .agents/plans/pypi_hub_proxy_feature.md

This file was deleted.

3 changes: 3 additions & 0 deletions python/private/internal_config_repo.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ config = struct(
supports_whl_extraction = {supports_whl_extraction},
enable_pystar = True,
enable_deprecation_warnings = {enable_deprecation_warnings},
extract_needs_chmod = {extract_needs_chmod},
bazel_8_or_later = {bazel_8_or_later},
bazel_9_or_later = {bazel_9_or_later},
bazel_10_or_later = {bazel_10_or_later},
Expand Down Expand Up @@ -86,6 +87,7 @@ def _internal_config_repo_impl(rctx):
bazel_minor_version = 99999

supports_whl_extraction = False
extract_needs_chmod = bazel_major_version < 8 or (bazel_major_version == 8 and bazel_minor_version < 6)
if bazel_major_version >= 8:
# Extracting .whl files requires Bazel 8.3.0 or later.
if bazel_major_version > 8 or bazel_minor_version >= 3:
Expand All @@ -105,6 +107,7 @@ def _internal_config_repo_impl(rctx):
builtin_py_info_symbol = builtin_py_info_symbol,
builtin_py_runtime_info_symbol = builtin_py_runtime_info_symbol,
supports_whl_extraction = str(supports_whl_extraction),
extract_needs_chmod = str(extract_needs_chmod),
builtin_py_cc_link_params_provider = builtin_py_cc_link_params_provider,
bazel_8_or_later = str(bazel_major_version >= 8),
bazel_9_or_later = str(bazel_major_version >= 9),
Expand Down
1 change: 1 addition & 0 deletions python/private/pypi/patch_whl.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def patch_whl(rctx, *, whl_path, patches):
rctx,
archive = whl_input,
supports_whl_extraction = rp_config.supports_whl_extraction,
extract_needs_chmod = rp_config.extract_needs_chmod,
)

if not patches:
Expand Down
24 changes: 1 addition & 23 deletions python/private/pypi/whl_extract.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ def whl_extract(rctx, *, whl_path, logger):
archive = whl_path,
output = install_dir_path,
supports_whl_extraction = rp_config.supports_whl_extraction,
extract_needs_chmod = rp_config.extract_needs_chmod,
)

_maybe_fix_permissions(rctx, whl_path = whl_path, logger = logger)

metadata_file = find_whl_metadata(
install_dir = install_dir_path,
logger = logger,
Expand Down Expand Up @@ -65,27 +64,6 @@ def whl_extract(rctx, *, whl_path, logger):
# Ensure that there is no data dir left
rctx.delete(data_dir)

# TODO: This can be removed when Bazel 8.6+ is the minimum supported version.
def _maybe_fix_permissions(rctx, *, whl_path, logger):
# Fix permissions on extracted files. Some wheels have files without read permissions set,
# which causes errors when trying to read them later.
# We apply this to the root directory to ensure that everything in bin/, site-packages/,
# etc. is readable and executable where appropriate.
os_name = repo_utils.get_platforms_os_name(rctx)
if os_name != "windows":
# On Unix-like systems, recursively add read permissions to all files
# and ensure directories are traversable (need execute permission)
result = repo_utils.execute_unchecked(
rctx,
op = "Fixing wheel permissions {}".format(whl_path),
arguments = ["chmod", "-R", "a+rX", "."],
logger = logger,
)
if result.return_code != 0:
# It's possible chmod is not available or the filesystem doesn't support it.
# This is fine, we just want to try to fix permissions if possible.
logger.warn(lambda: "Failed to fix file permissions: {}".format(result.stderr))

def merge_trees(src, dest):
"""Merge src into the destination path.

Expand Down
Loading
Loading