From: Chris Hofstaedtler Date: Tue, 6 Mar 2018 07:45:25 +0000 (+0100) Subject: api tests: pick python3 if available X-Git-Tag: dnsdist-1.3.0~62^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1bbeda0dfc59d1f1605a31a69f411d28162ccb6e;p=thirdparty%2Fpdns.git api tests: pick python3 if available --- diff --git a/regression-tests.api/runtests b/regression-tests.api/runtests index 47f25f0f12..dac34dd10d 100755 --- a/regression-tests.api/runtests +++ b/regression-tests.api/runtests @@ -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