Sort requirement files in alphabetical order
This makes code more readable, and can check whether specific library in the requirement files easily. We also enforce the check in pep8. Change-Id: I138b332102a94557f153f8982ec00d493e2472b0 Closes-Bug: #1285478
This commit is contained in:
parent
b24df35476
commit
07827ed717
|
@ -1,8 +1,8 @@
|
|||
pbr>=0.5.21,<1.0
|
||||
anyjson>=0.3.3
|
||||
argparse
|
||||
httplib2
|
||||
lxml>=2.3
|
||||
pbr>=0.5.21,<1.0
|
||||
PrettyTable>=0.7,<0.8
|
||||
python-keystoneclient>=0.4.2
|
||||
six>=1.4.1
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
hacking>=0.8.0,<0.9
|
||||
Babel>=1.3
|
||||
coverage>=3.6
|
||||
discover
|
||||
fixtures>=0.3.14
|
||||
hacking>=0.8.0,<0.9
|
||||
mock>=1.0
|
||||
Babel>=1.3
|
||||
python-subunit
|
||||
sphinx>=1.1.2,<1.2
|
||||
testrepository>=0.0.17
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue