diff --git a/requirements.txt b/requirements.txt index 0c0239d95..245205db8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,10 +1,9 @@ -pbr>=0.6,<1.0 - -Flask>=0.10,<1.0 Flask-Gravatar +Flask>=0.10,<1.0 iso8601>=0.1.8 oslo.config>=1.2.0 paramiko>=1.8.0 +pbr>=0.6,<1.0 psutil>=1.1.1 PyGithub python-memcached>=1.48 diff --git a/test-requirements.txt b/test-requirements.txt index a0362b075..2a671e577 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,9 +1,8 @@ -hacking>=0.8.0,<0.9 - coverage>=3.6 discover docutils==0.9.1 fixtures>=0.3.14 +hacking>=0.8.0,<0.9 jsonschema>=2.0.0,<3.0.0 mock>=1.0 python-subunit diff --git a/tools/requirements_style_check.sh b/tools/requirements_style_check.sh new file mode 100755 index 000000000..ccbff3bdd --- /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 4e0bfe3bf..fe7624400 100644 --- a/tox.ini +++ b/tox.ini @@ -17,6 +17,7 @@ distribute = false [testenv:pep8] commands = flake8 + {toxinidir}/tools/requirements_style_check.sh requirements.txt test-requirements.txt distribute = false [testenv:venv]