Skip to content

Commit d33b1fc

Browse files
committed
unix: store required extensions in per-platform files
1 parent 3379ae5 commit d33b1fc

File tree

4 files changed

+25
-14
lines changed

4 files changed

+25
-14
lines changed

cpython-unix/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ PYTHON_DEPENDS := \
236236
$(OUTDIR)/xz-$(XZ_VERSION)-$(PLATFORM).tar \
237237
$(OUTDIR)/zlib-$(ZLIB_VERSION)-$(PLATFORM).tar \
238238
$(HERE)/disabled-static-modules.$(BASE_PLATFORM) \
239+
$(HERE)/required-extensions.$(BASE_PLATFORM) \
239240
$(HERE)/static-modules.$(BASE_PLATFORM) \
240241
$(NULL)
241242

cpython-unix/build.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,6 @@
3232
MACOSX_DEPLOYMENT_TARGET = "10.9"
3333

3434

35-
REQUIRED_EXTENSIONS = {
36-
"_codecs",
37-
"_io",
38-
"_signal",
39-
"_thread",
40-
"_tracemalloc",
41-
"_weakref",
42-
"faulthandler",
43-
"posix",
44-
}
45-
46-
4735
def add_target_env(env, platform, build_env):
4836
env["PYBUILD_PLATFORM"] = platform
4937
env["NUM_CPUS"] = "%d" % multiprocessing.cpu_count()
@@ -323,7 +311,9 @@ def build_tix(client, image, platform, musl=False):
323311
build_env.get_tools_archive(archive_path("tix", platform, musl=musl), "deps")
324312

325313

326-
def python_build_info(build_env, config_c_in, setup_dist, setup_local, libressl=False):
314+
def python_build_info(
315+
build_env, platform, config_c_in, setup_dist, setup_local, libressl=False
316+
):
327317
"""Obtain build metadata for the Python distribution."""
328318

329319
bi = {"core": {"objs": [], "links": []}, "extensions": {}}
@@ -475,9 +465,12 @@ def process_setup_line(line, variant=None):
475465
}
476466
)
477467

468+
with (SUPPORT / ("required-extensions.%s" % platform)).open("r") as fh:
469+
required_extensions = {l.strip() for l in fh if l.strip()}
470+
478471
for extension, entries in bi["extensions"].items():
479472
for entry in entries:
480-
entry["required"] = extension in REQUIRED_EXTENSIONS
473+
entry["required"] = extension in required_extensions
481474

482475
# Any paths left in modules_objs are not part of any extension and are
483476
# instead part of the core distribution.
@@ -629,6 +622,7 @@ def build_cpython(
629622
"python_stdlib": "install/lib/python%s" % entry["version"][0:3],
630623
"build_info": python_build_info(
631624
build_env,
625+
platform,
632626
config_c_in,
633627
setup_dist_content,
634628
setup_local_content,
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
_codecs
2+
_io
3+
_signal
4+
_thread
5+
_tracemalloc
6+
_weakref
7+
faulthandler
8+
posix
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
_codecs
2+
_io
3+
_signal
4+
_thread
5+
_tracemalloc
6+
_weakref
7+
faulthandler
8+
posix

0 commit comments

Comments
 (0)