From 60a2b6b991b1b40f7d63f79b784980f94824257a Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Thu, 22 Mar 2018 09:19:08 +0100 Subject: [PATCH] Avoid tox_install Since neutron and networking-sfc are now in global-requirements, we can remove the installation from tools/tox_install.sh. Remove the tox_install files completely and update tox.ini for this. Add requirements to requirements.txt instead. Change-Id: Id6d43a97bd77785de976d418dc835108e3b1434f --- requirements.txt | 5 ++- tools/tox_install.sh | 29 -------------- tools/tox_install_project.sh | 76 ------------------------------------ tox.ini | 4 +- 4 files changed, 6 insertions(+), 108 deletions(-) delete mode 100755 tools/tox_install.sh delete mode 100755 tools/tox_install_project.sh diff --git a/requirements.txt b/requirements.txt index 2f7942bf4..dc5869546 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,7 +12,6 @@ pyzmq>=14.3.1 # LGPL+BSD ryu>=4.14 # Apache-2.0 SQLAlchemy!=1.1.5,!=1.1.6,!=1.1.7,!=1.1.8,>=1.0.10 # MIT alembic>=0.8.10 # MIT -neutron>=12.0.0 # Apache-2.0 neutron-lib>=1.13.0 # Apache-2.0 oslo.config>=5.2.0 # Apache-2.0 oslo.db>=4.27.0 # Apache-2.0 @@ -28,3 +27,7 @@ httplib2>=0.9.1 # MIT WebOb>=1.7.1 # MIT jsonmodels>=2.1.3 # BSD License (3 clause) +# These repos are installed from git in OpenStack CI if the job +# configures them as required-projects: +neutron>=12.0.0 # Apache-2.0 +networking-sfc>=6.0.0 # Apache-2.0 diff --git a/tools/tox_install.sh b/tools/tox_install.sh deleted file mode 100755 index 92b3dd7cf..000000000 --- a/tools/tox_install.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash - -# Many of neutron's repos suffer from the problem of depending on neutron, -# but it not existing on pypi. -# Note: neutron now does exist, others not yet. - -# 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} -set -ex - -DIR=$(dirname $0) -${DIR}/tox_install_project.sh networking-sfc networking_sfc $* -CONSTRAINTS_FILE=$1 -shift - -install_cmd="pip install" -if [ $CONSTRAINTS_FILE != "unconstrained" ]; then - install_cmd="$install_cmd -c$CONSTRAINTS_FILE" -fi - -$install_cmd -U $* -exit $? diff --git a/tools/tox_install_project.sh b/tools/tox_install_project.sh deleted file mode 100755 index 522df24c0..000000000 --- a/tools/tox_install_project.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env bash - -# 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 local tree in home directory if exists, -# else the existing package if it exists, -# else use zuul-cloner if that program exists, -# else grab it from project master via https://git.openstack.org/openstack, -# 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 -proj_installed=$(echo "import ${MOD}" | python 2>/dev/null ; echo $?) -BRANCH_NAME=master - -set -e -set -x - -CONSTRAINTS_FILE=$1 -shift - -install_cmd="pip install" -if [ $CONSTRAINTS_FILE != "unconstrained" ]; then - install_cmd="$install_cmd -c$CONSTRAINTS_FILE" -fi - -# Check if the project exists in Zuul V3 related locations.. -if [ -d src/git.openstack.org/openstack/${PROJ} ]; then - PROJ_INSTALLED_DIR=src/git.openstack.org/openstack/${PROJ} -elif [ -d /home/zuul/src/git.openstack.org/openstack/${PROJ} ]; then - PROJ_INSTALLED_DIR=/home/zuul/src/git.openstack.org/openstack/${PROJ} -fi - -if [ $proj_installed -eq 0 ]; then - echo "ALREADY INSTALLED" > /tmp/tox_install-${PROJ}.txt - location=$(python -c "import ${MOD}; print(${MOD}.__file__)") - echo "ALREADY INSTALLED at $location" - - echo "${PROJ} already installed; using existing package" -elif [ -n "$PROJ_INSTALLED_DIR" ]; then - # Do not clone the projects if running under zuul v3 - # Zuul v3 should get the projects from the required-projects list - pushd $PROJ_INSTALLED_DIR - # Install the project - $install_cmd -e . - popd -elif [ -x "$ZUUL_CLONER" ]; then - echo "ZUUL CLONER" > /tmp/tox_install-${PROJ}.txt - # Make this relative to current working directory so that - # git clean can remove it. We cannot remove the directory directly - # since it is referenced after $install_cmd -e. - mkdir -p .tmp - PROJECT_DIR=$(/bin/mktemp -d -p $(pwd)/.tmp) - pushd $PROJECT_DIR - $ZUUL_CLONER --cache-dir \ - /opt/git \ - --branch ${BRANCH_NAME} \ - git://git.openstack.org \ - openstack/${PROJ} - cd openstack/${PROJ} - $install_cmd -e . - popd -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 d9345a98d..210a38dcf 100644 --- a/tox.ini +++ b/tox.ini @@ -10,8 +10,8 @@ setenv = VIRTUAL_ENV={envdir} PYTHONHASHSEED=0 PYTHONWARNINGS=default::DeprecationWarning usedevelop = True -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 +deps = -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} + -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt whitelist_externals = sh /bin/rm commands = /bin/rm -f .testrepository/times.dbm