[chirp_devel] [PATCH 1/6] Improve cpep8 scripts (#2355)

Zachary T Welch
Wed Mar 4 23:19:08 PST 2015


From: Zach Welch <zach at mandolincreekfarm.com>

# HG changeset patch
# User Zach Welch <zach at mandolincreekfarm.com>
# Fake Node ID eeb698d50d058dd6d30ede9507c0809dff6ecfe1

Improve cpep8 scripts (#2355)

This patch adds prints to cpep8.py's scanning function.  It's useful to
know what files the script is scanning during an update, as the in-tree
virtualenv (or other files) may be included by accident.

This patch also fixes cpep8.sh to use the correct path to cpep8.py,
allowing it to be run from anywhere in the source tree.

diff --git a/tools/cpep8.py b/tools/cpep8.py
index fb1ff48..2bf55d0 100755
--- a/tools/cpep8.py
+++ b/tools/cpep8.py
@@ -90,12 +90,14 @@ def get_exceptions(f):
     return ignore
 
 if args.update:
+    print "Starting update of %d files" % len(manifest)
     bad = []
     for f in manifest:
         checker = pep8.StyleGuide(quiet=True, ignore=get_exceptions(f))
         results = checker.check_files([f])
         if results.total_errors:
             bad.append(f)
+        print "%s: %s" % (results.total_errors and "FAIL" or "PASS", f)
 
     with file(blacklist_filename, "w") as fh:
         print >>fh, """\
diff --git a/tools/cpep8.sh b/tools/cpep8.sh
index 88a7af9..89fd9ac 100755
--- a/tools/cpep8.sh
+++ b/tools/cpep8.sh
@@ -17,5 +17,5 @@ fi
 
 source ${VENV}/bin/activate
 pip install pep8==${PEP8_VERSION} >${VENV}/pep8.log 2>&1
-./tools/cpep8.py "$@"
+${TOOLS_DIR}/cpep8.py "$@"
 deactivate




More information about the chirp_devel mailing list