From ef5a8d069a2603430b0f900096c4f579e87ccdbe Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Wed, 20 Nov 2019 15:35:37 +0800 Subject: [PATCH] script/run_tox.sh: do not use python2 if we have python3 always use python3 for bootstrapping tox environment unless the tox-env contains "py2" but not "py3" Signed-off-by: Kefu Chai --- src/script/run_tox.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/script/run_tox.sh b/src/script/run_tox.sh index 1a1b0a38c00..5e9a2c91b61 100755 --- a/src/script/run_tox.sh +++ b/src/script/run_tox.sh @@ -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 -- 2.47.3