Skip to content

Commit d2e1934

Browse files
committed
unix: write out a Makefile for each supported Python build
In preparation for adding Python version dependent settings to each Makefile. As part of this, we remove the cpython- prefix from the supported versions because this config file is already specific to cpython.
1 parent d249243 commit d2e1934

File tree

4 files changed

+42
-39
lines changed

4 files changed

+42
-39
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.$(TARGET_TRIPLE)
49+
include $(OUTDIR)/Makefile.$(TARGET_TRIPLE).$(PYBUILD_PYTHON_MAJOR_VERSION)
5050
include $(OUTDIR)/versions/VERSION.*
5151

5252
BASE_TOOLCHAIN_DEPENDS := \

cpython-unix/build-main.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,12 @@ def main():
9797

9898
settings = get_target_settings(TARGETS_CONFIG, target_triple)
9999

100-
if args.python not in settings["pythons_supported"]:
100+
supported_pythons = {"cpython-%s" % p for p in settings["pythons_supported"]}
101+
102+
if args.python not in supported_pythons:
101103
print(
102104
"%s only supports following Pythons: %s"
103-
% (target_triple, ", ".join(settings["pythons_supported"]))
105+
% (target_triple, ", ".join(supported_pythons))
104106
)
105107
return 1
106108

cpython-unix/targets.yml

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ aarch64-apple-darwin:
5353
host_platforms:
5454
- darwin
5555
pythons_supported:
56-
- 'cpython-3.9'
56+
- '3.9'
5757
needs_toolchain: true
5858
host_cc: clang
5959
target_cc: clang
@@ -94,7 +94,7 @@ aarch64-apple-ios:
9494
host_platforms:
9595
- darwin
9696
pythons_supported:
97-
- 'cpython-3.9'
97+
- '3.9'
9898
needs_toolchain: true
9999
apple_sdk_platform: iphoneos
100100
host_cc: clang
@@ -129,7 +129,7 @@ aarch64-unknown-linux-gnu:
129129
host_platforms:
130130
- linux
131131
pythons_supported:
132-
- 'cpython-3.9'
132+
- '3.9'
133133
docker_image_suffix: .cross
134134
host_cc: /usr/bin/x86_64-linux-gnu-gcc
135135
target_cc: /usr/bin/aarch64-linux-gnu-gcc
@@ -159,7 +159,7 @@ arm64-apple-tvos:
159159
host_platforms:
160160
- darwin
161161
pythons_supported:
162-
- 'cpython-3.9'
162+
- '3.9'
163163
needs_toolchain: true
164164
apple_sdk_platform: appletvos
165165
host_cc: clang
@@ -193,7 +193,7 @@ armv7-unknown-linux-gnueabi:
193193
host_platforms:
194194
- linux
195195
pythons_supported:
196-
- 'cpython-3.9'
196+
- '3.9'
197197
docker_image_suffix: .cross
198198
host_cc: /usr/bin/x86_64-linux-gnu-gcc
199199
target_cc: /usr/bin/arm-linux-gnueabi-gcc
@@ -223,7 +223,7 @@ armv7-unknown-linux-gnueabihf:
223223
host_platforms:
224224
- linux
225225
pythons_supported:
226-
- 'cpython-3.9'
226+
- '3.9'
227227
docker_image_suffix: .cross
228228
host_cc: /usr/bin/x86_64-linux-gnu-gcc
229229
target_cc: /usr/bin/arm-linux-gnueabihf-gcc
@@ -253,9 +253,9 @@ i686-unknown-linux-gnu:
253253
host_platforms:
254254
- linux
255255
pythons_supported:
256-
- 'cpython-3.8'
257-
- 'cpython-3.9'
258-
- 'cpython-3.10'
256+
- '3.8'
257+
- '3.9'
258+
- '3.10'
259259
needs_toolchain: true
260260
host_cc: clang
261261
target_cc: clang
@@ -291,7 +291,7 @@ mips-unknown-linux-gnu:
291291
host_platforms:
292292
- linux
293293
pythons_supported:
294-
- 'cpython-3.9'
294+
- '3.9'
295295
docker_image_suffix: .cross
296296
host_cc: /usr/bin/x86_64-linux-gnu-gcc
297297
target_cc: /usr/bin/mips-linux-gnu-gcc
@@ -321,7 +321,7 @@ mipsel-unknown-linux-gnu:
321321
host_platforms:
322322
- linux
323323
pythons_supported:
324-
- 'cpython-3.9'
324+
- '3.9'
325325
docker_image_suffix: .cross
326326
host_cc: /usr/bin/x86_64-linux-gnu-gcc
327327
target_cc: /usr/bin/mipsel-linux-gnu-gcc
@@ -351,7 +351,7 @@ s390x-unknown-linux-gnu:
351351
host_platforms:
352352
- linux
353353
pythons_supported:
354-
- 'cpython-3.9'
354+
- '3.9'
355355
docker_image_suffix: .cross
356356
host_cc: /usr/bin/x86_64-linux-gnu-gcc
357357
target_cc: /usr/bin/s390x-linux-gnu-gcc
@@ -381,7 +381,7 @@ thumb7k-apple-watchos:
381381
host_platforms:
382382
- darwin
383383
pythons_supported:
384-
- 'cpython-3.9'
384+
- '3.9'
385385
needs_toolchain: true
386386
apple_sdk_platform: watchos
387387
host_cc: clang
@@ -419,8 +419,8 @@ x86_64-apple-darwin:
419419
host_platforms:
420420
- darwin
421421
pythons_supported:
422-
- 'cpython-3.8'
423-
- 'cpython-3.9'
422+
- '3.8'
423+
- '3.9'
424424
needs_toolchain: true
425425
apple_sdk_platform: macosx
426426
host_cc: clang
@@ -461,7 +461,7 @@ x86_64-apple-ios:
461461
host_platforms:
462462
- darwin
463463
pythons_supported:
464-
- 'cpython-3.9'
464+
- '3.9'
465465
needs_toolchain: true
466466
apple_sdk_platform: iphonesimulator
467467
host_cc: clang
@@ -496,7 +496,7 @@ x86_64-apple-tvos:
496496
host_platforms:
497497
- darwin
498498
pythons_supported:
499-
- 'cpython-3.9'
499+
- '3.9'
500500
needs_toolchain: true
501501
apple_sdk_platform: appletvsimulator
502502
host_cc: clang
@@ -529,7 +529,7 @@ x86_64-apple-watchos:
529529
host_platforms:
530530
- darwin
531531
pythons_supported:
532-
- 'cpython-3.9'
532+
- '3.9'
533533
needs_toolchain: true
534534
apple_sdk_platform: watchsimulator
535535
host_cc: clang
@@ -563,9 +563,9 @@ x86_64-unknown-linux-gnu:
563563
host_platforms:
564564
- linux
565565
pythons_supported:
566-
- 'cpython-3.8'
567-
- 'cpython-3.9'
568-
- 'cpython-3.10'
566+
- '3.8'
567+
- '3.9'
568+
- '3.10'
569569
needs_toolchain: true
570570
host_cc: clang
571571
target_cc: clang
@@ -596,9 +596,9 @@ x86_64-unknown-linux-musl:
596596
host_platforms:
597597
- linux
598598
pythons_supported:
599-
- 'cpython-3.8'
600-
- 'cpython-3.9'
601-
- 'cpython-3.10'
599+
- '3.8'
600+
- '3.9'
601+
- '3.10'
602602
needs_toolchain: true
603603
host_cc: clang
604604
target_cc: musl-clang

