Skip to content

Commit e2a9fd2

Browse files
committed
Follow upper constraints for all tox targets
With the exception of releasenotes and cover, we should follow upper constraints. The tox_install file was copied over from python-neutronclient [1]. [1] http://git.openstack.org/cgit/openstack/python-neutronclient/tree/tools/tox_install.sh Change-Id: I633fa149820efafd7b2acec0388fa8bc8d06c988
1 parent 1821f20 commit e2a9fd2

2 files changed

Lines changed: 61 additions & 1 deletion

File tree

tools/tox_install.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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+
7+
ZUUL_CLONER=/usr/zuul-env/bin/zuul-cloner
8+
BRANCH_NAME=master
9+
CLIENT_NAME=python-openstackclient
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+
if [ $CONSTRAINTS_FILE != "unconstrained" ]; then
19+
20+
mydir=$(mktemp -dt "$CLIENT_NAME-tox_install-XXXXXXX")
21+
localfile=$mydir/upper-constraints.txt
22+
if [[ $CONSTRAINTS_FILE != http* ]]; then
23+
CONSTRAINTS_FILE=file://$CONSTRAINTS_FILE
24+
fi
25+
curl $CONSTRAINTS_FILE -k -o $localfile
26+
install_cmd="$install_cmd -c$localfile"
27+
28+
if [ $requirements_installed -eq 0 ]; then
29+
echo "ALREADY INSTALLED" > /tmp/tox_install.txt
30+
echo "Requirements already installed; using existing package"
31+
elif [ -x "$ZUUL_CLONER" ]; then
32+
export ZUUL_BRANCH=${ZUUL_BRANCH-$BRANCH}
33+
echo "ZUUL CLONER" > /tmp/tox_install.txt
34+
pushd $mydir
35+
$ZUUL_CLONER --cache-dir \
36+
/opt/git \
37+
--branch $BRANCH_NAME \
38+
git://git.openstack.org \
39+
openstack/requirements
40+
cd openstack/requirements
41+
$install_cmd -e .
42+
popd
43+
else
44+
echo "PIP HARDCODE" > /tmp/tox_install.txt
45+
if [ -z "$REQUIREMENTS_PIP_LOCATION" ]; then
46+
REQUIREMENTS_PIP_LOCATION="git+https://git.openstack.org/openstack/requirements@$BRANCH_NAME#egg=requirements"
47+
fi
48+
$install_cmd -U -e ${REQUIREMENTS_PIP_LOCATION}
49+
fi
50+
51+
edit-constraints $localfile -- $CLIENT_NAME "-e file://$PWD#egg=$CLIENT_NAME"
52+
fi
53+
54+
$install_cmd -U $*
55+
exit $?

tox.ini

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ skipdist = True
55

66
[testenv]
77
usedevelop = True
8-
install_command = pip install -U {opts} {packages}
8+
install_command =
9+
{toxinidir}/tools/tox_install.sh {env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
910
setenv = VIRTUAL_ENV={envdir}
1011
deps = -r{toxinidir}/test-requirements.txt
1112
commands = ostestr {posargs}
@@ -54,6 +55,8 @@ setenv = OS_TEST_PATH=./functional/tests
5455
passenv = OS_*
5556

5657
[testenv:venv]
58+
# TODO(ihrachys): remove once infra supports constraints for this target
59+
install_command = pip install -U {opts} {packages}
5760
commands = {posargs}
5861

5962
[testenv:cover]
@@ -68,6 +71,8 @@ commands = oslo_debug_helper -t openstackclient/tests {posargs}
6871
commands = python setup.py build_sphinx
6972

7073
[testenv:releasenotes]
74+
# TODO(ihrachys): remove once infra supports constraints for this target
75+
install_command = pip install -U {opts} {packages}
7176
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
7277

7378
[flake8]

0 commit comments

Comments
 (0)