Codebase list python-castellan / c687503
Support upper-constraints in tox.ini Since the castellan itself is in upper-constraints.txt now, in CI job, we should remove it from the constraints file before applying it, otherwise pip will fail due to castellan version conflict. Change-Id: I5d58303b7f76e0e92083e14d3cff009c02c9fc14 Closes-bug: #1614361 Jeremy Liu 7 years ago
2 changed file(s) with 54 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
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 $?
44
55 [testenv]
66 usedevelop = True
7 install_command = pip install -U {opts} {packages}
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}
88 setenv =
99 VIRTUAL_ENV={envdir}
1010 OS_TEST_PATH=./castellan/tests/unit