From 2bee5d94dfee9d000a2579925b6a2791801ceba8 Mon Sep 17 00:00:00 2001 From: Li Ma Date: Thu, 13 Oct 2016 12:03:48 +0800 Subject: [PATCH] Update tox install to support constraints and branches Update tox.ini and tox_install.sh to support constraints and branches. This also includes an update per [1]. [1] http://lists.openstack.org/pipermail/openstack-dev/2016-August/101474.html Change-Id: I6e126fb6ef9048dd00190bf19e2f3c2e8ce21155 --- tools/tox_install.sh | 16 +++++++++++++--- tox.ini | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/tools/tox_install.sh b/tools/tox_install.sh index a2e3e38a8..83dca0fa5 100755 --- a/tools/tox_install.sh +++ b/tools/tox_install.sh @@ -15,11 +15,20 @@ ZUUL_CLONER=/usr/zuul-env/bin/zuul-cloner neutron_installed=$(echo "import neutron" | python 2>/dev/null ; echo $?) +BRANCH_NAME=master set -ex cwd=$(/bin/pwd) +CONSTRAINTS_FILE=$1 +shift + +install_cmd="pip install" +if [ $CONSTRAINTS_FILE != "unconstrained" ]; then + install_cmd="$install_cmd -c$CONSTRAINTS_FILE" +fi + if [ $neutron_installed -eq 0 ]; then echo "ALREADY INSTALLED" > /tmp/tox_install.txt echo "Neutron already installed; using existing package" @@ -29,16 +38,17 @@ elif [ -x "$ZUUL_CLONER" ]; then export ZUUL_BRANCH=${ZUUL_BRANCH-$BRANCH} $ZUUL_CLONER --cache-dir \ /opt/git \ + --branch $BRANCH_NAME \ git://git.openstack.org \ openstack/neutron cd openstack/neutron - pip install -e . + $install_cmd -e . cd "$cwd" else echo "PIP HARDCODE" > /tmp/tox_install.txt - pip install -U -egit+https://git.openstack.org/openstack/neutron#egg=neutron + $install_cmd -U -egit+https://git.openstack.org/openstack/neutron@$BRANCH_NAME#egg=neutron fi -pip install -U $* +$install_cmd -U $* pip install python-etcd exit $? diff --git a/tox.ini b/tox.ini index 4852e540d..4ad2f9435 100644 --- a/tox.ini +++ b/tox.ini @@ -10,7 +10,7 @@ setenv = VIRTUAL_ENV={envdir} PYTHONHASHSEED=0 PYTHONWARNINGS=default::DeprecationWarning usedevelop = True -install_command = {toxinidir}/tools/tox_install.sh {opts} {packages} +install_command = {toxinidir}/tools/tox_install.sh {env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages} deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt whitelist_externals = sh