]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
api tests: pick python3 if available 6325/head
authorChris Hofstaedtler <chris.hofstaedtler@deduktiva.com>
Tue, 6 Mar 2018 07:45:25 +0000 (08:45 +0100)
committerChris Hofstaedtler <chris.hofstaedtler@deduktiva.com>
Tue, 6 Mar 2018 07:45:25 +0000 (08:45 +0100)
regression-tests.api/runtests

index 47f25f0f12c6a0838980bb8836613f1c5b435622..dac34dd10d5385c337bfd851518b07b9abdf258d 100755 (executable)
@@ -1,9 +1,17 @@
 #!/usr/bin/env bash
 
-PYTHON=${PYTHON:-python2}
-
 if [ ! -d .venv ]; then
-       virtualenv -p ${PYTHON} .venv
+  if [ -z "$PYTHON" ]; then
+    if [ ! -z "$(python3 --version | egrep '^Python 3.[6789]' 2>/dev/null)" ]; then
+      # found python3.6 or better
+      PYTHON=python3
+    else
+      # until we have better Linux distribution detection.
+      PYTHON=python2
+    fi
+  fi
+
+  virtualenv -p ${PYTHON} .venv
 fi
 . .venv/bin/activate
 python -V