diff --git a/tools/tox_install.sh b/tools/tox_install.sh new file mode 100755 index 0000000000..9651d75c5f --- /dev/null +++ b/tools/tox_install.sh @@ -0,0 +1,20 @@ +#! /bin/sh + +set -e + +DIR=$(dirname $0) +${DIR}/tox_install_project.sh neutron neutron $* +${DIR}/tox_install_project.sh networking-l2gw networking_l2gw $* +${DIR}/tox_install_project.sh networking-sfc networking_sfc $* +${DIR}/tox_install_project.sh neutron-lbaas neutron_lbaas $* +${DIR}/tox_install_project.sh tap-as-a-service neutron_taas $* + +CONSTRAINTS_FILE=$1 +shift + +install_cmd="pip install" +if [ $CONSTRAINTS_FILE != "unconstrained" ]; then + install_cmd="$install_cmd -c$CONSTRAINTS_FILE" +fi + +$install_cmd -U $* diff --git a/tools/tox_install_project.sh b/tools/tox_install_project.sh new file mode 100755 index 0000000000..e95dd836a2 --- /dev/null +++ b/tools/tox_install_project.sh @@ -0,0 +1,52 @@ +#!/bin/sh + +# Many of neutron's repos suffer from the problem of depending on neutron, +# but it not existing on pypi. + +# This wrapper for tox's package installer will use the existing package +# if it exists, else use zuul-cloner if that program exists, else grab it +# from neutron master via a hard-coded URL. That last case should only +# happen with devs running unit tests locally. + +# From the tox.ini config page: +# install_command=ARGV +# default: +# pip install {opts} {packages} + +PROJ=$1 +MOD=$2 +shift 2 + +ZUUL_CLONER=/usr/zuul-env/bin/zuul-cloner +neutron_installed=$(echo "import ${MOD}" | python 2>/dev/null ; echo $?) +BRANCH_NAME=master + +set -e + +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-${PROJ}.txt + echo "${PROJ} already installed; using existing package" +elif [ -x "$ZUUL_CLONER" ]; then + echo "ZUUL CLONER" > /tmp/tox_install-${PROJ}.txt + cwd=$(/bin/pwd) + cd /tmp + $ZUUL_CLONER --cache-dir \ + /opt/git \ + --branch ${BRANCH_NAME} \ + git://git.openstack.org \ + openstack/${PROJ} + cd openstack/${PROJ} + $install_cmd -e . + cd "$cwd" +else + echo "PIP HARDCODE" > /tmp/tox_install-${PROJ}.txt + $install_cmd -U -egit+https://git.openstack.org/openstack/${PROJ}@${BRANCH_NAME}#egg=${PROJ} +fi diff --git a/tox.ini b/tox.ini index 1b587be2d2..60fd7bfd1d 100644 --- a/tox.ini +++ b/tox.ini @@ -8,18 +8,9 @@ setenv = VIRTUAL_ENV={envdir} PYTHONWARNINGS=default::DeprecationWarning passenv = TRACE_FAILONLY GENERATE_HASHES http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY usedevelop = True -install_command = - pip install -U -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {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 - # TODO(boden): pulling the egg from git is fine for master, but - # should be replaced with a package version in requirements for - # release (branch) tags - git+https://git.openstack.org/openstack/neutron.git@master#egg=neutron - git+https://git.openstack.org/openstack/networking-l2gw.git@master#egg=networking-l2gw - git+https://git.openstack.org/openstack/networking-sfc.git@master#egg=networking-sfc - git+https://git.openstack.org/openstack/neutron-lbaas.git@master#egg=neutron-lbaas - git+https://git.openstack.org/openstack/tap-as-a-service.git@master#egg=tap-as-a-service whitelist_externals = sh commands = {toxinidir}/tools/ostestr_compat_shim.sh {posargs}