]> git.lyx.org Git - features.git/commitdiff
Improve the error reporting, or checking, in configure.py.
authorRichard Heck <rgheck@comcast.net>
Tue, 10 Aug 2010 21:43:08 +0000 (21:43 +0000)
committerRichard Heck <rgheck@comcast.net>
Tue, 10 Aug 2010 21:43:08 +0000 (21:43 +0000)
There doesn't seem to be any way to report an error other than by
exiting.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35119 a592a061-630c-0410-9148-cb99ea01b6c8

lib/configure.py

index 05afc06712c87b22ab00129e4b9a112f5213b5ad..6ac45507b651b78a0ad4b71d4039ec03dab02c01 100644 (file)
@@ -992,7 +992,8 @@ def checkLatexConfig(check_config, bool_docbook):
     # Construct the list of classes to test for.
     # build the list of available layout files and convert it to commands
     # for chkconfig.ltx
-    p1 = re.compile(r'\Declare(LaTeX|DocBook)Class')
+    declare = re.compile(r'\Declare(LaTeX|DocBook)Class\s*(\[([^,]*)(,.*)*\])*\s*{(.*)}')
+    empty = re.compile(r'^\s*$')
     testclasses = list()
     for file in glob.glob( os.path.join('layouts', '*.layout') ) + \
         glob.glob( os.path.join(srcdir, 'layouts', '*.layout' ) ) :
@@ -1000,11 +1001,11 @@ def checkLatexConfig(check_config, bool_docbook):
             continue
         classname = file.split(os.sep)[-1].split('.')[0]
         for line in open(file).readlines():
-            if p1.search(line) == None:
-                continue
-            if line[0] != '#':
-                logger.error("Wrong input layout file with line '" + line)
+            if not empty.match(line) and line[0] != '#':
+                logger.error("Failed to find \Declare line for layout file `" + file + "'")
                 sys.exit(3)
+            if declare.search(line) == None:
+                continue
             testclasses.append("\\TestDocClass{%s}{%s}" % (classname, line[1:].strip()))
             break
     testclasses.sort()