File: pyflakes.sh

package info (click to toggle)
game-data-packager 73
  • links: PTS, VCS
  • area: contrib
  • in suites: bookworm
  • size: 23,420 kB
  • sloc: python: 11,086; sh: 609; makefile: 59
file content (42 lines) | stat: -rwxr-xr-x 971 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/sh
# Copyright © 2022 Simon McVittie
# SPDX-License-Identifier: GPL-2.0-or-later

echo "TAP version 13"

if command -v pyflakes3 >/dev/null; then
    pyflakes=pyflakes3
elif command -v pyflakes3k >/dev/null; then
    pyflakes=pyflakes3k
elif command -v python3-pyflakes >/dev/null; then
    pyflakes=python3-pyflakes
elif command -v pyflakes-3 >/dev/null; then
    pyflakes=pyflakes-3
elif [ -x "$(ls -1 /usr/bin/pyflakes-python3.* 2>/dev/null | tail -n 1)" ]; then
    pyflakes="$(ls -1 /usr/bin/pyflakes-python3.* 2>/dev/null | tail -n 1)"
else
    echo "1..0 # SKIP pyflakes3 not found"
    exit 0
fi

cd "$GDP_SRCDIR"

export LC_ALL=C.UTF-8
n=0

for file in \
    game_data_packager/*.py \
    game_data_packager/*/*.py \
    runtime/*.py \
    tests/*.py \
    tools/*.py \
; do
    n=$(( n + 1 ))
    if "$pyflakes" "$file" >&2; then
        echo "ok $n $file"
    else
        echo "not ok $n $file # TODO warnings from pyflakes"
    fi
done

echo "1..$n"