Avoid tox_install.sh for constraints support
We do not need tox_install.sh, pip can handle constraints itself
and install the project correctly. Thus update tox.ini and remove
the now obsolete tools/tox_install.sh file.
This follows https://review.openstack.org/#/c/508061 to remove
tools/tox_install.sh.
Change-Id: I11127d4cc7263ced57309952b71df1c7813f57d6
Andreas Jaeger authored 6 years ago
Andreas Jaeger committed 6 years ago
0 | #!/usr/bin/env bash | |
1 | ||
2 | # [liujiong] This file is refer to tox_install.sh in neutron-lib. | |
3 | # Library constraint file contains this library version pin that is in conflict | |
4 | # with installing the library from source. We should replace the version pin in | |
5 | # the constraints file before applying it for from-source installation. | |
6 | ||
7 | ZUUL_CLONER=/usr/zuul-env/bin/zuul-cloner | |
8 | BRANCH_NAME=master | |
9 | LIB_NAME=castellan | |
10 | requirements_installed=$(echo "import openstack_requirements" | python 2>/dev/null ; echo $?) | |
11 | ||
12 | set -e | |
13 | ||
14 | CONSTRAINTS_FILE=$1 | |
15 | shift | |
16 | ||
17 | install_cmd="pip install" | |
18 | mydir=$(mktemp -dt "$LIB_NAME-tox_install-XXXXXXX") | |
19 | trap "rm -rf $mydir" EXIT | |
20 | localfile=$mydir/upper-constraints.txt | |
21 | if [[ $CONSTRAINTS_FILE != http* ]]; then | |
22 | CONSTRAINTS_FILE=file://$CONSTRAINTS_FILE | |
23 | fi | |
24 | curl $CONSTRAINTS_FILE -k -o $localfile | |
25 | install_cmd="$install_cmd -c$localfile" | |
26 | ||
27 | if [ $requirements_installed -eq 0 ]; then | |
28 | echo "Requirements already installed; using existing package" | |
29 | elif [ -x "$ZUUL_CLONER" ]; then | |
30 | pushd $mydir | |
31 | $ZUUL_CLONER --cache-dir \ | |
32 | /opt/git \ | |
33 | --branch $BRANCH_NAME \ | |
34 | git://git.openstack.org \ | |
35 | openstack/requirements | |
36 | cd openstack/requirements | |
37 | $install_cmd -e . | |
38 | popd | |
39 | else | |
40 | if [ -z "$REQUIREMENTS_PIP_LOCATION" ]; then | |
41 | REQUIREMENTS_PIP_LOCATION="git+https://git.openstack.org/openstack/requirements@$BRANCH_NAME#egg=requirements" | |
42 | fi | |
43 | $install_cmd -U -e ${REQUIREMENTS_PIP_LOCATION} | |
44 | fi | |
45 | ||
46 | # This is the main purpose of the script: Allow local installation of | |
47 | # the current repo. It is listed in constraints file and thus any | |
48 | # install will be constrained and we need to unconstrain it. | |
49 | edit-constraints $localfile -- $LIB_NAME "-e file://$PWD#egg=$LIB_NAME" | |
50 | ||
51 | $install_cmd -U $* | |
52 | exit $? |
4 | 4 | |
5 | 5 | [testenv] |
6 | 6 | usedevelop = True |
7 | install_command = {toxinidir}/tools/tox_install.sh {env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages} | |
7 | install_command = pip install {opts} {packages} | |
8 | 8 | setenv = |
9 | 9 | VIRTUAL_ENV={envdir} |
10 | 10 | OS_TEST_PATH=./castellan/tests/unit |
11 | deps = -r{toxinidir}/requirements.txt | |
11 | deps = | |
12 | -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} | |
13 | -r{toxinidir}/requirements.txt | |
12 | 14 | -r{toxinidir}/test-requirements.txt |
13 | 15 | commands = python setup.py testr --slowest --testr-args='{posargs}' |
14 | 16 | |
52 | 54 | setenv = |
53 | 55 | VIRTUAL_ENV={envdir} |
54 | 56 | OS_TEST_PATH=./castellan/tests/functional |
55 | deps = -r{toxinidir}/requirements.txt | |
56 | -r{toxinidir}/test-requirements.txt | |
57 | 57 | commands = python setup.py testr --slowest --testr-args='{posargs}' |
58 | 58 | |
59 | 59 | [testenv:functional-vault] |
63 | 63 | setenv = |
64 | 64 | VIRTUAL_ENV={envdir} |
65 | 65 | OS_TEST_PATH=./castellan/tests/functional |
66 | deps = -r{toxinidir}/requirements.txt | |
67 | -r{toxinidir}/test-requirements.txt | |
68 | 66 | commands = |
69 | 67 | {toxinidir}/tools/setup-vault-env.sh pifpaf -e VAULT_TEST run vault -- python setup.py testr --slowest --testr-args='{posargs}' |
70 | 68 |