diff --git a/Misc/NEWS.d/next/Build/2021-08-09-21-05-16.bpo-44062._FgDh-.rst b/Misc/NEWS.d/next/Build/2021-08-09-21-05-16.bpo-44062._FgDh-.rst new file mode 100644 index 00000000000000..1a3898d1d1ab8f --- /dev/null +++ b/Misc/NEWS.d/next/Build/2021-08-09-21-05-16.bpo-44062._FgDh-.rst @@ -0,0 +1 @@ +Fail appropriately in cross-compile scenarios if no proper python interpreter is found in PATH. \ No newline at end of file diff --git a/configure b/configure index 1756d25d16fa47..f62dca47ef13b2 100755 --- a/configure +++ b/configure @@ -2997,12 +2997,11 @@ if test "$cross_compiling" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for python interpreter for cross build" >&5 $as_echo_n "checking for python interpreter for cross build... " >&6; } if test -z "$PYTHON_FOR_BUILD"; then - for interp in python$PACKAGE_VERSION python3 python; do + for interp in python$PACKAGE_VERSION python3 python ''; do which $interp >/dev/null 2>&1 || continue if $interp -c "import sys;sys.exit(not '.'.join(str(n) for n in sys.version_info[:2]) == '$PACKAGE_VERSION')"; then break fi - interp= done if test x$interp = x; then as_fn_error $? "python$PACKAGE_VERSION interpreter not found" "$LINENO" 5 diff --git a/configure.ac b/configure.ac index 2f792aa60ee40f..bc358e4dfe3d9e 100644 --- a/configure.ac +++ b/configure.ac @@ -71,12 +71,11 @@ AC_SUBST(PYTHON_FOR_REGEN) if test "$cross_compiling" = yes; then AC_MSG_CHECKING([for python interpreter for cross build]) if test -z "$PYTHON_FOR_BUILD"; then - for interp in python$PACKAGE_VERSION python3 python; do + for interp in python$PACKAGE_VERSION python3 python ''; do which $interp >/dev/null 2>&1 || continue if $interp -c "import sys;sys.exit(not '.'.join(str(n) for n in sys.version_info@<:@:2@:>@) == '$PACKAGE_VERSION')"; then break fi - interp= done if test x$interp = x; then AC_MSG_ERROR([python$PACKAGE_VERSION interpreter not found])