Skip to content

Commit 6ca3e90

Browse files
committed
Add abstract python paths and all sysconfig variables to JSON
These seem like useful things to convey to downstream consumers.
1 parent ca9072d commit 6ca3e90

File tree

5 files changed

+29
-3
lines changed

5 files changed

+29
-3
lines changed

cpython-unix/build-cpython.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,9 +455,11 @@ metadata = {
455455
},
456456
"python_bytecode_magic_number": codecs.encode(importlib.util.MAGIC_NUMBER, "hex").decode("ascii"),
457457
"python_paths": {},
458+
"python_paths_abstract": sysconfig.get_paths(expand=False),
458459
"python_exe": "install/bin/python%s%s" % (sysconfig.get_python_version(), sys.abiflags),
459460
"python_major_minor_version": sysconfig.get_python_version(),
460461
"python_stdlib_platform_config": sysconfig.get_config_var("LIBPL").lstrip("/"),
462+
"python_config_vars": {k: str(v) for k, v in sysconfig.get_config_vars().items()},
461463
}
462464
463465
root = os.environ["ROOT"]

cpython-unix/build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ def build_cpython(
775775

776776
# Create PYTHON.json file describing this distribution.
777777
python_info = {
778-
"version": "5",
778+
"version": "6",
779779
"target_triple": target_triple,
780780
"optimizations": optimizations,
781781
"python_tag": entry["python_tag"],

cpython-windows/build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2237,7 +2237,7 @@ def build_cpython(
22372237

22382238
# Create PYTHON.json file describing this distribution.
22392239
python_info = {
2240-
"version": "5",
2240+
"version": "6",
22412241
"target_triple": target_triple,
22422242
"optimizations": optimizations,
22432243
"python_tag": entry["python_tag"],

cpython-windows/generate_metadata.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@
2525
importlib.util.MAGIC_NUMBER, "hex"
2626
).decode("ascii"),
2727
"python_paths": {},
28+
"python_paths_abstract": sysconfig.get_paths(expand=False),
2829
"python_exe": "install/python.exe",
2930
"python_major_minor_version": sysconfig.get_python_version(),
31+
"python_config_vars": {k: str(v) for k, v in sysconfig.get_config_vars().items()},
3032
}
3133

3234
root = os.environ["ROOT"]

docs/distributions.rst

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ without having to resort to heuristics.
3232
The file contains a JSON map. This map has the following keys:
3333

3434
version
35-
Version number of the file format. Currently ``5``.
35+
Version number of the file format. Currently ``6``.
3636

3737
target_triple
3838
A target triple defining the platform and architecture of the machine
@@ -139,6 +139,28 @@ python_paths
139139

140140
(Version 5 or above only.)
141141

142+
python_paths_abstract
143+
Mapping of ``sysconfig`` path names with placeholder values.
144+
145+
See https://docs.python.org/3/library/sysconfig.html#installation-paths
146+
for the meaning of keys.
147+
148+
This is equivalent to calling ``sysconfig.get_paths(expand=False)``.
149+
150+
(Version 6 or above only.)
151+
152+
python_config_vars
153+
Mapping of string configuration names to string values.
154+
155+
This is equivalent to ``sysconfig.get_config_vars()`` with all values
156+
normalized to strings.
157+
158+
Many configuration values may represent state as it existed in the
159+
build environment and aren't appropriate for the run-time environment
160+
on a different system.
161+
162+
(Version 6 or above only.)
163+
142164
python_exe
143165
Relative path to main Python interpreter executable.
144166

0 commit comments

Comments
 (0)