Skip to content

Commit 79203a4

Browse files
committed
Merge remote-tracking branch 'origin' into xangcastle/venv
# Conflicts: # py/private/py_venv/virtuals_resolvers.bzl
2 parents 8f1c04a + ebbae84 commit 79203a4

11 files changed

Lines changed: 27 additions & 50 deletions

File tree

e2e/cases/interpreter-features-tkinter/snapshots/amd64_layers_listing.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

e2e/cases/oci/py_image_layer/snapshots/my_app_layers_fp_listing.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

e2e/cases/oci/py_image_layer/snapshots/my_app_layers_listing.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

e2e/cases/oci/py_image_layer/snapshots/my_app_layers_multi_listing.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

e2e/cases/oci/py_venv_image_layer/snapshots/my_app_amd64_layers_listing.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

e2e/cases/oci/py_venv_image_layer/snapshots/my_app_arm64_layers_listing.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

e2e/cases/uv-deps-650/crossbuild/snapshots/app_amd64_layers_listing.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

e2e/cases/uv-deps-650/crossbuild/snapshots/app_arm64_layers_listing.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

py/private/modify_mtree.awk

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,17 @@
33
# following and inlining the target bytes.
44
#
55
# Forked from @tar.bzl//tar/private:preserve_symlinks.awk and tracking
6-
# https://github.com/bazel-contrib/tar.bzl/pull/115. Two behavioural
7-
# differences remain:
6+
# https://github.com/bazel-contrib/tar.bzl/pull/115. One behavioural
7+
# difference remains:
88
#
9-
# 1. `bazel-out/` vs `external/` strip is exclusive (`if` / `else if`)
10-
# rather than two sequential `sub`s. Without this, paths matching
11-
# both regexes — e.g. `bazel-out/<cfg>/bin/external/<repo>/...`,
12-
# the canonical shape of a generated wheel file — get
13-
# over-stripped down to `external/<repo>/...`, miss the
14-
# `symlink_map` lookup, and dangle inside the OCI layer.
15-
# 2. Classified `bazel-out/` or `external/` targets NOT in the
16-
# layer's mtree fall back to `type=file content=...` (bsdtar
17-
# inlines the bytes) instead of being written as a dangling
18-
# `type=link link=external/<repo>/...`. Exercised by py_venv's
19-
# `_virtualenv.py` symlink into the rules_py source tree, which
20-
# under bzlmod's `external/aspect_rules_py+/...` layout isn't a
21-
# separate tar entry.
9+
# The `bazel-out/` vs `external/` strip is exclusive (`if` / `else if`)
10+
# rather than two sequential `sub`s. Without this, paths matching
11+
# both regexes — e.g. `bazel-out/<cfg>/bin/external/<repo>/...`,
12+
# the canonical shape of a generated wheel file — get
13+
# over-stripped down to `external/<repo>/...`, miss the
14+
# `symlink_map` lookup, and dangle inside the OCI layer.
2215
#
23-
# Send a follow-up PR to bazel-contrib/tar.bzl with both once #115
16+
# Send a follow-up PR to bazel-contrib/tar.bzl once #115
2417
# lands so this fork can retire.
2518
#
2619
# Invoked from `_run_tar_action` in [py_image_layer.bzl](py_image_layer.bzl)
@@ -180,16 +173,8 @@ END {
180173
linked_to = make_relative_link(mapped_link, field0)
181174
} else if (resolved_path ~ /^bazel-out\// || resolved_path ~ /^external\//) {
182175
# Classified to a Bazel-tree path but the target row
183-
# isn't in this layer's mtree. Slow path falls back to
184-
# `type=file content=...` so bsdtar inlines the target
185-
# bytes; the hot path has no equivalent (declared
186-
# symlinks whose targets aren't in the layer are a
187-
# config bug) so we emit a dangling `type=link link=...`
188-
# to surface the issue visibly.
189-
if (original_line ~ /type=file/) {
190-
out_lines[++n] = original_line
191-
continue
192-
}
176+
# isn't in this layer's mtree — a config bug. Emit a
177+
# dangling `type=link link=...` to surface it visibly.
193178
linked_to = resolved_path
194179
} else {
195180
# Already a relative path

py/private/py_venv/templates/_virtualenv.py

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,9 @@ def find_spec(self, fullname, path, target=None): # noqa: ARG002
7878
spec = find_spec(fullname, path)
7979
if spec is not None:
8080
# https://www.python.org/dev/peps/pep-0451/#how-loading-will-work
81-
is_new_api = hasattr(spec.loader, "exec_module")
82-
func_name = "exec_module" if is_new_api else "load_module"
83-
old = getattr(spec.loader, func_name)
84-
func = self.exec_module if is_new_api else self.load_module
85-
if old is not func:
86-
try: # noqa: SIM105
87-
setattr(spec.loader, func_name, partial(func, old))
88-
except AttributeError:
89-
pass # C-Extension loaders are r/o such as zipimporter with <3.7
81+
old = spec.loader.exec_module
82+
if old is not self.exec_module:
83+
spec.loader.exec_module = partial(self.exec_module, old)
9084
return spec
9185
finally:
9286
self.fullname = None
@@ -98,12 +92,5 @@ def exec_module(old, module):
9892
if module.__name__ in _DISTUTILS_PATCH:
9993
patch_dist(module)
10094

101-
@staticmethod
102-
def load_module(old, name):
103-
module = old(name)
104-
if module.__name__ in _DISTUTILS_PATCH:
105-
patch_dist(module)
106-
return module
107-
10895

10996
sys.meta_path.insert(0, _Finder())

0 commit comments

Comments
 (0)