3
# old versions of flake8 (trusty) cannot be called as python3 -m flake8
4
# newer versions can. Its preferable to run as python -m because
5
# that allows us to run explicitly python or python3.
8
any|cmd) mode="$1"; shift;;
11
if [ "$mode" = "cmd" ] ||
12
{ [ "$mode" = "any" ] && command -v flake8 >/dev/null; }; then
16
python|python2|python3) python="$1"; shift;;
19
cmd=( "$python" -m "flake8" )
24
# these dirs have python files that do not end in .py
25
for f in tools/* bin/*; do
26
[ -f "$f" -a "${f%.py}" = "$f" ] || continue
27
read line <"$f" && [ "${line#*python}" != "$line" ] &&
28
exes[${#exes[@]}]="$f"
30
files=( "${exes[@]}" setup.py simplestreams/ tools/ tests/ )
35
cmd=( "${cmd[@]}" "${files[@]}" )
37
echo -e "\nRunning flake8:"