gh-134632: Fix build-details.json to use INCLUDEPY path (#134633)
Some checks are pending
Tests / Change detection (push) Waiting to run
Tests / Docs (push) Blocked by required conditions
Tests / Check if Autoconf files are up to date (push) Blocked by required conditions
Tests / Check if generated files are up to date (push) Blocked by required conditions
Tests / (push) Blocked by required conditions
Tests / Windows MSI (push) Blocked by required conditions
Tests / Ubuntu SSL tests with OpenSSL (push) Blocked by required conditions
Tests / WASI (push) Blocked by required conditions
Tests / Hypothesis tests on Ubuntu (push) Blocked by required conditions
Tests / Address sanitizer (push) Blocked by required conditions
Tests / Cross build Linux (push) Blocked by required conditions
Tests / CIFuzz (push) Blocked by required conditions
Tests / All required checks pass (push) Blocked by required conditions
Lint / lint (push) Waiting to run
mypy / Run mypy on Lib/_pyrepl (push) Waiting to run
mypy / Run mypy on Lib/test/libregrtest (push) Waiting to run
mypy / Run mypy on Lib/tomllib (push) Waiting to run
mypy / Run mypy on Tools/build (push) Waiting to run
mypy / Run mypy on Tools/cases_generator (push) Waiting to run
mypy / Run mypy on Tools/clinic (push) Waiting to run
mypy / Run mypy on Tools/jit (push) Waiting to run
mypy / Run mypy on Tools/peg_generator (push) Waiting to run

* gh-134632: Fix `build-details.json` to use `INCLUDEPY` path

Fix ``build-details.json`` generation to use ``INCLUDEPY``, in order to
reference the ``pythonX.Y`` subdirectory of the include directory, as
required in :pep:`739`, instead of the top-level include directory.

* test_build_details: Add tests for the c_api section

* test_build_details: Expect pkgconfig for CPython unconditionally
This commit is contained in:
Michał Górny 2025-06-17 10:05:04 +02:00 committed by GitHub
parent c51f241c97
commit 0d582def34
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 2 deletions

View file

@ -123,6 +123,13 @@ class CPythonBuildDetailsTests(unittest.TestCase, FormatTestsBase):
self.assertEqual(os.path.realpath(value), os.path.realpath(sys.executable))
@needs_installed_python
def test_c_api(self):
value = self.key('c_api')
self.assertTrue(os.path.exists(os.path.join(value['headers'], 'Python.h')))
version = sysconfig.get_config_var('VERSION')
self.assertTrue(os.path.exists(os.path.join(value['pkgconfig_path'], f'python-{version}.pc')))
if __name__ == '__main__':
unittest.main()

View file

@ -0,0 +1,3 @@
Fixed ``build-details.json`` generation to use ``INCLUDEPY``, in order to
reference the ``pythonX.Y`` subdirectory of the include directory, as
required in :pep:`739`, instead of the top-level include directory.

View file

@ -75,7 +75,7 @@ def generate_data(schema_version: str) -> collections.defaultdict[str, Any]:
PY3LIBRARY = sysconfig.get_config_var('PY3LIBRARY')
LIBPYTHON = sysconfig.get_config_var('LIBPYTHON')
LIBPC = sysconfig.get_config_var('LIBPC')
INCLUDEDIR = sysconfig.get_config_var('INCLUDEDIR')
INCLUDEPY = sysconfig.get_config_var('INCLUDEPY')
if os.name == 'posix':
# On POSIX, LIBRARY is always the static library, while LDLIBRARY is the
@ -123,7 +123,7 @@ def generate_data(schema_version: str) -> collections.defaultdict[str, Any]:
if has_static_library:
data['libpython']['static'] = os.path.join(LIBDIR, LIBRARY)
data['c_api']['headers'] = INCLUDEDIR
data['c_api']['headers'] = INCLUDEPY
if LIBPC:
data['c_api']['pkgconfig_path'] = LIBPC