Use tox_install convention
Copied from networking-midonet. Closes-Bug: #1646436 Change-Id: Ic66367eb797bddd3b7e0ffd2a65c0a3f719507f1
This commit is contained in:
parent
094becbcf5
commit
97460ae286
@ -4,4 +4,3 @@
|
||||
|
||||
pbr>=1.6 # Apache-2.0
|
||||
Babel>=2.3.4 # BSD
|
||||
-e git://git.openstack.org/openstack/neutron.git@master#egg=neutron
|
||||
|
16
tools/tox_install.sh
Executable file
16
tools/tox_install.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#! /bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
DIR=$(dirname $0)
|
||||
${DIR}/tox_install_project.sh neutron neutron $*
|
||||
|
||||
CONSTRAINTS_FILE=$1
|
||||
shift
|
||||
|
||||
install_cmd="pip install"
|
||||
if [ $CONSTRAINTS_FILE != "unconstrained" ]; then
|
||||
install_cmd="$install_cmd -c$CONSTRAINTS_FILE"
|
||||
fi
|
||||
|
||||
$install_cmd -U $*
|
52
tools/tox_install_project.sh
Executable file
52
tools/tox_install_project.sh
Executable file
@ -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
|
2
tox.ini
2
tox.ini
@ -7,7 +7,7 @@ skipsdist = True
|
||||
setenv = VIRTUAL_ENV={envdir}
|
||||
PYTHONWARNINGS=default::DeprecationWarning
|
||||
usedevelop = True
|
||||
install_command = pip install -U {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
|
||||
commands = find . -type f -name "*.py[c|o]" -delete
|
||||
|
Loading…
Reference in New Issue
Block a user