gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-bank] 02/02: configure: Use python module loading fo


From: gnunet
Subject: [GNUnet-SVN] [taler-bank] 02/02: configure: Use python module loading for checking for the various python modules we use.
Date: Wed, 24 Apr 2019 12:52:23 +0200

This is an automated email from the git hooks/post-receive script.

ng0 pushed a commit to branch master
in repository bank.

commit 169c419c33f7ed655fd21d75e70d8e0f873d685d
Author: ng0 <address@hidden>
AuthorDate: Wed Apr 24 10:51:34 2019 +0000

    configure: Use python module loading for checking for the
    various python modules we use.
---
 configure.ac | 63 ++++++++++++++++++++----------------------------------------
 1 file changed, 21 insertions(+), 42 deletions(-)

diff --git a/configure.ac b/configure.ac
index 0da5d9f..3a92cde 100644
--- a/configure.ac
+++ b/configure.ac
@@ -27,52 +27,26 @@ PC_PYTHON_CHECK_HEADERS([pyheaders=1])
 # Get Python version
 PC_PYTHON_CHECK_VERSION()
 
+# 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" != :])
+
 #
 # Check for pip3.
-# It is either pip3 or pip[3.4,3.5,3.6,3.7].
-# XXX: This check might be bad.
-# XXX: We might want to write proper m4 or an
-# XXX: external script for the pip detection and usage.
-#
-
-AC_MSG_CHECKING([pip3])
-pip3 --version >/dev/null
-if test $? -ne 0;
-  then
-  pip3.4 --version >/dev/null
-  if test $? -ne 0;
-     then
-     pip3.5 --version >/dev/null
-     if test $? -ne 0;
-        then
-        pip3.6 --version >/dev/null
-        if test $? -ne 0;
-           then
-             pip3.7 --version >/dev/null
-             if test $? -ne 0;
-                then
-                AC_MSG_ERROR([Please install pip3>=6.0])
-fi
-fi
-fi
-fi
-fi
-
-PIP_VERSION=$(pip3 --version | $AWK '{ print $2 }')
-PIP_VERSION=$(pip3.4 --version | $AWK '{ print $2 }')
-PIP_VERSION=$(pip3.5 --version | $AWK '{ print $2 }')
-PIP_VERSION=$(pip3.6 --version | $AWK '{ print $2 }')
-PIP_VERSION=$(pip3.7 --version | $AWK '{ print $2 }')
-
-AC_MSG_RESULT([$PIP_VERSION])
+# 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([pip3 version: $PIP_VERSION])
 
-# FIXME: Also check for equal 6.0? At this point 19.0 is out, so
-#        checking for >6.0 should be enough.
 AX_COMPARE_VERSION([$PIP_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=""
@@ -111,11 +85,16 @@ fi
 # Check for pylint
 #
 
-AC_MSG_CHECKING([pip3])
-pylint --version >/dev/null
+PYLINT_EXE="$PYTHON -m pylint --version"
+AC_MSG_CHECKING([for pylint])
+# If module load does not return 'No module named', we have test == 0.
+# This implies having a grep implementation which supports the -v
+# switch to be 'invert-match' (select non-matching lines), which the
+# standard implementations support.
+$PYLINT_EXE | grep -v "No module named" >/dev/null
 if test $? -ne 0;
   then
-  AC_MSG_NOTICE([WARNING: pylint NOT found.])
+  AC_MSG_WARN([pylint NOT found.])
 else
   AC_MSG_NOTICE([NOTICE: pylint found, make sure plugin 'pylint-django' is 
installed.])
 fi

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]