From: Nathan Cutler Date: Tue, 7 May 2019 12:10:56 +0000 (+0200) Subject: pybind/tox: handle possible WITH_PYTHON3 values other than "3" X-Git-Tag: v14.2.2~119^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F27884%2Fhead;p=ceph.git 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) --- 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%,}