[PATCH 1/2] configure: detect which versions of python can run pytest

Subject: [PATCH 1/2] configure: detect which versions of python can run pytest

Date: Sat, 7 Apr 2018 18:39:33 -0300

To: Tomi Ollila, Floris Bruynooghe, notmuch@notmuchmail.org

Cc:

From: David Bremner


Based on a patch from Florian [1].

[1]: id:py3ibmevqnna.fsf@devork.be
---
 configure | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index b177b141..c14e6f8b 100755
--- a/configure
+++ b/configure
@@ -571,6 +571,24 @@ if [ $have_python -eq 0 ]; then
     errors=$((errors + 1))
 fi
 
+pytest_pythons=""
+if [ $have_python -eq 1 ]; then
+    for bin in python2.7 python3.5 python3.6 pypy3.5; do
+        printf "Checking for pytest ($bin)... "
+        if command -v $bin > /dev/null; then
+            if $bin -c 'import pytest' >/dev/null 2>&1; then
+                pytest_pythons="${pytest_pythons} $bin"
+                printf "Yes.\n"
+            else
+                printf "No (skipping $bin tests).\n"
+            fi
+        else
+            printf "No (skipping $bin tests).\n"
+        fi
+    done
+    pytest_pythons="${pytest_pythons# }"
+fi
+
 printf "Checking for valgrind development files... "
 if pkg-config --exists valgrind; then
     printf "Yes.\n"
@@ -808,7 +826,6 @@ else
 fi
 rm -f compat/have_canonicalize_file_name
 
-
 printf "Checking for getline... "
 if ${CC} -o compat/have_getline "$srcdir"/compat/have_getline.c > /dev/null 2>&1
 then
@@ -1233,6 +1250,7 @@ NOTMUCH_HAVE_MAN=$((have_sphinx))
 
 # Name of python interpreter
 NOTMUCH_PYTHON=${python}
+NOTMUCH_PYTEST_PYTHONS='${pytest_pythons}'
 
 # Are the ruby development files (and ruby) available? If not skip
 # building/testing ruby bindings.
-- 
2.16.3

_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch

Thread: