@@ -58,10 +58,10 @@ index 1af8978..15fee7f 100644
58
58
# file in .data maps to same location as file in wheel root).
59
59
diff --git a/pip/_internal/utils/graalpy.py b/pip/_internal/utils/graalpy.py
60
60
new file mode 100644
61
- index 0000000..d8d97eb
61
+ index 0000000..d41572c
62
62
--- /dev/null
63
63
+++ b/pip/_internal/utils/graalpy.py
64
- @@ -0,0 +1,145 @@
64
+ @@ -0,0 +1,148 @@
65
65
+ # ATTENTION: GraalPy uses existence of this module to verify that it is
66
66
+ # running a patched pip in pip_hook.py
67
67
+ import os
@@ -136,12 +136,15 @@ index 0000000..d8d97eb
136
136
+
137
137
+ # end of code duplicated in ginstall.py
138
138
+
139
- + def apply_first_existing(dir, suffix, wd=''):
139
+ + def apply_first_existing(dir, suffix, wd=None):
140
+ + patch_target_dir = location
141
+ + if wd:
142
+ + patch_target_dir = os.path.join(location, wd)
140
143
+ filename = first_existing(package_name, name_ver_match, dir, suffix)
141
144
+ if filename:
142
145
+ print("Patching package " + package_name + " using " + filename)
143
146
+ try:
144
- + subprocess.run(["patch", "-f", "-d", os.path.join(location, wd) , "-p1", "-i", filename], check=True)
147
+ + subprocess.run(["patch", "-f", "-d", patch_target_dir , "-p1", "-i", filename], check=True)
145
148
+ except FileNotFoundError:
146
149
+ print(
147
150
+ "WARNING: GraalPy needs the 'patch' utility to apply compatibility patches. Please install it using your system's package manager.")
@@ -163,7 +166,7 @@ index 0000000..d8d97eb
163
166
+ # with a patch intended for a binary distribution, because in the source
164
167
+ # distribution the actual deployed sources may be in a subdirectory (typically "src")
165
168
+ bdist_dir = os.path.join(pbd, package_name, "whl")
166
- + bdist_patch_wd = read_first_existing(package_name, name_ver_match, bdist_dir, ".dir") if is_sdist else ''
169
+ + bdist_patch_wd = read_first_existing(package_name, name_ver_match, bdist_dir, ".dir") if is_sdist else None
167
170
+ apply_first_existing(bdist_dir, ".patch", bdist_patch_wd)
168
171
+
169
172
+ # patches intended for source distribution if applicable
0 commit comments