From b9049a0e404dca854fac6395aaa621dbe8f2e1b4 Mon Sep 17 00:00:00 2001 From: Nathan Cutler Date: Tue, 7 May 2019 14:10:56 +0200 Subject: [PATCH] pybind/tox: handle possible WITH_PYTHON3 values other than "3" WITH_PYTHON3 might be set to "ON" or to the python3 RPM version number prevailing on the system - e.g. "3", "36" Fixes: 9426f1f2045d0ae0f319530c3dc3a9240d838d07 Signed-off-by: Nathan Cutler (cherry picked from commit f8aac6f69b2d5e28f428e9f7a64beac5878452ff) --- src/pybind/mgr/ansible/run-tox.sh | 4 +++- src/pybind/mgr/dashboard/run-tox.sh | 4 +++- src/pybind/mgr/insights/run-tox.sh | 4 +++- src/pybind/mgr/orchestrator_cli/run-tox.sh | 6 +++--- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/pybind/mgr/ansible/run-tox.sh b/src/pybind/mgr/ansible/run-tox.sh index f2eecd85fe1c..fd6da244cb68 100644 --- a/src/pybind/mgr/ansible/run-tox.sh +++ b/src/pybind/mgr/ansible/run-tox.sh @@ -29,7 +29,9 @@ source ${MGR_ANSIBLE_VIRTUALENV}/bin/activate if [ "$WITH_PYTHON2" = "ON" ]; then ENV_LIST+="py27," fi -if [ "$WITH_PYTHON3" = "3" ]; then +# WITH_PYTHON3 might be set to "ON" or to the python3 RPM version number +# prevailing on the system - e.g. "3", "36" +if [[ "$WITH_PYTHON3" =~ (^3|^ON) ]]; then ENV_LIST+="py3," fi # use bash string manipulation to strip off any trailing comma diff --git a/src/pybind/mgr/dashboard/run-tox.sh b/src/pybind/mgr/dashboard/run-tox.sh index 27c585140540..35be81c86d75 100755 --- a/src/pybind/mgr/dashboard/run-tox.sh +++ b/src/pybind/mgr/dashboard/run-tox.sh @@ -33,7 +33,9 @@ if [ "$WITH_PYTHON2" = "ON" ]; then ENV_LIST+="py27-cov,py27-lint," fi fi -if [ "$WITH_PYTHON3" = "3" ]; then +# WITH_PYTHON3 might be set to "ON" or to the python3 RPM version number +# prevailing on the system - e.g. "3", "36" +if [[ "$WITH_PYTHON3" =~ (^3|^ON) ]]; then if [[ -n "$@" ]]; then ENV_LIST+="py3-run," else diff --git a/src/pybind/mgr/insights/run-tox.sh b/src/pybind/mgr/insights/run-tox.sh index 9a2c400f797c..7d62145092dc 100644 --- a/src/pybind/mgr/insights/run-tox.sh +++ b/src/pybind/mgr/insights/run-tox.sh @@ -29,7 +29,9 @@ source ${MGR_INSIGHTS_VIRTUALENV}/bin/activate if [ "$WITH_PYTHON2" = "ON" ]; then ENV_LIST+="py27," fi -if [ "$WITH_PYTHON3" = "3" ]; then +# WITH_PYTHON3 might be set to "ON" or to the python3 RPM version number +# prevailing on the system - e.g. "3", "36" +if [[ "$WITH_PYTHON3" =~ (^3|^ON) ]]; then ENV_LIST+="py3," fi # use bash string manipulation to strip off any trailing comma diff --git a/src/pybind/mgr/orchestrator_cli/run-tox.sh b/src/pybind/mgr/orchestrator_cli/run-tox.sh index 6a1a34186419..32b24f5525f3 100644 --- a/src/pybind/mgr/orchestrator_cli/run-tox.sh +++ b/src/pybind/mgr/orchestrator_cli/run-tox.sh @@ -32,11 +32,11 @@ fi if [ "$WITH_PYTHON2" = "ON" ]; then ENV_LIST+="py27," fi -if [ "$WITH_PYTHON3" = "3" ]; then +# WITH_PYTHON3 might be set to "ON" or to the python3 RPM version number +# prevailing on the system - e.g. "3", "36" +if [[ "$WITH_PYTHON3" =~ (^3|^ON) ]]; then ENV_LIST+="py3," fi -ENV_LIST=$(echo "$ENV_LIST" | sed -e 's/,$//') - # use bash string manipulation to strip off any trailing comma ENV_LIST=${ENV_LIST%,} -- 2.47.3