Improve the error reporting, or checking, in configure.py.

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
This commit is contained in:
Richard Heck 2010-08-10 21:43:08 +00:00
parent e3e2568073
commit 7d8b56a21d

View 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()