77import shutil
88import stat
99import sys
10- import sysconfig
1110import textwrap
1211
1312import packaging .tags
1615
1716import mesonpy
1817
19- from .conftest import MESON_VERSION , adjust_packaging_platform_tag , metadata
18+ from .conftest import EXT_SUFFIX , FREE_THREADED_BUILD , MESON_VERSION , adjust_packaging_platform_tag , metadata
2019
2120
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-
2921if sys .platform in {'win32' , 'cygwin' }:
3022 EXT_IMP_SUFFIX = re .sub (r'.(pyd|dll)$' , '.lib' if shutil .which ('cl.exe' ) else '.dll.a' , EXT_SUFFIX )
3123
3527 'win32' : '.dll' ,
3628}.get (sys .platform , '.so' )
3729
38- NOGIL_BUILD = bool (sysconfig .get_config_var ('Py_GIL_DISABLED' ))
39-
4030# Test against the wheel tag generated by packaging module.
4131tag = next (packaging .tags .sys_tags ())
4232ABI = tag .abi
@@ -321,7 +311,7 @@ def test_skip_subprojects(package_subproject, tmp_path, arg):
321311
322312# Requires Meson 1.3.0, see https://github.com/mesonbuild/meson/pull/11745.
323313@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' )
314+ @pytest .mark .skipif (FREE_THREADED_BUILD , reason = 'Free-threaded CPython does not support the limited API' )
325315@pytest .mark .xfail ('__pypy__' in sys .builtin_module_names , reason = 'PyPy does not support the abi3 platform tag for wheels' )
326316def test_limited_api (wheel_limited_api ):
327317 artifact = wheel .wheelfile .WheelFile (wheel_limited_api )
@@ -333,7 +323,7 @@ def test_limited_api(wheel_limited_api):
333323
334324# Requires Meson 1.3.0, see https://github.com/mesonbuild/meson/pull/11745.
335325@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' )
326+ @pytest .mark .skipif (FREE_THREADED_BUILD , reason = 'Free-threaded CPython does not support the limited API' )
337327@pytest .mark .xfail ('__pypy__' in sys .builtin_module_names , reason = 'PyPy does not use special modules suffix for stable ABI' )
338328def test_limited_api_bad (package_limited_api , tmp_path ):
339329 with pytest .raises (mesonpy .BuildError , match = 'The package declares compatibility with Python limited API but ' ):
@@ -421,5 +411,5 @@ def test_limited_api_free_threaded(wheel_limited_api_free_threaded):
421411 artifact = wheel .wheelfile .WheelFile (wheel_limited_api_free_threaded )
422412 name = artifact .parsed_filename
423413 assert name .group ('pyver' ) == INTERPRETER
424- assert name .group ('abi' ) == 'abi3.abi3t' if NOGIL_BUILD else 'abi3'
414+ assert name .group ('abi' ) == 'abi3.abi3t' if FREE_THREADED_BUILD else 'abi3'
425415 assert name .group ('plat' ) == PLATFORM
0 commit comments