Skip to content

Commit 872ef8d

Browse files
committed
bpo-44062: Fix PYTHON_FOR_BUILD interpreter lookup for cross-compile builds
Previously, when running configure in a cross-compile scenario, the PYTHON_FOR_BUILD interpreter could be set to python even if no python is availble in PATH. Now, configure will properly set PYTHON_FOR_BUILD based on what is available in PATH or fail.
1 parent 31aa0db commit 872ef8d

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

configure

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2997,12 +2997,11 @@ if test "$cross_compiling" = yes; then
29972997
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for python interpreter for cross build" >&5
29982998
$as_echo_n "checking for python interpreter for cross build... " >&6; }
29992999
if test -z "$PYTHON_FOR_BUILD"; then
3000-
for interp in python$PACKAGE_VERSION python3 python; do
3000+
for interp in python$PACKAGE_VERSION python3 python ''; do
30013001
which $interp >/dev/null 2>&1 || continue
30023002
if $interp -c "import sys;sys.exit(not '.'.join(str(n) for n in sys.version_info[:2]) == '$PACKAGE_VERSION')"; then
30033003
break
30043004
fi
3005-
interp=
30063005
done
30073006
if test x$interp = x; then
30083007
as_fn_error $? "python$PACKAGE_VERSION interpreter not found" "$LINENO" 5

configure.ac

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,11 @@ AC_SUBST(PYTHON_FOR_REGEN)
7171
if test "$cross_compiling" = yes; then
7272
AC_MSG_CHECKING([for python interpreter for cross build])
7373
if test -z "$PYTHON_FOR_BUILD"; then
74-
for interp in python$PACKAGE_VERSION python3 python; do
74+
for interp in python$PACKAGE_VERSION python3 python ''; do
7575
which $interp >/dev/null 2>&1 || continue
7676
if $interp -c "import sys;sys.exit(not '.'.join(str(n) for n in sys.version_info@<:@:2@:>@) == '$PACKAGE_VERSION')"; then
7777
break
7878
fi
79-
interp=
8079
done
8180
if test x$interp = x; then
8281
AC_MSG_ERROR([python$PACKAGE_VERSION interpreter not found])

0 commit comments

Comments
 (0)