diff options
author | ng0 <ng0@n0.is> | 2019-04-24 11:26:34 +0000 |
---|---|---|
committer | ng0 <ng0@n0.is> | 2019-04-24 11:26:34 +0000 |
commit | 0afa59bbd83b0af1b1c15fbfb4de15082fa249a5 (patch) | |
tree | 2ae656c311f68d4d343d41456d7b2921038391a6 | |
parent | 5b4706f8f1720b1e26116fecb369e1364dcfc74d (diff) | |
download | backoffice-0afa59bbd83b0af1b1c15fbfb4de15082fa249a5.tar.gz backoffice-0afa59bbd83b0af1b1c15fbfb4de15082fa249a5.tar.bz2 backoffice-0afa59bbd83b0af1b1c15fbfb4de15082fa249a5.zip |
configure: detect python and python modules in a more reliable way.
-rw-r--r-- | configure.ac | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/configure.ac b/configure.ac index 879c84f..ccd791f 100644 --- a/configure.ac +++ b/configure.ac @@ -14,26 +14,29 @@ pyheaders=0 PC_PYTHON_CHECK_HEADERS([pyheaders=1]) PC_PYTHON_CHECK_VERSION() -# -# Check for pip3 -# -AC_MSG_CHECKING([pip3]) -pip3 --version >/dev/null -if test $? -ne 0; - then - AC_MSG_ERROR([Please install pip3>=6.0]) -fi +# Get python executable name +m4_define_default([_AM_PYTHON_INTERPRETER_LIST],[python3 python3.4 python3.5 python3.6 python3.7 python]) +AM_PATH_PYTHON([3.4],, [:]) +AC_SUBST([PYTHON]) +AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :]) -VERSION=$(pip3 --version | $AWK '{ print $2 }') +# +# Check for pip3 +# Since it is either pip3 or pip[3.4,3.5,3.6,3.7], +# we check using python module loading. +PIP_EXE="$PYTHON -m pip" +PIP_VERSION=$($PIP_EXE -V | grep -v "No module named" | tr -d '\n' | $AWK '{ print $2 }') -AC_MSG_RESULT([$VERSION]) +VERSION=$PIP_VERSION +AC_MSG_RESULT([pip3 version: $VERSION]) AX_COMPARE_VERSION([$VERSION],[lt],[6.0], [AC_MSG_ERROR([Please install pip3>=6.0])]) # On Debian systems, we may need to pass "--system" to pip3 to get # to the desired installation target directory -pip3 install --help | grep '\-\-system' >> /dev/null +AC_MSG_CHECKING([for pip3 --system]) +$PIP_EXE install --help | grep '\-\-system' >> /dev/null if test $? -ne 0; then DEBIAN_PIP3_SYSTEM="" @@ -63,7 +66,7 @@ fi # Check for minifier # AC_MSG_CHECKING([jsmin]) -python3 -m jsmin &> /dev/null +$PYTHON -m jsmin | grep -v "No module named" > /dev/null if test $? -ne 0; then AC_MSG_ERROR([Please install Python3 module 'jsmin']) |