[PATCHv2] Only pylint files that are in the git working copy

David Shea dshea at redhat.com
Fri Mar 14 21:10:11 UTC 2014


---
 tests/pylint/runpylint.sh | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tests/pylint/runpylint.sh b/tests/pylint/runpylint.sh
index 32328c1..e2a25d3 100755
--- a/tests/pylint/runpylint.sh
+++ b/tests/pylint/runpylint.sh
@@ -89,10 +89,16 @@ fi
 # run pylint one file / module at a time, otherwise it sometimes gets
 # confused
 if [ -z "$FILES" ]; then
-    # Find any file in the list of directories that either ends in .py
+    # Find any file in the git working tree that either ends in .py
     # or contains #!/usr/bin/python in the first line.
     # Scan everything except old_tests
-    FILES="$(find "${top_srcdir}" -type d -name old_tests -prune -o -type f \( -name '*.py' -o -exec awk -e 'NR==1 { if ($0 ~ /^#!\/usr\/bin\/python/) exit 0; else exit 1; }' -e 'END { if (NR == 0) exit 1; }' {} \; \) -print)"
+    for testfile in $(git ls-files -c "${top_srcdir}" | egrep -v '(^|/)old_tests/') ; do
+        if [ -f "${testfile}" ] && \
+                ( [ "${testfile%.py}" != "${testfile}" ] || \
+                  head -1 "${testfile}" | grep -q '^#!/usr/bin/python' ) ; then
+            FILES="$FILES $testfile"
+        fi
+    done
 fi
 
 num_cpus=$(getconf _NPROCESSORS_ONLN)
-- 
1.8.5.3



More information about the anaconda-patches mailing list