Permalink
Browse files

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
  • Loading branch information...
1 parent 24ff867 commit 4d6238ceb47188a856cddb7a66650abda6c22b1c @ChenZhengeasystack ChenZhengeasystack committed Feb 27, 2014
Showing with 45 additions and 16 deletions.
  1. +7 −7 requirements.txt
  2. +5 −9 test-requirements.txt
  3. +32 −0 tools/requirements_style_check.sh
  4. +1 −0 tox.ini
View
@@ -1,24 +1,24 @@
-pbr>=0.6,<1.0
# Horizon Core Requirements
Django>=1.4,<1.6
django_compressor>=1.3
django_openstack_auth>=1.1.3
eventlet>=0.13.0
+iso8601>=0.1.8
kombu>=2.4.8
lesscpy>=0.9j
-iso8601>=0.1.8
+# Horizon Utility Requirements
+# for SECURE_KEY generation
+lockfile>=0.8
netaddr>=0.7.6
+pbr>=0.6,<1.0
+python-ceilometerclient>=1.0.6
python-cinderclient>=1.0.6
python-glanceclient>=0.9.0
python-heatclient>=0.2.3
python-keystoneclient>=0.6.0
-python-novaclient>=2.15.0
python-neutronclient>=2.3.4,<3
+python-novaclient>=2.15.0
python-swiftclient>=1.6
-python-ceilometerclient>=1.0.6
python-troveclient>=1.0.3
pytz>=2010h
six>=1.5.2
-# Horizon Utility Requirements
-# for SECURE_KEY generation
-lockfile>=0.8
View
@@ -1,18 +1,14 @@
-hacking>=0.8.0,<0.9
-
-# Testing Requirements
coverage>=3.6
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
nose
nose-exclude
+nosehtmloutput>=0.0.3
nosexcover
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
+selenium
+sphinx>=1.1.2,<1.2 # Docs Requirements
testtools>=0.9.34
@@ -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
@@ -18,6 +18,7 @@ commands = /bin/bash run_tests.sh -N --no-pep8
[testenv:pep8]
commands = /bin/bash run_tests.sh -N --pep8
+ {toxinidir}/tools/requirements_style_check.sh requirements.txt test-requirements.txt
[testenv:venv]
commands = {posargs}

0 comments on commit 4d6238c

Please sign in to comment.