From c6b1c8ef8af97c375fc72299d5b4604f546d95d2 Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Fri, 19 Aug 2011 16:34:08 +0200
Subject: [PATCH] check-news: Show per-file line number
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

… not the global line number.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: RenΓ© Nussbaumer <rn@google.com>
---
 autotools/check-news | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/autotools/check-news b/autotools/check-news
index 879400c09..51a0403ac 100755
--- a/autotools/check-news
+++ b/autotools/check-news
@@ -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
 
-- 
GitLab