[PATCHv2] Only pylint files that are in the git working copy
Vratislav Podzimek
vpodzime at redhat.com
Mon Mar 17 08:41:16 UTC 2014
On Fri, 2014-03-14 at 17:10 -0400, David Shea wrote:
> ---
> 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
ACK. This looks so much better than the awk way!
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
More information about the anaconda-patches
mailing list