texlive[71598] Build/source/texk/web2c/tests/fix-changefile-lines.py:

commits+ascherer at tug.org commits+ascherer at tug.org
Sun Jun 23 17:27:20 CEST 2024


Revision: 71598
          https://tug.org/svn/texlive?view=revision&revision=71598
Author:   ascherer
Date:     2024-06-23 17:27:20 +0200 (Sun, 23 Jun 2024)
Log Message:
-----------
Try to match error messages with CWEB.

We could
(a) calculate the distance of a mismatch and print
    "! Hmm... N of the preceeding lines failed to match."
(b) issue a warning/error about a missing @z.

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/tests/fix-changefile-lines.py

Modified: trunk/Build/source/texk/web2c/tests/fix-changefile-lines.py
===================================================================
--- trunk/Build/source/texk/web2c/tests/fix-changefile-lines.py	2024-06-23 13:57:04 UTC (rev 71597)
+++ trunk/Build/source/texk/web2c/tests/fix-changefile-lines.py	2024-06-23 15:27:20 UTC (rev 71598)
@@ -127,9 +127,7 @@
                 while True:
                     self._pos += 1
                     if self._pos >= len(self._lines):
-                        eprint(
-                            f"ERROR: Missing @y for @x on l.{self._chunk_start + 1} in change file"
-                        )
+                        eprint(f"! Change file ended before @y. (l. {self._pos+1} of change file)")
                         sys.exit(1)
                     line = self._lines[self._pos]
                     if line.startswith("@y"):
@@ -137,6 +135,10 @@
                             self._chunk_start + 1 : self._pos
                         ]
                         return True
+                    elif line.startswith("@x") or line.startswith("@z"):
+                        eprint(f"! Where is the matching @y?. (l. {self._pos+1} of change file)")
+                        eprint(line)
+                        sys.exit(1)
             self._pos += 1
         return False
 
@@ -149,8 +151,8 @@
             try:
                 (part, section, line_number), tex_line = web_reader.next_line()
             except:
-                eprint("ERROR: Could not find match for line:")
-                eprint(f"  {self._match_lines[0]}")
+                eprint(f"! Change file entry did not match. (l. {self._chunk_start+2} of change file)")
+                eprint(self._match_lines[0])
                 sys.exit(1)
             if tex_line == self._match_lines[0]:
                 for i in range(1, len(self._match_lines)):
@@ -159,8 +161,8 @@
                     except:
                         tex_line = None
                     if tex_line is None or tex_line != self._match_lines[i]:
-                        eprint("ERROR: Could not match all lines following match line:")
-                        eprint(f"  {self._match_lines[0]}")
+                        eprint(f"! Change file entry did not match. (l. {self._chunk_start+2+i} of change file)")
+                        eprint(self._match_lines[i])
                         sys.exit(1)
 
                 return part, section, line_number



More information about the tex-live-commits mailing list.