|
| 1 | +diff --git a/mesonpy/_tags.py b/mesonpy/_tags.py |
| 2 | +index 7416008..76889cd 100644 |
| 3 | +--- a/mesonpy/_tags.py |
| 4 | ++++ b/mesonpy/_tags.py |
| 5 | +@@ -46,40 +46,7 @@ def _get_cpython_abi() -> str: |
| 6 | + |
| 7 | + |
| 8 | + def get_abi_tag() -> str: |
| 9 | +- # The best solution to obtain the Python ABI is to parse the |
| 10 | +- # $SOABI or $EXT_SUFFIX sysconfig variables as defined in PEP-314. |
| 11 | +- |
| 12 | +- # PyPy reports a $SOABI that does not agree with $EXT_SUFFIX. |
| 13 | +- # Using $EXT_SUFFIX will not break when PyPy will fix this. |
| 14 | +- # See https://foss.heptapod.net/pypy/pypy/-/issues/3816 and |
| 15 | +- # https://github.com/pypa/packaging/pull/607. |
| 16 | +- try: |
| 17 | +- empty, abi, ext = str(sysconfig.get_config_var('EXT_SUFFIX')).split('.') |
| 18 | +- except ValueError: |
| 19 | +- # CPython <= 3.8.7 on Windows does not implement PEP3149 and |
| 20 | +- # uses '.pyd' as $EXT_SUFFIX, which does not allow to extract |
| 21 | +- # the interpreter ABI. Check that the fallback is not hit for |
| 22 | +- # any other Python implementation. |
| 23 | +- if sys.implementation.name != 'cpython': |
| 24 | +- raise NotImplementedError |
| 25 | +- return _get_cpython_abi() |
| 26 | +- |
| 27 | +- # The packaging module initially based his understanding of the |
| 28 | +- # $SOABI variable on the inconsistent value reported by PyPy, and |
| 29 | +- # did not strip architecture information from it. Therefore the |
| 30 | +- # ABI tag for later Python implementations (all the ones not |
| 31 | +- # explicitly handled below) contains architecture information too. |
| 32 | +- # Unfortunately, fixing this now would break compatibility. |
| 33 | +- |
| 34 | +- if abi.startswith('cpython'): |
| 35 | +- abi = 'cp' + abi.split('-')[1] |
| 36 | +- elif abi.startswith('cp'): |
| 37 | +- abi = abi.split('-')[0] |
| 38 | +- elif abi.startswith('pypy'): |
| 39 | +- abi = '_'.join(abi.split('-')[:2]) |
| 40 | +- elif abi.startswith('graalpy'): |
| 41 | +- abi = '_'.join(abi.split('-')[:3]) |
| 42 | +- |
| 43 | ++ abi = sysconfig.get_config_var("SOABI") |
| 44 | + return abi.replace('.', '_').replace('-', '_') |
| 45 | + |
| 46 | + |
0 commit comments