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