]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
script/run_tox.sh: do not use python2 if we have python3 31751/head
authorKefu Chai <kchai@redhat.com>
Wed, 20 Nov 2019 07:35:37 +0000 (15:35 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 20 Nov 2019 07:47:38 +0000 (15:47 +0800)
always use python3 for bootstrapping tox environment unless the tox-env
contains "py2" but not "py3"

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/script/run_tox.sh

index 1a1b0a38c000b3c121d2d70fd32e02cbf709b805..5e9a2c91b61f2daeacb8465e785ede5132b38758 100755 (executable)
@@ -120,7 +120,17 @@ function main() {
             echo "$PWD already exists, but it's not a virtualenv. test_name empty?"
             exit 1
         fi
-        $source_dir/src/tools/setup-virtualenv.sh ${venv_path}
+        # try to use the prefered python for creating the virtual env for
+        # bootstrapping tox.
+        case $tox_envs in
+            py3*)
+                virtualenv_python=python3;;
+            py2*)
+                virtualenv_python=python2;;
+            *)
+                virtualenv_python=python3;;
+        esac
+        $source_dir/src/tools/setup-virtualenv.sh --python=${virtualenv_python} ${venv_path}
     fi
     source ${venv_path}/bin/activate
     pip install tox