Skip to content

Commit 697f695

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 47e79e0 commit 697f695

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
@@ -141,35 +141,31 @@ def write_triples_makefiles(
141141

142142
for triple, settings in targets.items():
143143
for host_platform in settings["host_platforms"]:
144-
for python in settings["pythons_supported"]:
145-
makefile_path = dest_dir / (
146-
"Makefile.%s.%s.%s" % (host_platform, triple, python)
147-
)
144+
makefile_path = dest_dir / ("Makefile.%s.%s" % (host_platform, triple))
148145

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

156-
image_suffix = settings.get("docker_image_suffix", "")
152+
image_suffix = settings.get("docker_image_suffix", "")
157153

158-
lines.append("DOCKER_IMAGE_BUILD := build%s\n" % image_suffix)
159-
lines.append("DOCKER_IMAGE_XCB := xcb%s\n" % image_suffix)
154+
lines.append("DOCKER_IMAGE_BUILD := build%s\n" % image_suffix)
155+
lines.append("DOCKER_IMAGE_XCB := xcb%s\n" % image_suffix)
160156

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

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

172-
write_if_different(makefile_path, "".join(lines).encode("ascii"))
168+
write_if_different(makefile_path, "".join(lines).encode("ascii"))
173169

174170

175171
def write_package_versions(dest_path: pathlib.Path):

0 commit comments

Comments
 (0)