Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit745d94f

Browse files
committed
unix: move Python major minor version parsing to Makefile
This is less ergonomic (oh Make). But it will make it easier tobuild multiple Python versions at the same time in a future commit.
1 parentfeea6db commit745d94f

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

‎cpython-unix/Makefile‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ OUTDIR := $(ROOT)/build
44

55
BUILD :=$(HERE)/build.py
66
NULL :=
7+
SPACE :=$(subst ,, )
78

89
ifndefPYBUILD_TARGET_TRIPLE
910
$(error PYBUILD_TARGET_TRIPLE not defined)
@@ -25,9 +26,7 @@ ifndef PYBUILD_PYTHON_VERSION
2526
$(error PYBUILD_PYTHON_VERSION not defined)
2627
endif
2728

28-
ifndefPYBUILD_PYTHON_MAJOR_VERSION
29-
$(error PYBUILD_PYTHON_MAJOR_VERSION not defined)
30-
endif
29+
PYTHON_MAJOR_VERSION :=$(subst$(SPACE),.,$(wordlist 1,2,$(subst .,$(SPACE),$(PYBUILD_PYTHON_VERSION))))
3130

3231
TARGET_TRIPLE :=$(PYBUILD_TARGET_TRIPLE)
3332
HOST_PLATFORM :=$(PYBUILD_HOST_PLATFORM)
@@ -47,7 +46,7 @@ endif
4746

4847
# Always write out settings files.
4948
$(shell $(RUN_BUILD) placeholder_archive makefiles)
50-
include$(OUTDIR)/Makefile.$(HOST_PLATFORM).$(TARGET_TRIPLE).$(PYBUILD_PYTHON_MAJOR_VERSION)
49+
include$(OUTDIR)/Makefile.$(HOST_PLATFORM).$(TARGET_TRIPLE).$(PYTHON_MAJOR_VERSION)
5150
include$(OUTDIR)/versions/VERSION.*
5251

5352
# Always write out expanded Dockerfiles.
@@ -274,7 +273,7 @@ PYTHON_DEPENDS := \
274273
$(PYTHON_SUPPORT_FILES)\
275274
$(OUTDIR)/versions/VERSION.pip\
276275
$(OUTDIR)/versions/VERSION.setuptools\
277-
$(OUTDIR)/cpython-$(PYBUILD_PYTHON_MAJOR_VERSION)-$(PYBUILD_PYTHON_VERSION)-$(HOST_PLATFORM).tar\
276+
$(OUTDIR)/cpython-$(PYTHON_MAJOR_VERSION)-$(PYBUILD_PYTHON_VERSION)-$(HOST_PLATFORM).tar\
278277
$(if$(NEED_AUTOCONF),$(OUTDIR)/autoconf-$(AUTOCONF_VERSION)-$(PACKAGE_SUFFIX).tar)\
279278
$(if$(NEED_BDB),$(OUTDIR)/bdb-$(BDB_VERSION)-$(PACKAGE_SUFFIX).tar)\
280279
$(if$(NEED_BZIP2),$(OUTDIR)/bzip2-$(BZIP2_VERSION)-$(PACKAGE_SUFFIX).tar)\

‎cpython-unix/build-main.py‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,20 +156,18 @@ def main():
156156
return1
157157
cpython_version=env["PYBUILD_PYTHON_VERSION"]
158158

159-
env["PYBUILD_PYTHON_MAJOR_VERSION"]=".".join(cpython_version.split(".")[0:2])
159+
python_majmin=".".join(cpython_version.split(".")[0:2])
160160

161161
if"PYBUILD_RELEASE_TAG"inos.environ:
162162
release_tag=os.environ["PYBUILD_RELEASE_TAG"]
163163
else:
164164
release_tag=release_tag_from_git()
165165

166166
# Guard against accidental misuse of the free-threaded flag with older versions
167-
if"freethreaded"inargs.optionsandenv["PYBUILD_PYTHON_MAJOR_VERSION"]notin (
168-
"3.13"
169-
):
167+
if"freethreaded"inargs.optionsandpython_majminnotin ("3.13",):
170168
print(
171169
"Invalid build option: 'freethreaded' is only compatible with CPython 3.13+ (got %s)"
172-
%env["PYBUILD_PYTHON_MAJOR_VERSION"]
170+
%cpython_version
173171
)
174172
return1
175173

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp