Sort requirement files in alphabetical order

This makes code more readable, and can check whether specific library
in the requirement files easily. We enforce the check in pep8, We also
add the tools for checking requirements.txt and test_requirements.txt.

Change-Id: Ia0a24553b7a5204faf6413c17dae6ba6aae2b5e8
Closes-Bug: #1285478
This commit is contained in:
ChenZheng 2014-02-27 14:22:18 +08:00
parent 24ff867af3
commit 4d6238ceb4
4 changed files with 45 additions and 16 deletions

View File

@ -1,24 +1,24 @@
pbr>=0.6,<1.0
# Horizon Core Requirements # Horizon Core Requirements
Django>=1.4,<1.6 Django>=1.4,<1.6
django_compressor>=1.3 django_compressor>=1.3
django_openstack_auth>=1.1.3 django_openstack_auth>=1.1.3
eventlet>=0.13.0 eventlet>=0.13.0
iso8601>=0.1.8
kombu>=2.4.8 kombu>=2.4.8
lesscpy>=0.9j lesscpy>=0.9j
iso8601>=0.1.8 # Horizon Utility Requirements
# for SECURE_KEY generation
lockfile>=0.8
netaddr>=0.7.6 netaddr>=0.7.6
pbr>=0.6,<1.0
python-ceilometerclient>=1.0.6
python-cinderclient>=1.0.6 python-cinderclient>=1.0.6
python-glanceclient>=0.9.0 python-glanceclient>=0.9.0
python-heatclient>=0.2.3 python-heatclient>=0.2.3
python-keystoneclient>=0.6.0 python-keystoneclient>=0.6.0
python-novaclient>=2.15.0
python-neutronclient>=2.3.4,<3 python-neutronclient>=2.3.4,<3
python-novaclient>=2.15.0
python-swiftclient>=1.6 python-swiftclient>=1.6
python-ceilometerclient>=1.0.6
python-troveclient>=1.0.3 python-troveclient>=1.0.3
pytz>=2010h pytz>=2010h
six>=1.5.2 six>=1.5.2
# Horizon Utility Requirements
# for SECURE_KEY generation
lockfile>=0.8

View File

@ -1,18 +1,14 @@
hacking>=0.8.0,<0.9
# Testing Requirements
coverage>=3.6 coverage>=3.6
django-nose django-nose
docutils==0.9.1 # for bug 1091333, remove after sphinx >1.1.3 is released.
hacking>=0.8.0,<0.9
mox>=0.5.3 mox>=0.5.3
nose nose
nose-exclude nose-exclude
nosehtmloutput>=0.0.3
nosexcover nosexcover
openstack.nose_plugin>=0.7 openstack.nose_plugin>=0.7
nosehtmloutput>=0.0.3
selenium
# Docs Requirements
sphinx>=1.1.2,<1.2
# for bug 1091333, remove after sphinx >1.1.3 is released.
docutils==0.9.1
oslo.sphinx oslo.sphinx
selenium
sphinx>=1.1.2,<1.2 # Docs Requirements
testtools>=0.9.34 testtools>=0.9.34

View File

@ -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

View File

@ -18,6 +18,7 @@ commands = /bin/bash run_tests.sh -N --no-pep8
[testenv:pep8] [testenv:pep8]
commands = /bin/bash run_tests.sh -N --pep8 commands = /bin/bash run_tests.sh -N --pep8
{toxinidir}/tools/requirements_style_check.sh requirements.txt test-requirements.txt
[testenv:venv] [testenv:venv]
commands = {posargs} commands = {posargs}