Skip to content

Commit 54e62e8

Browse files
committed
linux: add a "required" field to extension metadata
So downstream consumers don't need to maintain lists.
1 parent 2cfed9e commit 54e62e8

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

README.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,10 @@ extensions
358358
objs
359359
An array of paths to object files constituting this extension module.
360360

361+
required
362+
Boolean indicating if this extension is required to initialize the Python
363+
interpreter.
364+
361365
static_lib
362366
The path to a static library defining this extension module. May not
363367
be defined.

cpython-linux/build.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,17 @@
3535
LOG_PREFIX = [None]
3636
LOG_FH = [None]
3737

38+
REQUIRED_EXTENSIONS = {
39+
'_codecs',
40+
'_io',
41+
'_signal',
42+
'_thread',
43+
'_tracemalloc',
44+
'_weakref',
45+
'faulthandler',
46+
'posix',
47+
}
48+
3849

3950
def log(msg):
4051
if isinstance(msg, bytes):
@@ -561,6 +572,10 @@ def process_setup_line(line, variant=None):
561572
'variant': 'default',
562573
})
563574

575+
for extension, entries in bi['extensions'].items():
576+
for entry in entries:
577+
entry['required'] = extension in REQUIRED_EXTENSIONS
578+
564579
# Any paths left in modules_objs are not part of any extension and are
565580
# instead part of the core distribution.
566581
for p in sorted(modules_objs):

0 commit comments

Comments
 (0)