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: I08434dd56d41a82045e4119e547b7b3f60d66698 Closes-Bug: #1285478
This commit is contained in:
parent
8503781c67
commit
339f3e4de0
@ -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
|
||||
|
@ -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
|
||||
|
32
tools/requirements_style_check.sh
Executable file
32
tools/requirements_style_check.sh
Executable 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
|
Loading…
Reference in New Issue
Block a user