diff --git a/tools/tox_install.sh b/tools/tox_install.sh index 2f40c2860..5ab1ea97b 100755 --- a/tools/tox_install.sh +++ b/tools/tox_install.sh @@ -13,28 +13,29 @@ # default: # pip install {opts} {packages} -set -x - ZUUL_CLONER=/usr/zuul-env/bin/zuul-cloner -neutron_installed=$(echo "import neutron" | python 2>/dev/null ; echo $?) -NEUTRON_DIR=$HOME/neutron BRANCH_NAME=master +neutron_installed=$(echo "import neutron" | python 2>/dev/null ; echo $?) set -e install_cmd="pip install -c$1" shift -if [ -d "$NEUTRON_DIR" ]; then - echo "FOUND Neutron code at $NEUTRON_DIR - using" - $install_cmd -U -e $NEUTRON_DIR -elif [ $neutron_installed -eq 0 ]; then +if [ $neutron_installed -eq 0 ]; then + echo "ALREADY INSTALLED" > /tmp/tox_install.txt location=$(python -c "import neutron; print(neutron.__file__)") echo "ALREADY INSTALLED at $location" + + echo "Neutron already installed; using existing package" elif [ -x "$ZUUL_CLONER" ]; then - echo "USING ZUUL CLONER to obtain Neutron code" - cwd=$(/bin/pwd) - cd /tmp + echo "ZUUL CLONER" > /tmp/tox_install.txt + # Make this relative to current working directory so that + # git clean can remove it. We cannot remove the directory directly + # since it is reference after $install_cmd -e. + mkdir -p .tmp + NEUTRON_DIR=$(/bin/mktemp -d -p $(pwd)/.tmp) + pushd $NEUTRON_DIR $ZUUL_CLONER --cache-dir \ /opt/git \ --branch $BRANCH_NAME \ @@ -42,10 +43,13 @@ elif [ -x "$ZUUL_CLONER" ]; then openstack/neutron cd openstack/neutron $install_cmd -e . - cd "$cwd" + popd else - echo "LOCAL - Obtaining Neutron code from git.openstack.org" - $install_cmd -U -egit+https://git.openstack.org/openstack/neutron@$BRANCH_NAME#egg=neutron + echo "PIP HARDCODE" > /tmp/tox_install.txt + if [ -z "$NEUTRON_PIP_LOCATION" ]; then + NEUTRON_PIP_LOCATION="git+https://git.openstack.org/openstack/neutron@$BRANCH_NAME#egg=neutron" + fi + $install_cmd -U -e ${NEUTRON_PIP_LOCATION} fi $install_cmd -U $* diff --git a/tox.ini b/tox.ini index d183a2e5e..e8b955c7c 100644 --- a/tox.ini +++ b/tox.ini @@ -89,7 +89,7 @@ commands = sphinx-build -W -b html doc/source doc/build # N530 direct neutron imports not allowed ignore = E125,E126,E128,E129,E265,H404,H405,N530 show-source = true -exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,tools,.ropeproject,rally-scenarios +exclude = .venv,.git,.tox,dist,doc,.tmp,*lib/python*,*egg,build,tools,.ropeproject,rally-scenarios [hacking] import_exceptions = neutron_vpnaas._i18n