- 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)
- 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):
- logger.info(line.strip())
- # if the command succeeds, None will be returned
- ret = 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')
- return ret
+ if line[0] != '#':
+ logger.error("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):
+ logger.info(line.strip())
+ # if the command succeeds, None will be returned
+ ret = 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')
+ return ret