gh-84461: Fix circulare dependency on BUILDPYTHON (GH-93977)

(cherry picked from commit 084023ccbe)

Co-authored-by: Christian Heimes <christian@python.org>
This commit is contained in:
Miss Islington (bot) 2022-06-18 01:56:25 -07:00 committed by GitHub
parent 79d22694f2
commit 753fe41418
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 4 deletions

View file

@ -290,8 +290,11 @@ HOSTRUNNER= @HOSTRUNNER@
PYTHON_FOR_REGEN?=@PYTHON_FOR_REGEN@ PYTHON_FOR_REGEN?=@PYTHON_FOR_REGEN@
UPDATE_FILE=$(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/update_file.py UPDATE_FILE=$(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/update_file.py
PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@ PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@
# Single-platform builds depend on $(BUILDPYTHON). Cross builds use an
# external "build Python" and have an empty PYTHON_FOR_BUILD_DEPS.
PYTHON_FOR_BUILD_DEPS=@PYTHON_FOR_BUILD_DEPS@
# Normal builds use Programs/_freeze_module.c for bootstrapping and # Single-platform builds use Programs/_freeze_module.c for bootstrapping and
# ./_bootstrap_python Programs/_freeze_module.py for remaining modules # ./_bootstrap_python Programs/_freeze_module.py for remaining modules
# Cross builds use an external "build Python" for all modules. # Cross builds use an external "build Python" for all modules.
PYTHON_FOR_FREEZE=@PYTHON_FOR_FREEZE@ PYTHON_FOR_FREEZE=@PYTHON_FOR_FREEZE@
@ -700,7 +703,7 @@ clinic: check-clean-src $(srcdir)/Modules/_blake2/blake2s_impl.c
$(BUILDPYTHON): Programs/python.o $(LINK_PYTHON_DEPS) $(BUILDPYTHON): Programs/python.o $(LINK_PYTHON_DEPS)
$(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(LINK_PYTHON_OBJS) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(LINK_PYTHON_OBJS) $(LIBS) $(MODLIBS) $(SYSLIBS)
platform: $(BUILDPYTHON) pybuilddir.txt platform: $(PYTHON_FOR_BUILD_DEPS) pybuilddir.txt
$(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import sys ; from sysconfig import get_platform ; print("%s-%d.%d" % (get_platform(), *sys.version_info[:2]))' >platform $(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import sys ; from sysconfig import get_platform ; print("%s-%d.%d" % (get_platform(), *sys.version_info[:2]))' >platform
# Create build directory and generate the sysconfig build-time data there. # Create build directory and generate the sysconfig build-time data there.
@ -710,7 +713,7 @@ platform: $(BUILDPYTHON) pybuilddir.txt
# problems by creating a dummy pybuilddir.txt just to allow interpreter # problems by creating a dummy pybuilddir.txt just to allow interpreter
# initialization to succeed. It will be overwritten by generate-posix-vars # initialization to succeed. It will be overwritten by generate-posix-vars
# or removed in case of failure. # or removed in case of failure.
pybuilddir.txt: $(BUILDPYTHON) pybuilddir.txt: $(PYTHON_FOR_BUILD_DEPS)
@echo "none" > ./pybuilddir.txt @echo "none" > ./pybuilddir.txt
$(RUNSHARED) $(PYTHON_FOR_BUILD) -S -m sysconfig --generate-posix-vars ;\ $(RUNSHARED) $(PYTHON_FOR_BUILD) -S -m sysconfig --generate-posix-vars ;\
if test $$? -ne 0 ; then \ if test $$? -ne 0 ; then \
@ -729,7 +732,7 @@ $(srcdir)/Modules/_blake2/blake2s_impl.c: $(srcdir)/Modules/_blake2/blake2b_impl
# -s, --silent or --quiet is always the first char. # -s, --silent or --quiet is always the first char.
# Under BSD make, MAKEFLAGS might be " -s -v x=y". # Under BSD make, MAKEFLAGS might be " -s -v x=y".
# Ignore macros passed by GNU make, passed after -- # Ignore macros passed by GNU make, passed after --
sharedmods: $(BUILDPYTHON) pybuilddir.txt @LIBMPDEC_INTERNAL@ @LIBEXPAT_INTERNAL@ sharedmods: $(PYTHON_FOR_BUILD_DEPS) pybuilddir.txt @LIBMPDEC_INTERNAL@ @LIBEXPAT_INTERNAL@
@case "`echo X $$MAKEFLAGS | sed 's/^X //;s/ -- .*//'`" in \ @case "`echo X $$MAKEFLAGS | sed 's/^X //;s/ -- .*//'`" in \
*\ -s*|s*) quiet="-q";; \ *\ -s*|s*) quiet="-q";; \
*) quiet="";; \ *) quiet="";; \

4
configure generated vendored
View file

