From 872ef8dbbe797b64e6ce8b1b2a2ac53bee72c5f6 Mon Sep 17 00:00:00 2001 From: Vincent Fazio <5265893+vfazio@users.noreply.github.com> Date: Thu, 6 May 2021 14:03:09 -0500 Subject: [PATCH 1/2] 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. --- configure | 3 +-- configure.ac | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) 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]) From 3bffb0bca5d317b3945b109930071bfe0e8ca2e6 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Mon, 9 Aug 2021 21:05:17 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Misc/NEWS.d/next/Build/2021-08-09-21-05-16.bpo-44062._FgDh-.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Build/2021-08-09-21-05-16.bpo-44062._FgDh-.rst 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