]> git.lyx.org Git - lyx.git/blobdiff - lib/scripts/listerrors
Amend bd6d09fc
[lyx.git] / lib / scripts / listerrors
index 326702b3f376556f96820ae6bdd8188d2ace7e92..7d6995c5f51affada41b29dc1eac97ba8004f33c 100755 (executable)
@@ -1,32 +1,42 @@
-#!/usr/bin/python
+#!/usr/bin/python3
+
+# file listerrors
+# This file is part of LyX, the document processor.
+# Licence details can be found in the file COPYING.
+
+# author Kayvan A. Sylvan
+
+# Full author contact details are available in file CREDITS.
+
 """reformat noweb and compiler errors for LyX.
 
 Expects to read from stdin and output to stdout.
 """
 
 __author__ = "Kayvan A. Sylvan <kayvan@sylvan.com>"
-__date__ = "$Date: 2002/03/25 23:29:30 $"
-__version__ = "$Revision: 1.2 $"
+__date__ = "$Date: 2003/10/13 09:50:10 $"
+__version__ = "$Revision: 1.4 $"
 __credits__ = """Edmar Wienskoski Jr. <edmar-w-jr@technologist.com>
     original Literate support for LyX.
 Bernard Michael Hurley <berhardh@westherts.ac.uk>
     modifications to original listerrors."""
-__copyright__ = "Copyright 2002 - The LyX team."
+__copyright__ = "Copyright 2002 - Kayvan A. Sylvan."
 
+from __future__ import print_function
 import sys, string
 
 def write_error(msg, tool = "noweb", line_number = 1):
   """Write out the given message in TeX error style.
 
   called like: write_error(msg, tool, line_number)."""
-  print "! Build Error: ==> %s ==>\n" % (tool),
-  print " ...\n\nl.%d ...\n" % (line_number),
+  print ("! Build Error: ==> %s ==>" % tool)
+  print (" ...\n\nl.%d ..." % line_number)
   if type(msg) == type("str"): # simple string
-    print msg
+    print (msg)
   else: # some kind of list (sequence or tuple)
     for m in msg:
-        if m != "": print m,
-    print
+        if m != "": print (m, end=" ")
+    print ()
 
 __lines = [] # lines pushed back
 
@@ -53,12 +63,13 @@ def main():
 
   Reads stdin and writes to stdout. Filter errors"""
 
-  while 1:
+  while True:
     line = getline()
     if line == "": break
     try_patterns_dispatch = [ noweb_try, gcc_try, xlc_try ]
     for predicate in try_patterns_dispatch:
       if predicate(line): break
+
 def noweb_try(line):
   """see if line is a noweb error.
 
@@ -146,7 +157,7 @@ def xlc_try(line):
           write_error(line, "xlc", int(line[num_start : num_end]))
           retval = 1
   return retval
-  
+
 
 if __name__ == "__main__":
   main()