check-news: Show per-file line number
authorMichael Hanselmann <hansmi@google.com>
Fri, 19 Aug 2011 14:34:08 +0000 (16:34 +0200)
committerMichael Hanselmann <hansmi@google.com>
Fri, 19 Aug 2011 14:51:22 +0000 (16:51 +0200)
… not the global line number.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

autotools/check-news

index 879400c..51a0403 100755 (executable)
@@ -51,7 +51,7 @@ def main():
 
     if DASHES_RE.match(line):
       if not prevline.startswith("Version "):
-        raise Exception("Line %s: Invalid title" % (fileinput.lineno() - 1))
+        raise Exception("Line %s: Invalid title" % (fileinput.filelineno() - 1))
       expect_date = True
 
     elif expect_date:
@@ -66,7 +66,8 @@ def main():
 
       m = RELEASED_RE.match(line)
       if not m:
-        raise Exception("Line %s: Invalid release line" % fileinput.lineno())
+        raise Exception("Line %s: Invalid release line" %
+                        fileinput.filelineno())
 
       # Including the weekday in the date string does not work as time.strptime
       # would return an inconsistent result if the weekday is incorrect.
@@ -77,7 +78,8 @@ def main():
       # Check weekday
       if m.group("day") != weekday:
         raise Exception("Line %s: %s was/is a %s, not %s" %
-                        (fileinput.lineno(), parsed, weekday, m.group("day")))
+                        (fileinput.filelineno(), parsed, weekday,
+                         m.group("day")))
 
       expect_date = False