Skip to content

Commit bfa77de

Browse files
committed
Backport new ABI tag scheme into bundled pip
1 parent d6de590 commit bfa77de

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

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

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,61 @@ index 78b5c13..18a184c 100644
327327
raise InstallationError(f"Cannot determine archive format of {location}")
328328
+ from pip._internal.utils.graalpy import apply_graalpy_patches
329329
+ apply_graalpy_patches(filename, location)
330+
diff --git a/pip/_vendor/packaging/tags.py b/pip/_vendor/packaging/tags.py
331+
index 9a3d25a..a1e93f2 100644
332+
--- a/pip/_vendor/packaging/tags.py
333+
+++ b/pip/_vendor/packaging/tags.py
334+
@@ -224,10 +224,46 @@ def cpython_tags(
335+
yield Tag(interpreter, "abi3", platform_)
336+
337+
338+
-def _generic_abi() -> Iterator[str]:
339+
- abi = sysconfig.get_config_var("SOABI")
340+
- if abi:
341+
- yield _normalize_string(abi)
342+
+# GraalVM change: backported change from pypa/packaging
343+
+def _generic_abi() -> List[str]:
344+
+ """
345+
+ Return the ABI tag based on EXT_SUFFIX.
346+
+ """
347+
+ # The following are examples of `EXT_SUFFIX`.
348+
+ # We want to keep the parts which are related to the ABI and remove the
349+
+ # parts which are related to the platform:
350+
+ # - linux: '.cpython-310-x86_64-linux-gnu.so' => cp310
351+
+ # - mac: '.cpython-310-darwin.so' => cp310
352+
+ # - win: '.cp310-win_amd64.pyd' => cp310
353+
+ # - win: '.pyd' => cp37 (uses _cpython_abis())
354+
+ # - pypy: '.pypy38-pp73-x86_64-linux-gnu.so' => pypy38_pp73
355+
+ # - graalpy: '.graalpy-38-native-x86_64-darwin.dylib'
356+
+ # => graalpy_38_native
357+
+
358+
+ ext_suffix = _get_config_var("EXT_SUFFIX", warn=True)
359+
+ if not isinstance(ext_suffix, str) or ext_suffix[0] != ".":
360+
+ raise SystemError("invalid sysconfig.get_config_var('EXT_SUFFIX')")
361+
+ parts = ext_suffix.split(".")
362+
+ if len(parts) < 3:
363+
+ # CPython3.7 and earlier uses ".pyd" on Windows.
364+
+ return _cpython_abis(sys.version_info[:2])
365+
+ soabi = parts[1]
366+
+ if soabi.startswith("cpython"):
367+
+ # non-windows
368+
+ abi = "cp" + soabi.split("-")[1]
369+
+ elif soabi.startswith("cp"):
370+
+ # windows
371+
+ abi = soabi.split("-")[0]
372+
+ elif soabi.startswith("pypy"):
373+
+ abi = "-".join(soabi.split("-")[:2])
374+
+ elif soabi.startswith("graalpy"):
375+
+ abi = "-".join(soabi.split("-")[:3])
376+
+ elif soabi:
377+
+ # pyston, ironpython, others?
378+
+ abi = soabi
379+
+ else:
380+
+ return []
381+
+ return [_normalize_string(abi)]
382+
383+
384+
def generic_tags(
330385
diff --git a/pip/_vendor/platformdirs/api.py b/pip/_vendor/platformdirs/api.py
331386
index 6f6e2c2..7760125 100644
332387
--- a/pip/_vendor/platformdirs/api.py

0 commit comments

Comments
 (0)