aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorng0 <ng0@n0.is>2019-03-04 13:49:36 +0000
committerng0 <ng0@n0.is>2019-03-04 13:49:36 +0000
commitd4cea440095e8447e89daef039fdf8f251f2663d (patch)
tree1e9f530fc84c5bd5f0797d290c6e2bd5e6c6b39d /contrib
parent8098bff056702fb65a5fd4b76e03468c43462fe5 (diff)
downloadgnunet-d4cea440095e8447e89daef039fdf8f251f2663d.tar.gz
gnunet-d4cea440095e8447e89daef039fdf8f251f2663d.zip
Make contrib/scripts/lint-python.sh useful
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/scripts/lint-python.sh82
1 files changed, 67 insertions, 15 deletions
diff --git a/contrib/scripts/lint-python.sh b/contrib/scripts/lint-python.sh
index 9f7e0462d..3325460f6 100755
--- a/contrib/scripts/lint-python.sh
+++ b/contrib/scripts/lint-python.sh
@@ -1,24 +1,76 @@
1#!/bin/sh 1#!/bin/sh
2# check python style (and 2 to 3 migration) 2# check python style (and 2 to 3 migration)
3#
4# behold, the worst lowest effort shell script
5# ...given that we have more generic checking
6# for executables in other scripts already
3 7
4rm python-lint.log 8existence()
9{
10 command -v "$1" >/dev/null 2>&1
11}
5 12
6if [ -e "python" ] 13# invoke from root of source!
14if [ $(basename $(pwd)) = "scripts" ]
7then 15then
8 python --version >> python-lint.log 16 return 1
9fi 17else
18 if [ -e "python-lint.log" ]
19 then
20 rm "python-lint.log"
21 fi
10 22
11if [ -e "python2" ] 23 if existence python;
12then 24 then
13 python2 --version >> python-lint.log 25 python --version >> python-lint.log
14fi 26 fi
15 27
16if [ -e "python3" ] 28 if existence python2;
17then 29 then
18 python3 --version >> python-lint.log 30 python2 --version >> python-lint.log
19fi 31 fi
20 32
21flake8 >> python-lint.log 33 if existence python3;
34 then
35 python3 --version >> python-lint.log
36 fi
22 37
232to3 -v -d . >> python-lint.log 38 if existence python3.7;
242to3 -v -p . >> python-lint.log 39 then
40 python3.7 --version >> python-lint.log
41 fi
42
43 if existence flake8;
44 then
45 echo >> python-lint.log
46 echo "flake8:" >> python-lint.log
47 echo >> python-lint.log
48 flake8 >> python-lint.log
49 fi
50
51 if existence flake8-3.7;
52 then
53 echo >> python-lint.log
54 echo "flake8:" >> python-lint.log
55 echo >> python-lint.log
56 flake8-3.7 >> python-lint.log
57 fi
58
59 if existence 2to3;
60 then
61 echo >> python-lint.log
62 echo "2to3" >> python-lint.log
63 echo >> python-lint.log
64 2to3 -v -d . >> python-lint.log
65 2to3 -v -p . >> python-lint.log
66 fi
67
68 if existence 2to3-3.7;
69 then
70 echo >> python-lint.log
71 echo "2to3" >> python-lint.log
72 echo >> python-lint.log
73 2to3-3.7 -v -d . >> python-lint.log
74 2to3-3.7 -v -p . >> python-lint.log
75 fi
76fi