From e4a3942e89dd0e527a767b386e92d341b1a90e51 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Wed, 22 Aug 2018 15:39:01 +0200 Subject: [PATCH] Detect and prefer platform Python A platform Python interpreter is a special variant of the interpreter, that is only used for system software. It's located at /usr/libexec/platform-python. Fixes: https://pagure.io/freeipa/issue/7680 Signed-off-by: Christian Heimes Reviewed-By: Alexander Bokovoy --- configure.ac | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index b8f635f8c..672f5f28b 100644 --- a/configure.ac +++ b/configure.ac @@ -100,11 +100,27 @@ PKG_CHECK_MODULES([CRYPTO], [libcrypto]) dnl --------------------------------------------------------------------------- dnl - Check for Python +dnl - Check for platform Python interpreter dnl - Check for Python 2/3 for devcheck dnl --------------------------------------------------------------------------- +AS_IF([test "x${PYTHON}" != "x"], [ + AC_MSG_NOTICE([Python user override detected, ${PYTHON}]) +]) + +AC_MSG_NOTICE([Checking for platform Python]) +AC_PATH_PROG(PLATFORM_PYTHON, platform-python, [], [/usr/libexec$PATH_SEPARATOR$PATH]) AC_MSG_NOTICE([Checking for Python 3]) -AC_PATH_PROG(PYTHON3, python3) +AC_PATH_PROGS(PYTHON3, python3) + +dnl Only use platform-python when there is no override +if test \( "x${PLATFORM_PYTHON}" != "x" -a "x${PYTHON}" = "x" \); then + dnl platform-python executable detected (it's always Python 3) + AC_MSG_NOTICE([Using platform Python as default Python 3 interpreter]) + PYTHON3=${PLATFORM_PYTHON} + PYTHON=${PLATFORM_PYTHON} +fi + AC_SUBST([PYTHON3]) AM_CONDITIONAL([WITH_PYTHON3], [test "x${PYTHON3}" != "x"]) @@ -123,6 +139,7 @@ elif test "x${PYTHON3}" != "x"; then AM_PATH_PYTHON(3.6) fi + dnl --------------------------------------------------------------------------- dnl - Check for cmocka unit test framework http://cmocka.cryptomilk.org/ dnl ---------------------------------------------------------------------------