From: Elan Ruusamäe Date: Mon, 31 Jan 2011 15:49:10 +0000 (+0000) Subject: - 1.602: py_lint: fail if no files processed (invalid find pipe) X-Git-Tag: auto/ac/rpm-build-macros-1_602-1 X-Git-Url: http://git.pld-linux.org/?p=packages%2Frpm-pld-macros.git;a=commitdiff_plain;h=5ba658ad02b5adc7a951b10cc754b63bbf4d4785 - 1.602: py_lint: fail if no files processed (invalid find pipe) Changed files: rpm-build-macros.spec -> 1.287 rpm.macros -> 1.602 --- diff --git a/rpm-build-macros.spec b/rpm-build-macros.spec index 7dd2b60..f58002a 100644 --- a/rpm-build-macros.spec +++ b/rpm-build-macros.spec @@ -1,10 +1,10 @@ -%define rpm_macros_rev 1.601 +%define rpm_macros_rev 1.602 %define find_lang_rev 1.34 Summary: PLD Linux RPM build macros Summary(pl.UTF-8): Makra do budowania pakietów RPM dla Linuksa PLD Name: rpm-build-macros Version: %{rpm_macros_rev} -Release: 2 +Release: 1 License: GPL Group: Development/Building Source0: rpm.macros diff --git a/rpm.macros b/rpm.macros index a52fcbb..2b63d6a 100644 --- a/rpm.macros +++ b/rpm.macros @@ -1867,7 +1867,7 @@ find "$@" -type f -name '*.py' | python -c ' \ import sys \ import compiler \ \ -err = 0\ +found = err = 0\ for f in sys.stdin: \ fd = open(f.strip()) \ c = fd.read() \ @@ -1878,7 +1878,10 @@ for f in sys.stdin: \ print "py_lint: %s: %s" % (f.strip(), e) \ err = err + 1\ \ -if err: \ +if not found:\ + print >> sys.stderr, "\\npy_lint: ERROR: No files processed.\\n" \ + sys.exit(1) \ +elif err: \ print >> sys.stderr, "\\npy_lint: ERROR: Syntax errors in %d files.\\n" % err \ sys.exit(1) \ else: \