diff --git a/requirements.txt b/requirements.txt index 2f54179e..c21ca621 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,8 @@ -pbr>=0.6,<1.0 argparse iso8601>=0.1.8 +pbr>=0.6,<1.0 PrettyTable>=0.7,<0.8 python-keystoneclient>=0.6.0 PyYAML>=3.1.0 -six>=1.4.1 requests>=1.1 +six>=1.4.1 diff --git a/test-requirements.txt b/test-requirements.txt index 8202de34..d85a7b9e 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,11 +1,11 @@ -# Hacking already pins down pep8, pyflakes and flake8 -hacking>=0.8.0,<0.9 coverage>=3.6 discover fixtures>=0.3.14 +# Hacking already pins down pep8, pyflakes and flake8 +hacking>=0.8.0,<0.9 mock>=1.0 mox3>=0.7.0 sphinx>=1.1.2,<1.2 -testscenarios>=0.4 testrepository>=0.0.18 +testscenarios>=0.4 testtools>=0.9.34 diff --git a/tools/requirements_style_check.sh b/tools/requirements_style_check.sh new file mode 100755 index 00000000..ccbff3bd --- /dev/null +++ b/tools/requirements_style_check.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# +# Enforce the requirement that dependencies are listed in the input +# files in alphabetical order. + +# FIXME(dhellmann): This doesn't deal with URL requirements very +# well. We should probably sort those on the egg-name, rather than the +# full line. + +function check_file() { + typeset f=$1 + + # We don't care about comment lines. + grep -v '^#' $f > ${f}.unsorted + sort -i -f ${f}.unsorted > ${f}.sorted + diff -c ${f}.unsorted ${f}.sorted + rc=$? + rm -f ${f}.sorted ${f}.unsorted + return $rc +} + +exit_code=0 +for filename in $@ +do + check_file $filename + if [ $? -ne 0 ] + then + echo "Please list requirements in $filename in alphabetical order" 1>&2 + exit_code=1 + fi +done +exit $exit_code diff --git a/tox.ini b/tox.ini index 98100ae8..6e02d81d 100644 --- a/tox.ini +++ b/tox.ini @@ -13,6 +13,7 @@ commands = python setup.py testr --slowest --testr-args='{posargs}' [testenv:pep8] commands = flake8 + {toxinidir}/tools/requirements_style_check.sh requirements.txt test-requirements.txt [testenv:venv] commands = {posargs}