1616
1717import mesonpy
1818
19- from .conftest import MESON_VERSION , adjust_packaging_platform_tag , metadata
19+ from .conftest import EXT_SUFFIX , FREE_THREADED_BUILD , MESON_VERSION , adjust_packaging_platform_tag , metadata
2020
2121
22- EXT_SUFFIX = sysconfig .get_config_var ('EXT_SUFFIX' )
23- if sys .version_info <= (3 , 8 , 7 ):
24- if MESON_VERSION >= (0 , 99 ):
25- # Fixed in Meson 1.0, see https://github.com/mesonbuild/meson/pull/10961.
26- from distutils .sysconfig import get_config_var
27- EXT_SUFFIX = get_config_var ('EXT_SUFFIX' )
28-
2922if sys .platform in {'win32' , 'cygwin' }:
3023 EXT_IMP_SUFFIX = re .sub (r'.(pyd|dll)$' , '.lib' if shutil .which ('cl.exe' ) else '.dll.a' , EXT_SUFFIX )
3124
3528 'win32' : '.dll' ,
3629}.get (sys .platform , '.so' )
3730
38- NOGIL_BUILD = bool (sysconfig .get_config_var ('Py_GIL_DISABLED' ))
39-
4031# Test against the wheel tag generated by packaging module.
4132tag = next (packaging .tags .sys_tags ())
4233ABI = tag .abi
@@ -321,7 +312,7 @@ def test_skip_subprojects(package_subproject, tmp_path, arg):
321312
322313# Requires Meson 1.3.0, see https://github.com/mesonbuild/meson/pull/11745.
323314@pytest .mark .skipif (MESON_VERSION < (1 , 2 , 99 ), reason = 'meson too old' )
324- @pytest .mark .skipif (NOGIL_BUILD , reason = 'Free-threaded CPython does not support the limited API' )
315+ @pytest .mark .skipif (FREE_THREADED_BUILD , reason = 'Free-threaded CPython does not support the limited API' )
325316@pytest .mark .xfail ('__pypy__' in sys .builtin_module_names , reason = 'PyPy does not support the abi3 platform tag for wheels' )
326317def test_limited_api (wheel_limited_api ):
327318 artifact = wheel .wheelfile .WheelFile (wheel_limited_api )
@@ -333,7 +324,7 @@ def test_limited_api(wheel_limited_api):
333324
334325# Requires Meson 1.3.0, see https://github.com/mesonbuild/meson/pull/11745.
335326@pytest .mark .skipif (MESON_VERSION < (1 , 2 , 99 ), reason = 'meson too old' )
336- @pytest .mark .skipif (NOGIL_BUILD , reason = 'Free-threaded CPython does not support the limited API' )
327+ @pytest .mark .skipif (FREE_THREADED_BUILD , reason = 'Free-threaded CPython does not support the limited API' )
337328@pytest .mark .xfail ('__pypy__' in sys .builtin_module_names , reason = 'PyPy does not use special modules suffix for stable ABI' )
338329def test_limited_api_bad (package_limited_api , tmp_path ):
339330 with pytest .raises (mesonpy .BuildError , match = 'The package declares compatibility with Python limited API but ' ):
@@ -421,5 +412,5 @@ def test_limited_api_free_threaded(wheel_limited_api_free_threaded):
421412 artifact = wheel .wheelfile .WheelFile (wheel_limited_api_free_threaded )
422413 name = artifact .parsed_filename
423414 assert name .group ('pyver' ) == INTERPRETER
424- assert name .group ('abi' ) == 'abi3.abi3t' if NOGIL_BUILD else 'abi3'
415+ assert name .group ('abi' ) == 'abi3.abi3t' if FREE_THREADED_BUILD else 'abi3'
425416 assert name .group ('plat' ) == PLATFORM
0 commit comments