lib/configure.py: fix CheckTexPaths

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14370 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Bo Peng 2006-07-08 02:50:24 +00:00
parent 136fc28dae
commit f8404ec837

View File

@ -84,30 +84,21 @@ def checkTeXPaths():
if os.name == 'nt' or sys.platform == 'cygwin': if os.name == 'nt' or sys.platform == 'cygwin':
from tempfile import mkstemp from tempfile import mkstemp
fd, tmpfname = mkstemp(suffix='.ltx') fd, tmpfname = mkstemp(suffix='.ltx')
# a wrapper file
wfd, wtmpfname = mkstemp(suffix='.ltx')
if os.name == 'nt': if os.name == 'nt':
inpname = tmpfname.replace('\\', '/') inpname = tmpfname.replace('\\', '/')
wtmpfname = wtmpfname.replace('\\', '/')
else: else:
inpname = cmdOutput('cygpath -m ' + tmpfname) inpname = cmdOutput('cygpath -m ' + tmpfname)
wtmpfname = cmdOutput('cygpath -m ' + wtmpfname) inpname = inpname.replace('~', '\\string~')
os.write(fd, r''' os.write(fd, r'\relax')
\relax
''')
os.close(fd) os.close(fd)
os.write(wfd, r'\nonstopmode\input{' + inpname.replace('~', '\\string~') + '}' ) latex_out = cmdOutput(r'latex "\nonstopmode\input{%s}"' % inpname)
os.close(wfd) if 'Error' in latex_out:
if cmdOutput('latex ' + wtmpfname).find('Error') != -1:
print "configure: TeX engine needs posix-style paths in latex files" print "configure: TeX engine needs posix-style paths in latex files"
windows_style_tex_paths = 'false' windows_style_tex_paths = 'false'
else: else:
print "configure: TeX engine needs windows-style paths in latex files" print "configure: TeX engine needs windows-style paths in latex files"
windows_style_tex_paths = 'true' windows_style_tex_paths = 'true'
tmpbname,ext = os.path.splitext(os.path.basename(tmpfname)) removeFiles([tmpfname, 'texput.log'])
wtmpbname,ext = os.path.splitext(os.path.basename(wtmpfname))
removeFiles( [ tmpfname, wtmpfname, tmpbname + '.log', \
tmpbname + '.aux', wtmpbname + '.log', wtmpbname + '.aux' ] )
return windows_style_tex_paths return windows_style_tex_paths