From 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 20:24:20 +0200 Subject: Adding upstream version 14.2.21. Signed-off-by: Daniel Baumann --- src/pybind/mgr/dashboard/run-tox.sh | 51 +++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100755 src/pybind/mgr/dashboard/run-tox.sh (limited to 'src/pybind/mgr/dashboard/run-tox.sh') diff --git a/src/pybind/mgr/dashboard/run-tox.sh b/src/pybind/mgr/dashboard/run-tox.sh new file mode 100755 index 00000000..8086bb4e --- /dev/null +++ b/src/pybind/mgr/dashboard/run-tox.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash + +function dump_envvars { + echo "WITH_PYTHON2: ->$WITH_PYTHON2<-" + echo "WITH_PYTHON3: ->$WITH_PYTHON3<-" + echo "TOX_PATH: ->$TOX_PATH<-" + echo "ENV_LIST: ->$ENV_LIST<-" +} + +# run from ./ or from ../ +: ${CEPH_BUILD_DIR:=$PWD/.tox} +: ${MGR_DASHBOARD_VIRTUALENV:=$CEPH_BUILD_DIR/mgr-dashboard-virtualenv} +: ${WITH_PYTHON2:=ON} +: ${WITH_PYTHON3:=3} +test -d dashboard && cd dashboard + +if [ -e tox.ini ]; then + TOX_PATH=$(readlink -f tox.ini) +else + TOX_PATH=$(readlink -f $(dirname $0)/tox.ini) +fi + +# tox.ini will take care of this. +unset PYTHONPATH +export CEPH_BUILD_DIR=$CEPH_BUILD_DIR + +source ${MGR_DASHBOARD_VIRTUALENV}/bin/activate + +if [ "$WITH_PYTHON2" = "ON" ]; then + if [[ -n "$@" ]]; then + ENV_LIST+="py27-run," + else + ENV_LIST+="py27-cov,py27-lint,py27-check," + fi +fi +# 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 + ENV_LIST+="py3-cov,py3-lint,py3-check," + fi +fi +# use bash string manipulation to strip off any trailing comma +ENV_LIST=${ENV_LIST%,} + +tox -c "${TOX_PATH}" -e "${ENV_LIST}" "$@" +TOX_STATUS="$?" +test "$TOX_STATUS" -ne "0" && dump_envvars +exit $TOX_STATUS -- cgit v1.2.3