@ -949,6 +949,7 @@ CONFIG_ARGS
SOVERSION SOVERSION
VERSION VERSION
PYTHON_FOR_REGEN PYTHON_FOR_REGEN
PYTHON_FOR_BUILD_DEPS
FREEZE_MODULE_DEPS FREEZE_MODULE_DEPS
FREEZE_MODULE FREEZE_MODULE
FREEZE_MODULE_BOOTSTRAP_DEPS FREEZE_MODULE_BOOTSTRAP_DEPS
@ -3282,6 +3283,7 @@ if test "x$cross_compiling" = xyes; then :
FREEZE_MODULE_BOOTSTRAP_DEPS='$(srcdir)/Programs/_freeze_module.py' FREEZE_MODULE_BOOTSTRAP_DEPS='$(srcdir)/Programs/_freeze_module.py'
FREEZE_MODULE='$(FREEZE_MODULE_BOOTSTRAP)' FREEZE_MODULE='$(FREEZE_MODULE_BOOTSTRAP)'
FREEZE_MODULE_DEPS='$(FREEZE_MODULE_BOOTSTRAP_DEPS)' FREEZE_MODULE_DEPS='$(FREEZE_MODULE_BOOTSTRAP_DEPS)'
PYTHON_FOR_BUILD_DEPS=''
else else
@ -3289,6 +3291,7 @@ else
FREEZE_MODULE_BOOTSTRAP_DEPS="Programs/_freeze_module" FREEZE_MODULE_BOOTSTRAP_DEPS="Programs/_freeze_module"
FREEZE_MODULE='$(PYTHON_FOR_FREEZE) $(srcdir)/Programs/_freeze_module.py' FREEZE_MODULE='$(PYTHON_FOR_FREEZE) $(srcdir)/Programs/_freeze_module.py'
FREEZE_MODULE_DEPS="_bootstrap_python \$(srcdir)/Programs/_freeze_module.py" FREEZE_MODULE_DEPS="_bootstrap_python \$(srcdir)/Programs/_freeze_module.py"
PYTHON_FOR_BUILD_DEPS='$(BUILDPYTHON)'
fi fi
@ -3297,6 +3300,7 @@ fi
for ac_prog in python$PACKAGE_VERSION python3.10 python3.9 python3.8 python3.7 python3.6 python3 python for ac_prog in python$PACKAGE_VERSION python3.10 python3.9 python3.8 python3.7 python3.6 python3 python
do do
# Extract the first word of "$ac_prog", so it can be a program name with args. # Extract the first word of "$ac_prog", so it can be a program name with args.

View file

@ -143,6 +143,7 @@ AS_VAR_IF([cross_compiling], [yes],
FREEZE_MODULE_BOOTSTRAP_DEPS='$(srcdir)/Programs/_freeze_module.py' FREEZE_MODULE_BOOTSTRAP_DEPS='$(srcdir)/Programs/_freeze_module.py'
FREEZE_MODULE='$(FREEZE_MODULE_BOOTSTRAP)' FREEZE_MODULE='$(FREEZE_MODULE_BOOTSTRAP)'
FREEZE_MODULE_DEPS='$(FREEZE_MODULE_BOOTSTRAP_DEPS)' FREEZE_MODULE_DEPS='$(FREEZE_MODULE_BOOTSTRAP_DEPS)'
PYTHON_FOR_BUILD_DEPS=''
], ],
[ [
dnl internal build tools also depend on Programs/_freeze_module and _bootstrap_python. dnl internal build tools also depend on Programs/_freeze_module and _bootstrap_python.
@ -150,12 +151,14 @@ AS_VAR_IF([cross_compiling], [yes],
FREEZE_MODULE_BOOTSTRAP_DEPS="Programs/_freeze_module" FREEZE_MODULE_BOOTSTRAP_DEPS="Programs/_freeze_module"
FREEZE_MODULE='$(PYTHON_FOR_FREEZE) $(srcdir)/Programs/_freeze_module.py' FREEZE_MODULE='$(PYTHON_FOR_FREEZE) $(srcdir)/Programs/_freeze_module.py'
FREEZE_MODULE_DEPS="_bootstrap_python \$(srcdir)/Programs/_freeze_module.py" FREEZE_MODULE_DEPS="_bootstrap_python \$(srcdir)/Programs/_freeze_module.py"
PYTHON_FOR_BUILD_DEPS='$(BUILDPYTHON)'
] ]
) )
AC_SUBST([FREEZE_MODULE_BOOTSTRAP]) AC_SUBST([FREEZE_MODULE_BOOTSTRAP])
AC_SUBST([FREEZE_MODULE_BOOTSTRAP_DEPS]) AC_SUBST([FREEZE_MODULE_BOOTSTRAP_DEPS])
AC_SUBST([FREEZE_MODULE]) AC_SUBST([FREEZE_MODULE])
AC_SUBST([FREEZE_MODULE_DEPS]) AC_SUBST([FREEZE_MODULE_DEPS])
AC_SUBST([PYTHON_FOR_BUILD_DEPS])
AC_CHECK_PROGS([PYTHON_FOR_REGEN], AC_CHECK_PROGS([PYTHON_FOR_REGEN],
[python$PACKAGE_VERSION python3.10 python3.9 python3.8 python3.7 python3.6 python3 python], [python$PACKAGE_VERSION python3.10 python3.9 python3.8 python3.7 python3.6 python3 python],