Skip to content

Commit fe029d7

Browse files
committed
Update pip patch not to fail when no .dir file
1 parent 39072dc commit fe029d7

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

graalpython/lib-graalpython/patches/pip/whl/pip-22.2.2.patch

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ index 1af8978..15fee7f 100644
5858
# file in .data maps to same location as file in wheel root).
5959
diff --git a/pip/_internal/utils/graalpy.py b/pip/_internal/utils/graalpy.py
6060
new file mode 100644
61-
index 0000000..d8d97eb
61+
index 0000000..d41572c
6262
--- /dev/null
6363
+++ b/pip/_internal/utils/graalpy.py
64-
@@ -0,0 +1,145 @@
64+
@@ -0,0 +1,148 @@
6565
+# ATTENTION: GraalPy uses existence of this module to verify that it is
6666
+# running a patched pip in pip_hook.py
6767
+import os
@@ -136,12 +136,15 @@ index 0000000..d8d97eb
136136
+
137137
+ # end of code duplicated in ginstall.py
138138
+
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)
140143
+ filename = first_existing(package_name, name_ver_match, dir, suffix)
141144
+ if filename:
142145
+ print("Patching package " + package_name + " using " + filename)
143146
+ 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)
145148
+ except FileNotFoundError:
146149
+ print(
147150
+ "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
163166
+ # with a patch intended for a binary distribution, because in the source
164167
+ # distribution the actual deployed sources may be in a subdirectory (typically "src")
165168
+ 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
167170
+ apply_first_existing(bdist_dir, ".patch", bdist_patch_wd)
168171
+
169172
+ # patches intended for source distribution if applicable

0 commit comments

Comments
 (0)