Skip to content

Commit 084023c

Browse files
authored
gh-84461: Fix circulare dependency on BUILDPYTHON (GH-93977)
1 parent b96d56d commit 084023c

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

Makefile.pre.in

+7-4
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,11 @@ HOSTRUNNER= @HOSTRUNNER@
290290
PYTHON_FOR_REGEN?=@PYTHON_FOR_REGEN@
291291
UPDATE_FILE=$(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/update_file.py
292292
PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@
293+
# Single-platform builds depend on $(BUILDPYTHON). Cross builds use an
294+
# external "build Python" and have an empty PYTHON_FOR_BUILD_DEPS.
295+
PYTHON_FOR_BUILD_DEPS=@PYTHON_FOR_BUILD_DEPS@
293296

294-
# Normal builds use Programs/_freeze_module.c for bootstrapping and
297+
# Single-platform builds use Programs/_freeze_module.c for bootstrapping and
295298
# ./_bootstrap_python Programs/_freeze_module.py for remaining modules
296299
# Cross builds use an external "build Python" for all modules.
297300
PYTHON_FOR_FREEZE=@PYTHON_FOR_FREEZE@
@@ -700,7 +703,7 @@ clinic: check-clean-src $(srcdir)/Modules/_blake2/blake2s_impl.c
700703
$(BUILDPYTHON): Programs/python.o $(LINK_PYTHON_DEPS)
701704
$(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(LINK_PYTHON_OBJS) $(LIBS) $(MODLIBS) $(SYSLIBS)
702705

703-
platform: $(BUILDPYTHON) pybuilddir.txt
706+
platform: $(PYTHON_FOR_BUILD_DEPS) pybuilddir.txt
704707
$(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import sys ; from sysconfig import get_platform ; print("%s-%d.%d" % (get_platform(), *sys.version_info[:2]))' >platform
705708

706709
# Create build directory and generate the sysconfig build-time data there.
@@ -710,7 +713,7 @@ platform: $(BUILDPYTHON) pybuilddir.txt
710713
# problems by creating a dummy pybuilddir.txt just to allow interpreter
711714
# initialization to succeed. It will be overwritten by generate-posix-vars
712715
# or removed in case of failure.
713-
pybuilddir.txt: $(BUILDPYTHON)
716+
pybuilddir.txt: $(PYTHON_FOR_BUILD_DEPS)
714717
@echo "none" > ./pybuilddir.txt
715718
$(RUNSHARED) $(PYTHON_FOR_BUILD) -S -m sysconfig --generate-posix-vars ;\
716719
if test $$? -ne 0 ; then \
@@ -729,7 +732,7 @@ $(srcdir)/Modules/_blake2/blake2s_impl.c: $(srcdir)/Modules/_blake2/blake2b_impl
729732
# -s, --silent or --quiet is always the first char.
730733
# Under BSD make, MAKEFLAGS might be " -s -v x=y".
731734
# Ignore macros passed by GNU make, passed after --
732-
sharedmods: $(BUILDPYTHON) pybuilddir.txt @LIBMPDEC_INTERNAL@ @LIBEXPAT_INTERNAL@
735+
sharedmods: $(PYTHON_FOR_BUILD_DEPS) pybuilddir.txt @LIBMPDEC_INTERNAL@ @LIBEXPAT_INTERNAL@
733736
@case "`echo X $$MAKEFLAGS | sed 's/^X //;s/ -- .*//'`" in \
734737
*\ -s*|s*) quiet="-q";; \
735738
*) quiet="";; \

configure

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

+3
Original file line numberDiff line numberDiff line change
@@ -143,19 +143,22 @@ AS_VAR_IF([cross_compiling], [yes],
143143
FREEZE_MODULE_BOOTSTRAP_DEPS='$(srcdir)/Programs/_freeze_module.py'
144144
FREEZE_MODULE='$(FREEZE_MODULE_BOOTSTRAP)'
145145
FREEZE_MODULE_DEPS='$(FREEZE_MODULE_BOOTSTRAP_DEPS)'
146+
PYTHON_FOR_BUILD_DEPS=''
146147
],
147148
[
148149
dnl internal build tools also depend on Programs/_freeze_module and _bootstrap_python.
149150
FREEZE_MODULE_BOOTSTRAP='./Programs/_freeze_module'
150151
FREEZE_MODULE_BOOTSTRAP_DEPS="Programs/_freeze_module"
151152
FREEZE_MODULE='$(PYTHON_FOR_FREEZE) $(srcdir)/Programs/_freeze_module.py'
152153
FREEZE_MODULE_DEPS="_bootstrap_python \$(srcdir)/Programs/_freeze_module.py"
154+
PYTHON_FOR_BUILD_DEPS='$(BUILDPYTHON)'
153155
]
154156
)
155157
AC_SUBST([FREEZE_MODULE_BOOTSTRAP])
156158
AC_SUBST([FREEZE_MODULE_BOOTSTRAP_DEPS])
157159
AC_SUBST([FREEZE_MODULE])
158160
AC_SUBST([FREEZE_MODULE_DEPS])
161+
AC_SUBST([PYTHON_FOR_BUILD_DEPS])
159162

160163
AC_CHECK_PROGS([PYTHON_FOR_REGEN],
161164
[python$PACKAGE_VERSION python3.10 python3.9 python3.8 python3.7 python3.6 python3 python],

0 commit comments

Comments
 (0)