pythonbuild/utils.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -130,23 +130,24 @@ def write_triples_makefiles(targets, dest_dir: pathlib.Path):
130130
dest_dir.mkdir(parents=True, exist_ok=True)
131131

132132
for triple, settings in targets.items():
133-
makefile_path = dest_dir / ("Makefile.%s" % triple)
133+
for python in settings["pythons_supported"]:
134+
makefile_path = dest_dir / ("Makefile.%s.%s" % (triple, python))
134135

135-
lines = []
136-
for need in settings.get("needs", []):
137-
lines.append("NEED_%s := 1\n" % need.upper())
136+
lines = []
137+
for need in settings.get("needs", []):
138+
lines.append("NEED_%s := 1\n" % need.upper())
138139

139-
if "PYBUILD_LIBRESSL" in os.environ:
140-
lines.append("NEED_LIBRESSL := 1\n")
141-
else:
142-
lines.append("NEED_OPENSSL := 1\n")
140+
if "PYBUILD_LIBRESSL" in os.environ:
141+
lines.append("NEED_LIBRESSL := 1\n")
142+
else:
143+
lines.append("NEED_OPENSSL := 1\n")
143144

144-
image_suffix = settings.get("docker_image_suffix", "")
145+
image_suffix = settings.get("docker_image_suffix", "")
145146

146-
lines.append("DOCKER_IMAGE_BUILD := build%s\n" % image_suffix)
147-
lines.append("DOCKER_IMAGE_XCB := xcb%s\n" % image_suffix)
147+
lines.append("DOCKER_IMAGE_BUILD := build%s\n" % image_suffix)
148+
lines.append("DOCKER_IMAGE_XCB := xcb%s\n" % image_suffix)
148149

149-
write_if_different(makefile_path, "".join(lines).encode("ascii"))
150+
write_if_different(makefile_path, "".join(lines).encode("ascii"))
150151

151152

152153
def write_package_versions(dest_path: pathlib.Path):

0 commit comments

Comments
 (0)