File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 33# SPDX-License-Identifier: MIT
44
55import importlib .machinery
6+ import json
67import os
78import pathlib
89import platform
@@ -36,8 +37,18 @@ def get_abi3_suffix():
3637 return suffix
3738
3839
40+ def get_build_details_json ():
41+ # Technically, this is only applicable to 3.14+, but we account for FileNotFoundError anyway.
42+ try :
43+ with open (pathlib .Path (sysconfig .get_path ('stdlib' )) / 'build-details.json' ) as f :
44+ return json .load (f )
45+ except FileNotFoundError :
46+ return None
47+
48+
3949SUFFIX = sysconfig .get_config_var ('EXT_SUFFIX' )
4050ABI3SUFFIX = get_abi3_suffix ()
51+ BUILD_DETAILS_JSON = get_build_details_json ()
4152
4253
4354def test_wheel_tag ():
@@ -141,3 +152,8 @@ def test_tag_mixed_abi():
141152 }, pure = False , limited_api = True )
142153 with pytest .raises (mesonpy .BuildError , match = 'The package declares compatibility with Python limited API but ' ):
143154 assert str (builder .tag ) == f'{ INTERPRETER } -abi3-{ PLATFORM } '
155+
156+
157+ @pytest .mark .skipif (BUILD_DETAILS_JSON is None , reason = 'No build-details.json for this interpreter' )
158+ def test_system_build_details ():
159+ assert str (mesonpy ._tags .Tag ()) == str (mesonpy ._tags .Tag (build_details = BUILD_DETAILS_JSON ))
You can’t perform that action at this time.
0 commit comments