From f7f4fc46c391ef8dabe7d4bdc71f8b6e241a1377 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Wed, 29 Nov 2017 10:56:19 -0600 Subject: Remove tox_install.sh and just pass -c in tox The tox_install.sh scripts are there to enable dealing with constraints support. All of that can be accomplished directly, it turns out, by simply adding the -c line to the requirements list. Remove tox_install.sh and just set constraints directly. Conflicts: tox.ini NOTE(stephenfin): Conflicts are due to some additional changes introduced to tox in stable/queens before this patch. This patch is required because 'tox_install.sh' uses curl w/o -L switch so it fails to account for redirects that are now in place for backward compat with git.openstack.org. Change-Id: I888ee148995c080f793f90e168613348283d0ff0 (cherry picked from commit d8cb8ca09bb7835671011c7765504404e28c74b3) --- tools/tox_install.sh | 85 ---------------------------------------------------- tox.ini | 9 +++--- 2 files changed, 5 insertions(+), 89 deletions(-) delete mode 100755 tools/tox_install.sh diff --git a/tools/tox_install.sh b/tools/tox_install.sh deleted file mode 100755 index 2075924..0000000 --- a/tools/tox_install.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env bash - -# Client constraint file contains this client version pin that is in conflict -# with installing the client from source. We should remove the version pin in -# the constraints file before applying it for from-source installation. -# The script also has a secondary purpose to install certain special -# dependencies directly from git. - -# Wrapper for pip install that always uses constraints. -function pip_install() { - pip install -c"$localfile" -U "$@" -} - -# Grab the library from git using either zuul-cloner or pip. The former is -# there to a take advantage of the setup done by the gate infrastructure -# and honour any/all Depends-On headers in the commit message -function install_from_git() { - ZUUL_CLONER=/usr/zuul-env/bin/zuul-cloner - GIT_HOST=git.openstack.org - PROJ=$1 - EGG=$2 - - edit-constraints "$localfile" -- "$EGG" - if [ -x "$ZUUL_CLONER" ]; then - SRC_DIR="$VIRTUAL_ENV/src" - mkdir -p "$SRC_DIR" - cd "$SRC_DIR" >/dev/null - ZUUL_CACHE_DIR=${ZUUL_CACHE_DIR:-/opt/git} $ZUUL_CLONER \ - --branch "$BRANCH_NAME" \ - "git://$GIT_HOST" "$PROJ" - pip_install -e "$PROJ/." - cd - >/dev/null - else - pip_install -e"git+https://$GIT_HOST/$PROJ@$BRANCH_NAME#egg=${EGG}" - fi -} - - - -CONSTRAINTS_FILE="$1" -shift 1 - -# This script will either complete with a return code of 0 or the return code -# of whatever failed. -set -e - -# NOTE(tonyb): Place this in the tox environment's log dir so it will get -# published to logs.openstack.org for easy debugging. -mkdir -p "$VIRTUAL_ENV/log/" -localfile="$VIRTUAL_ENV/log/upper-constraints.txt" - -if [[ "$CONSTRAINTS_FILE" != http* ]]; then - CONSTRAINTS_FILE="file://$CONSTRAINTS_FILE" -fi -# NOTE(tonyb): need to add curl to bindep.txt if the project supports bindep -curl "$CONSTRAINTS_FILE" --insecure --progress-bar --output "$localfile" - -pip_install openstack-requirements - -# This is the main purpose of the script: Allow local installation of -# the current repo. It is listed in constraints file and thus any -# install will be constrained and we need to unconstrain it. -edit-constraints "$localfile" -- "$CLIENT_NAME" - -declare -a passthrough_args -while [ $# -gt 0 ] ; do - case "$1" in - # If we have any special os: deps then process them - os:*) - declare -a pkg_spec - IFS=: pkg_spec=($1) - install_from_git "${pkg_spec[1]}" "${pkg_spec[2]}" - ;; - # Otherwise just pass the other deps through to the constrained pip install - *) - passthrough_args+=("$1") - ;; - esac - shift 1 -done - -# If *only* had special args then then isn't any need to run pip. -if [ -n "$passthrough_args" ] ; then - pip_install "${passthrough_args[@]}" -fi diff --git a/tox.ini b/tox.ini index 8f455c8..472593f 100644 --- a/tox.ini +++ b/tox.ini @@ -7,14 +7,15 @@ setenv = VIRTUAL_ENV={envdir} BRANCH_NAME=master CLIENT_NAME=cliff -passenv = - ZUUL_CACHE_DIR distribute = False -install_command = {toxinidir}/tools/tox_install.sh {env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/pike} {opts} {packages} +install_command = pip install {opts} {packages} commands = python setup.py test --coverage --coverage-package-name=cliff --slowest --testr-args='{posargs}' coverage report --show-missing -deps = -r{toxinidir}/test-requirements.txt +deps = + -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/pike} + -r{toxinidir}/test-requirements.txt + -r{toxinidir}/requirements.txt [testenv:pep8] deps = flake8 -- cgit v1.2.1