summaryrefslogtreecommitdiff
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)
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 @@
#!/bin/sh
# check python style (and 2 to 3 migration)
+#
+# behold, the worst lowest effort shell script
+# ...given that we have more generic checking
+# for executables in other scripts already
-rm python-lint.log
+existence()
+{
+ command -v "$1" >/dev/null 2>&1
+}
-if [ -e "python" ]
+# invoke from root of source!
+if [ $(basename $(pwd)) = "scripts" ]
then
- python --version >> python-lint.log
-fi
+ return 1
+else
+ if [ -e "python-lint.log" ]
+ then
+ rm "python-lint.log"
+ fi
-if [ -e "python2" ]
-then
- python2 --version >> python-lint.log
-fi
+ if existence python;
+ then
+ python --version >> python-lint.log
+ fi
-if [ -e "python3" ]
-then
- python3 --version >> python-lint.log
-fi
+ if existence python2;
+ then
+ python2 --version >> python-lint.log
+ fi
-flake8 >> python-lint.log
+ if existence python3;
+ then
+ python3 --version >> python-lint.log
+ fi
-2to3 -v -d . >> python-lint.log
-2to3 -v -p . >> python-lint.log
+ if existence python3.7;
+ then
+ python3.7 --version >> python-lint.log
+ fi
+
+ if existence flake8;
+ then
+ echo >> python-lint.log
+ echo "flake8:" >> python-lint.log
+ echo >> python-lint.log
+ flake8 >> python-lint.log
+ fi
+
+ if existence flake8-3.7;
+ then
+ echo >> python-lint.log
+ echo "flake8:" >> python-lint.log
+ echo >> python-lint.log
+ flake8-3.7 >> python-lint.log
+ fi
+
+ if existence 2to3;
+ then
+ echo >> python-lint.log
+ echo "2to3" >> python-lint.log
+ echo >> python-lint.log
+ 2to3 -v -d . >> python-lint.log
+ 2to3 -v -p . >> python-lint.log
+ fi
+
+ if existence 2to3-3.7;
+ then
+ echo >> python-lint.log
+ echo "2to3" >> python-lint.log
+ echo >> python-lint.log
+ 2to3-3.7 -v -d . >> python-lint.log
+ 2to3-3.7 -v -p . >> python-lint.log
+ fi
+fi