Skip to content

Commit 91c4c6b

Browse files
itamarozaniebclaudekushaldas
authored
gh-140266: Only pass _PYTHON_HOST_PLATFORM when cross compiling (#161530)
configure sets _PYTHON_HOST_PLATFORM only for cross builds, but passed it to the build Python for every --with-build-python build. In a native build it was empty, so sysconfig.get_platform() returned "" and build-details.json ended up with "platform": "". Co-authored-by: Zanie Blue <contact@zanie.dev> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> Co-authored-by: Kushal Das <mail@kushaldas.in>
1 parent 3d248a2 commit 91c4c6b

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fix ``"platform": ""`` in ``build-details.json`` for native builds configured
2+
with :option:`--with-build-python`: :envvar:`!_PYTHON_HOST_PLATFORM` is now
3+
only passed to the build interpreter when cross compiling.

‎configure‎

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎configure.ac‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,11 @@ AC_ARG_WITH([build-python],
170170
dnl Build Python interpreter is used for regeneration and freezing.
171171
ac_cv_prog_PYTHON_FOR_REGEN=$with_build_python
172172
PYTHON_FOR_FREEZE="$with_build_python"
173-
PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(srcdir)/Lib _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH) _PYTHON_SYSCONFIGDATA_PATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`) '$with_build_python
173+
PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) PYTHONPATH=$(srcdir)/Lib _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH) _PYTHON_SYSCONFIGDATA_PATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`) '$with_build_python
174+
dnl _PYTHON_HOST_PLATFORM is only set when cross compiling.
175+
AS_VAR_IF([cross_compiling], [yes],
176+
[PYTHON_FOR_BUILD='_PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) '"$PYTHON_FOR_BUILD"]
177+
)
174178
AC_MSG_RESULT([$with_build_python])
175179
], [
176180
AS_VAR_IF([cross_compiling], [yes],

0 commit comments

Comments
 (0)