3 # Simple pre-commit hook to check that there are no errors in the fdroid
6 # Redirect output to stderr.
9 FILES="fdroid makebuildserver examples/*.py buildserver/*.py fdroidserver/*.py"
12 command -v $1 1>/dev/null
15 # For systems that switched to python3, first check for the python2 versions
16 if cmd_exists pyflakes-python2; then
17 PYFLAKES=pyflakes-python2
18 elif cmd_exists pyflakes; then
21 echo "pyflakes is not installed!"
24 if cmd_exists pep8-python2; then
26 elif cmd_exists pep8; then
29 echo "pep8 is not installed!"
32 # If there are python errors or warnings, print them and fail.
33 [ -n $PYFLAKES ] && $PYFLAKES $FILES
34 [ -n $PEP8 ] && $PEP8 --ignore=E123,E501 $FILES