]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/run-tox.sh
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / pybind / mgr / dashboard / run-tox.sh
1 #!/usr/bin/env bash
2
3 function dump_envvars {
4 echo "WITH_PYTHON2: ->$WITH_PYTHON2<-"
5 echo "WITH_PYTHON3: ->$WITH_PYTHON3<-"
6 echo "TOX_PATH: ->$TOX_PATH<-"
7 echo "ENV_LIST: ->$ENV_LIST<-"
8 }
9
10 # run from ./ or from ../
11 : ${CEPH_BUILD_DIR:=$PWD/.tox}
12 : ${MGR_DASHBOARD_VIRTUALENV:=$CEPH_BUILD_DIR/mgr-dashboard-virtualenv}
13 : ${WITH_PYTHON2:=ON}
14 : ${WITH_PYTHON3:=3}
15 test -d dashboard && cd dashboard
16
17 if [ -e tox.ini ]; then
18 TOX_PATH=$(readlink -f tox.ini)
19 else
20 TOX_PATH=$(readlink -f $(dirname $0)/tox.ini)
21 fi
22
23 # tox.ini will take care of this.
24 unset PYTHONPATH
25 export CEPH_BUILD_DIR=$CEPH_BUILD_DIR
26
27 source ${MGR_DASHBOARD_VIRTUALENV}/bin/activate
28
29 if [ "$WITH_PYTHON2" = "ON" ]; then
30 if [[ -n "$@" ]]; then
31 ENV_LIST+="py27-run,"
32 else
33 ENV_LIST+="py27-cov,py27-lint,py27-check,"
34 fi
35 fi
36 # WITH_PYTHON3 might be set to "ON" or to the python3 RPM version number
37 # prevailing on the system - e.g. "3", "36"
38 if [[ "$WITH_PYTHON3" =~ (^3|^ON) ]]; then
39 if [[ -n "$@" ]]; then
40 ENV_LIST+="py3-run,"
41 else
42 ENV_LIST+="py3-cov,py3-lint,py3-check,"
43 fi
44 fi
45 # use bash string manipulation to strip off any trailing comma
46 ENV_LIST=${ENV_LIST%,}
47
48 tox -c "${TOX_PATH}" -e "${ENV_LIST}" "$@"
49 TOX_STATUS="$?"
50 test "$TOX_STATUS" -ne "0" && dump_envvars
51 exit $TOX_STATUS