Skip to content

Commit 6459214

Browse files
committed
unix: only generate 1 Makefile per build configuration
Previously we generated the same Makefile for every Python version. We can simplify things by only writing 1 Makefile per target configuration.
1 parent a3b2178 commit 6459214

File tree

2 files changed

+20
-24
lines changed

2 files changed

+20
-24
lines changed

cpython-unix/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ endif
4646

4747
# Always write out settings files.
4848
$(shell $(RUN_BUILD) placeholder_archive makefiles)
49-
include $(OUTDIR)/Makefile.$(HOST_PLATFORM).$(TARGET_TRIPLE).$(PYTHON_MAJOR_VERSION)
49+
include $(OUTDIR)/Makefile.$(HOST_PLATFORM).$(TARGET_TRIPLE)
5050
include $(OUTDIR)/versions/VERSION.*
5151

5252
# Always write out expanded Dockerfiles.

pythonbuild/utils.py

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -143,35 +143,31 @@ def write_triples_makefiles(
143143

144144
for triple, settings in targets.items():
145145
for host_platform in settings["host_platforms"]:
146-
for python in settings["pythons_supported"]:
147-
makefile_path = dest_dir / (
148-
"Makefile.%s.%s.%s" % (host_platform, triple, python)
149-
)
146+
makefile_path = dest_dir / ("Makefile.%s.%s" % (host_platform, triple))
150147

151-
lines = []
152-
for need in settings.get("needs", []):
153-
lines.append(
154-
"NEED_%s := 1\n"
155-
% need.upper().replace("-", "_").replace(".", "_")
156-
)
148+
lines = []
149+
for need in settings.get("needs", []):
150+
lines.append(
151+
"NEED_%s := 1\n" % need.upper().replace("-", "_").replace(".", "_")
152+
)
157153

158-
image_suffix = settings.get("docker_image_suffix", "")
154+
image_suffix = settings.get("docker_image_suffix", "")
159155

160-
lines.append("DOCKER_IMAGE_BUILD := build%s\n" % image_suffix)
161-
lines.append("DOCKER_IMAGE_XCB := xcb%s\n" % image_suffix)
156+
lines.append("DOCKER_IMAGE_BUILD := build%s\n" % image_suffix)
157+
lines.append("DOCKER_IMAGE_XCB := xcb%s\n" % image_suffix)
162158

163-
entry = clang_toolchain(host_platform, triple)
164-
lines.append(
165-
"CLANG_FILENAME := %s-%s-%s.tar\n"
166-
% (entry, DOWNLOADS[entry]["version"], host_platform)
167-
)
159+
entry = clang_toolchain(host_platform, triple)
160+
lines.append(
161+
"CLANG_FILENAME := %s-%s-%s.tar\n"
162+
% (entry, DOWNLOADS[entry]["version"], host_platform)
163+
)
168164

169-
lines.append(
170-
"PYTHON_SUPPORT_FILES := $(PYTHON_SUPPORT_FILES) %s\n"
171-
% (support_search_dir / "extension-modules.yml")
172-
)
165+
lines.append(
166+
"PYTHON_SUPPORT_FILES := $(PYTHON_SUPPORT_FILES) %s\n"
167+
% (support_search_dir / "extension-modules.yml")
168+
)
173169

174-
write_if_different(makefile_path, "".join(lines).encode("ascii"))
170+
write_if_different(makefile_path, "".join(lines).encode("ascii"))
175171

176172

177173
def write_package_versions(dest_path: pathlib.Path):

0 commit comments

Comments
 (0)