Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0d582de

Browse files
authored
gh-134632: Fix build-details.json to use INCLUDEPY path (#134633)
* 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
1 parent c51f241 commit 0d582de

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

Lib/test/test_build_details.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,13 @@ def test_base_interpreter(self):
123123

124124
self.assertEqual(os.path.realpath(value), os.path.realpath(sys.executable))
125125

126+
@needs_installed_python
127+
def test_c_api(self):
128+
value = self.key('c_api')
129+
self.assertTrue(os.path.exists(os.path.join(value['headers'], 'Python.h')))
130+
version = sysconfig.get_config_var('VERSION')
131+
self.assertTrue(os.path.exists(os.path.join(value['pkgconfig_path'], f'python-{version}.pc')))
132+
126133

127134
if __name__ == '__main__':
128135
unittest.main()
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fixed ``build-details.json`` generation to use ``INCLUDEPY``, in order to
2+
reference the ``pythonX.Y`` subdirectory of the include directory, as
3+
required in :pep:`739`, instead of the top-level include directory.

Tools/build/generate-build-details.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def generate_data(schema_version: str) -> collections.defaultdict[str, Any]:
7575
PY3LIBRARY = sysconfig.get_config_var('PY3LIBRARY')
7676
LIBPYTHON = sysconfig.get_config_var('LIBPYTHON')
7777
LIBPC = sysconfig.get_config_var('LIBPC')
78-
INCLUDEDIR = sysconfig.get_config_var('INCLUDEDIR')
78+
INCLUDEPY = sysconfig.get_config_var('INCLUDEPY')
7979

8080
if os.name == 'posix':
8181
# 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]:
123123
if has_static_library:
124124
data['libpython']['static'] = os.path.join(LIBDIR, LIBRARY)
125125

126-
data['c_api']['headers'] = INCLUDEDIR
126+
data['c_api']['headers'] = INCLUDEPY
127127
if LIBPC:
128128
data['c_api']['pkgconfig_path'] = LIBPC
129129

0 commit comments

Comments
 (0)