summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2017-12-05 14:28:37 +0000
committerGerrit Code Review <review@openstack.org>2017-12-05 14:28:37 +0000
commit5493242b12944c919195e3f2adb176d747efd694 (patch)
treefa40a68e8fa26fda804f0398b31dcabdac4a4f6b
parent14e77312dc57a1b6b807814c2396759d6b720af8 (diff)
parent7e4c28b4995fe121d468a562aa0d0727df2ba9fe (diff)
Merge "Avoid tox_install.sh for constraints support"
-rwxr-xr-xtools/tox_install.sh55
-rw-r--r--tox.ini15
2 files changed, 10 insertions, 60 deletions
diff --git a/tools/tox_install.sh b/tools/tox_install.sh
deleted file mode 100755
index f07819f..0000000
--- a/tools/tox_install.sh
+++ /dev/null
@@ -1,55 +0,0 @@
1#!/usr/bin/env bash
2
3# Client constraint file contains this client version pin that is in conflict
4# with installing the client from source. We should replace the version pin in
5# the constraints file before applying it for from-source installation.
6
7ZUUL_CLONER=/usr/zuul-env/bin/zuul-cloner
8BRANCH_NAME=master
9CLIENT_NAME=python-magnumclient
10requirements_installed=$(echo "import openstack_requirements" | python 2>/dev/null ; echo $?)
11
12set -e
13
14CONSTRAINTS_FILE=$1
15shift
16
17install_cmd="pip install"
18mydir=$(mktemp -dt "$CLIENT_NAME-tox_install-XXXXXXX")
19trap "rm -rf $mydir" EXIT
20localfile=$mydir/upper-constraints.txt
21if [[ $CONSTRAINTS_FILE != http* ]]; then
22 CONSTRAINTS_FILE=file://$CONSTRAINTS_FILE
23fi
24curl $CONSTRAINTS_FILE -k -o $localfile
25install_cmd="$install_cmd -c$localfile"
26
27if [ $requirements_installed -eq 0 ]; then
28 echo "ALREADY INSTALLED" > /tmp/tox_install.txt
29 echo "Requirements already installed; using existing package"
30elif [ -x "$ZUUL_CLONER" ]; then
31 echo "ZUUL CLONER" > /tmp/tox_install.txt
32 pushd $mydir
33 $ZUUL_CLONER --cache-dir \
34 /opt/git \
35 --branch $BRANCH_NAME \
36 git://git.openstack.org \
37 openstack/requirements
38 cd openstack/requirements
39 $install_cmd -e .
40 popd
41else
42 echo "PIP HARDCODE" > /tmp/tox_install.txt
43 if [ -z "$REQUIREMENTS_PIP_LOCATION" ]; then
44 REQUIREMENTS_PIP_LOCATION="git+https://git.openstack.org/openstack/requirements@$BRANCH_NAME#egg=requirements"
45 fi
46 $install_cmd -U -e ${REQUIREMENTS_PIP_LOCATION}
47fi
48
49# This is the main purpose of the script: Allow local installation of
50# the current repo. It is listed in constraints file and thus any
51# install will be constrained and we need to unconstrain it.
52edit-constraints $localfile -- $CLIENT_NAME "-e file://$PWD#egg=$CLIENT_NAME"
53
54$install_cmd -U $*
55exit $?
diff --git a/tox.ini b/tox.ini
index a55a878..532ea1b 100644
--- a/tox.ini
+++ b/tox.ini
@@ -5,24 +5,29 @@ skipsdist = True
5 5
6[testenv] 6[testenv]
7usedevelop = True 7usedevelop = True
8install_command = 8install_command = pip install {opts} {packages}
9 {toxinidir}/tools/tox_install.sh {env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
10whitelist_externals = find 9whitelist_externals = find
11setenv = 10setenv =
12 VIRTUAL_ENV={envdir} 11 VIRTUAL_ENV={envdir}
13 PYTHONWARNINGS=default::DeprecationWarning 12 PYTHONWARNINGS=default::DeprecationWarning
14deps = -r{toxinidir}/requirements.txt 13deps =
14 -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt}
15 -r{toxinidir}/requirements.txt
15 -r{toxinidir}/test-requirements.txt 16 -r{toxinidir}/test-requirements.txt
16commands = 17commands =
17 find . -type f -name "*.py[c|o]" -delete 18 find . -type f -name "*.py[c|o]" -delete
18 python setup.py testr --slowest --testr-args='{posargs}' 19 python setup.py testr --slowest --testr-args='{posargs}'
19 20
20[testenv:bandit] 21[testenv:bandit]
21deps = -r{toxinidir}/test-requirements.txt 22deps =
23 -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt}
24 -r{toxinidir}/test-requirements.txt
22commands = bandit -r magnumclient -x tests -n5 -ll 25commands = bandit -r magnumclient -x tests -n5 -ll
23 26
24[testenv:pypy] 27[testenv:pypy]
25deps = setuptools<3.2 28deps =
29 -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt}
30 setuptools<3.2
26 -r{toxinidir}/requirements.txt 31 -r{toxinidir}/requirements.txt
27 -r{toxinidir}/test-requirements.txt 32 -r{toxinidir}/test-requirements.txt
28 33