Import newer version of the script upstream
This commit is contained in:
parent
cff03e6137
commit
12334a17c4
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#$Id$
|
#$Id$
|
||||||
#Copyright (c) 2014-2015 Pierre Pronchery <khorben@defora.org>
|
#Copyright (c) 2014-2016 Pierre Pronchery <khorben@defora.org>
|
||||||
#
|
#
|
||||||
#Redistribution and use in source and binary forms, with or without
|
#Redistribution and use in source and binary forms, with or without
|
||||||
#modification, are permitted provided that the following conditions are met:
|
#modification, are permitted provided that the following conditions are met:
|
||||||
|
@ -26,23 +26,46 @@
|
||||||
|
|
||||||
#variables
|
#variables
|
||||||
PROGNAME="pylint.sh"
|
PROGNAME="pylint.sh"
|
||||||
|
PROJECTCONF="../project.conf"
|
||||||
#executables
|
#executables
|
||||||
|
DATE="date"
|
||||||
DEBUG="_debug"
|
DEBUG="_debug"
|
||||||
FIND="find"
|
FIND="find"
|
||||||
PYLINT="pep8"
|
PYLINT="pep8"
|
||||||
SORT="sort"
|
SORT="sort"
|
||||||
|
TR="tr"
|
||||||
|
|
||||||
|
|
||||||
#functions
|
#functions
|
||||||
#pylint
|
#pylint
|
||||||
_pylint()
|
_pylint()
|
||||||
{
|
{
|
||||||
filename="$1"
|
subdirs="data doc src tests tools"
|
||||||
|
|
||||||
#XXX ignores errors
|
$DATE
|
||||||
$DEBUG $PYLINT -- "$filename" 2>&1 | while read line; do
|
echo
|
||||||
echo "$line" 1>&2
|
while read line; do
|
||||||
echo "$line"
|
case "$line" in
|
||||||
|
"["*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
"subdirs="*)
|
||||||
|
subdirs=${line#subdirs=}
|
||||||
|
subdirs=$(echo "$subdirs" | $TR ',' ' ')
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done < "$PROJECTCONF"
|
||||||
|
for subdir in $subdirs; do
|
||||||
|
[ -d "../$subdir" ] || continue
|
||||||
|
for filename in $($FIND "../$subdir" -name '*.py'); do
|
||||||
|
$DEBUG $PYLINT -- "$filename" 2>&1
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "$filename:"
|
||||||
|
else
|
||||||
|
#XXX ignore errors
|
||||||
|
echo "$PROGNAME: $filename: FAIL" 1>&2
|
||||||
|
fi
|
||||||
|
done
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,11 +116,5 @@ target="$1"
|
||||||
#clean
|
#clean
|
||||||
[ $clean -ne 0 ] && exit 0
|
[ $clean -ne 0 ] && exit 0
|
||||||
|
|
||||||
ret=0
|
|
||||||
exec 3>&1
|
exec 3>&1
|
||||||
(date
|
_pylint > "$target"
|
||||||
echo
|
|
||||||
$FIND "../doc" "../src" "../tests" "../tools" -name '*.py' | $SORT | while read filename; do
|
|
||||||
_pylint "$filename"
|
|
||||||
done) > "$target"
|
|
||||||
exit $ret
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user