From 3be8d93b1081c4d617b5d9fd66e35074b1ebeefe Mon Sep 17 00:00:00 2001 From: Malik Shahzad Muzaffar Date: Tue, 15 Sep 2026 09:05:50 +0200 Subject: [PATCH 1/3] Fix build issues when Python with free-threading is used Building pasparser with pythin 3.14 (free-threading enabled) failed with error [a]. This change allows to find the correct `lib.linux-x86_64-cpython-314t'` lib [a] ``` Build dir: %s pacparser/src/../tests/../src/pymod/build ['lib.linux-x86_64-cpython-314t', 'temp.linux-x86_64-cpython-314t'] Traceback (most recent call last): File "pacparser/src/../tests/runtests.py", line 39, in runtests pacparser_module_path = module_path(tests_dir) File "pacparser-/src/../tests/runtests.py", line 35, in module_path return glob.glob(os.path.join(builddir, 'lib*%s' % py_ver))[0] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^ IndexError: list index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "pacparser/src/../tests/runtests.py", line 88, in main() ~~~~^^ File "pacparser/src/../tests/runtests.py", line 85, in main runtests(pacfile, testdata, tests_dir) ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "pacparser/src/../tests/runtests.py", line 41, in runtests raise Exception('Tests failed. Could not determine pacparser path.') ``` --- tests/runtests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/runtests.py b/tests/runtests.py index 4c55191..7e9c3cc 100644 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -27,7 +27,7 @@ import tempfile def module_path(tests_dir): - py_ver = '*'.join([str(x) for x in sys.version_info[0:2]]) + py_ver = f"{sys.version_info[0]}{sys.version_info[1]}{sys.abiflags}" builddir = os.path.join(tests_dir, '..', 'src', 'pymod', 'build') print('Build dir: %s', builddir) From b01368b7d8870bafbc488dd3804cc4d64190452a Mon Sep 17 00:00:00 2001 From: Manu Garg Date: Sat, 3 Oct 2026 01:02:42 -0700 Subject: [PATCH 2/3] Don't require sys.abiflags, it's missing on Windows --- tests/runtests.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/runtests.py b/tests/runtests.py index 7e9c3cc..3c0ef20 100644 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -27,7 +27,9 @@ import tempfile def module_path(tests_dir): - py_ver = f"{sys.version_info[0]}{sys.version_info[1]}{sys.abiflags}" + # sys.abiflags (e.g. "t" for free-threaded builds) is not available on + # Windows for all Python versions. + py_ver = f"{sys.version_info[0]}{sys.version_info[1]}{getattr(sys, 'abiflags', '')}" builddir = os.path.join(tests_dir, '..', 'src', 'pymod', 'build') print('Build dir: %s', builddir) From 18bba355383275e393930c15c5ef9ffc883697bd Mon Sep 17 00:00:00 2001 From: Manu Garg Date: Sat, 3 Oct 2026 01:08:44 -0700 Subject: [PATCH 3/3] Keep matching dotted build dir names from older setuptools --- tests/runtests.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/runtests.py b/tests/runtests.py index 3c0ef20..83b95ec 100644 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -27,9 +27,12 @@ import tempfile def module_path(tests_dir): - # sys.abiflags (e.g. "t" for free-threaded builds) is not available on - # Windows for all Python versions. - py_ver = f"{sys.version_info[0]}{sys.version_info[1]}{getattr(sys, 'abiflags', '')}" + # Older setuptools name the build directory with a dotted version + # ("lib.linux-x86_64-3.8"), newer ones without ("...-cpython-312"), hence + # the wildcard. sys.abiflags (e.g. "t" for free-threaded builds) is not + # available on Windows for all Python versions. + py_ver = '*'.join([str(x) for x in sys.version_info[0:2]]) + py_ver += getattr(sys, 'abiflags', '') builddir = os.path.join(tests_dir, '..', 'src', 'pymod', 'build') print('Build dir: %s', builddir)