- if check_config:
- print '\tauto'
- removeFiles(['wrap_chkconfig.ltx', 'chkconfig.vars', \
- 'chkconfig.classes', 'chklayouts.tex'])
- rmcopy = False
- if not os.path.isfile( 'chkconfig.ltx' ):
- shutil.copyfile( os.path.join(srcdir, 'chkconfig.ltx'), 'chkconfig.ltx' )
- rmcopy = True
- writeToFile('wrap_chkconfig.ltx', '%s\n%s\n\\input{chkconfig.ltx}\n' \
- % (linuxdoc_cmd, docbook_cmd) )
- # 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')
- testclasses = list()
- for file in glob.glob( os.path.join('layouts', '*.layout') ) + \
- glob.glob( os.path.join(srcdir, 'layouts', '*.layout' ) ) :
- if not os.path.isfile(file):
- continue
- classname = file.split(os.sep)[-1].split('.')[0]
- for line in open(file).readlines():
- if p1.search(line) == None:
- continue
- if line[0] != '#':
- print "Wrong input layout file with line '" + line
- sys.exit(3)
- testclasses.append("\\TestDocClass{%s}{%s}" % (classname, line[1:].strip()))
- break
- testclasses.sort()
- cl = open('chklayouts.tex', 'w')
- for line in testclasses:
- cl.write(line + '\n')
- cl.close()
- #
- # we have chklayouts.tex, then process it
- fout = os.popen(LATEX + ' wrap_chkconfig.ltx')
- while True:
- line = fout.readline()
- if not line:
- break;
- if re.match('^\+', line):
- print line,
- fout.close()
- #
- # currently, values in chhkconfig are only used to set
- # \font_encoding
- values = {}
- for line in open('chkconfig.vars').readlines():
- key, val = re.sub('-', '_', line).split('=')
- val = val.strip()
- values[key] = val.strip("'")
- # chk_fontenc may not exist
- try:
- addToRC(r'\font_encoding "%s"' % values["chk_fontenc"])
- except:
- pass
- if rmcopy: # remove the copied file
- removeFiles( [ 'chkconfig.ltx' ] )
- # if configure successed, move textclass.lst.tmp to textclass.lst
- # and packages.lst.tmp to packages.lst
- if os.path.isfile('textclass.lst.tmp') and len(open('textclass.lst.tmp').read()) > 0 \
- and os.path.isfile('packages.lst.tmp') and len(open('packages.lst.tmp').read()) > 0:
- shutil.move('textclass.lst.tmp', 'textclass.lst')
- shutil.move('packages.lst.tmp', 'packages.lst')
-
-
-def createLaTeXConfig():
- ''' create LaTeXConfig.lyx '''
- # if chkconfig.sed does not exist (because LaTeX did not run),
- # then provide a standard version.
- if not os.path.isfile('chkconfig.sed'):
- writeToFile('chkconfig.sed', 's!@.*@!???!g\n')
- print "creating packages.lst"
- # if packages.lst does not exist (because LaTeX did not run),
- # then provide a standard version.
- if not os.path.isfile('packages.lst'):
- writeToFile('packages.lst', '''
-### This file should contain the list of LaTeX packages that have been
-### recognized by LyX. Unfortunately, since configure could not find
-### your LaTeX2e program, the tests have not been run. Run ./configure.py
-### if you need to update it after a configuration change.
-''')
- print 'creating doc/LaTeXConfig.lyx'
- #
- # This is originally done by sed, using a
- # tex-generated file chkconfig.sed
- ##sed -f chkconfig.sed ${srcdir}/doc/LaTeXConfig.lyx.in
- ## >doc/LaTeXConfig.lyx
- # Now, we have to do it by hand (python).
- #
- # add to chekconfig.sed
- writeToFile('chkconfig.sed', '''s!@chk_linuxdoc@!%s!g
-s!@chk_docbook@!%s!g
- ''' % (chk_linuxdoc, chk_docbook) , append=True)
- # process this sed file!!!!
- lyxin = open( os.path.join(srcdir, 'doc', 'LaTeXConfig.lyx.in')).readlines()
- # get the rules
- p = re.compile(r's!(.*)!(.*)!g')
- # process each sed replace.
- for sed in open('chkconfig.sed').readlines():
- if sed.strip() == '':
+ logger.info(msg + '\tauto')
+ removeFiles(['wrap_chkconfig.ltx', 'chkconfig.vars', \
+ 'chkconfig.classes', 'chklayouts.tex'])
+ rmcopy = False
+ if not os.path.isfile( 'chkconfig.ltx' ):
+ shutil.copyfile( os.path.join(srcdir, 'chkconfig.ltx'), 'chkconfig.ltx' )
+ rmcopy = True
+ writeToFile('wrap_chkconfig.ltx', '%s\n\\input{chkconfig.ltx}\n' % docbook_cmd)
+ # Construct the list of classes to test for.
+ # build the list of available layout files and convert it to commands
+ # for chkconfig.ltx
+ 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' ) ) :
+ if not os.path.isfile(file):