configure.py : make sure latex exits gracefully

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39525 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Julien Rioux 2011-08-26 17:11:48 +00:00
parent 25258ea3e8
commit 7ea78193ca

View File

@ -117,9 +117,9 @@ def checkTeXPaths():
inpname = inpname.replace('~', '\\string~') inpname = inpname.replace('~', '\\string~')
os.write(fd, r'\relax') os.write(fd, r'\relax')
os.close(fd) os.close(fd)
latex_out = cmdOutput(r'latex "\nonstopmode\input{%s}"' % inpname) latex_out = cmdOutput(r'latex "\nonstopmode\input{%s}\makeatletter\@@end"' % inpname)
if 'Error' in latex_out: if 'Error' in latex_out:
latex_out = cmdOutput(r'latex "\nonstopmode\input{\"%s\"}"' % inpname) latex_out = cmdOutput(r'latex "\nonstopmode\input{\"%s\"}\makeatletter\@@end"' % inpname)
if 'Error' in latex_out: if 'Error' in latex_out:
logger.warning("configure: TeX engine needs posix-style paths in latex files") logger.warning("configure: TeX engine needs posix-style paths in latex files")
windows_style_tex_paths = 'false' windows_style_tex_paths = 'false'
@ -360,10 +360,7 @@ def checkLatex(dtl_tools):
path, PLATEX = checkProg('pLaTeX, the Japanese LaTeX', ['platex $$i']) path, PLATEX = checkProg('pLaTeX, the Japanese LaTeX', ['platex $$i'])
if PLATEX != '': if PLATEX != '':
# check if PLATEX is pLaTeX2e # check if PLATEX is pLaTeX2e
writeToFile('chklatex.ltx', ''' writeToFile('chklatex.ltx', r'\nonstopmode\makeatletter\@@end')
\\nonstopmode
\\@@end
''')
# run platex on chklatex.ltx and check result # run platex on chklatex.ltx and check result
if cmdOutput(PLATEX + ' chklatex.ltx').find('pLaTeX2e') != -1: if cmdOutput(PLATEX + ' chklatex.ltx').find('pLaTeX2e') != -1:
# We have the Japanese pLaTeX2e # We have the Japanese pLaTeX2e
@ -384,12 +381,13 @@ def checkLatex(dtl_tools):
# no latex # no latex
if LATEX != '': if LATEX != '':
# Check if latex is usable # Check if latex is usable
writeToFile('chklatex.ltx', ''' writeToFile('chklatex.ltx', r'''
\\nonstopmode\\makeatletter \nonstopmode
\\ifx\\undefined\\documentclass\\else \ifx\undefined\documentclass\else
\\message{ThisIsLaTeX2e} \message{ThisIsLaTeX2e}
\\fi \fi
\\@@end \makeatletter
\@@end
''') ''')
# run latex on chklatex.ltx and check result # run latex on chklatex.ltx and check result
if cmdOutput(LATEX + ' chklatex.ltx').find('ThisIsLaTeX2e') != -1: if cmdOutput(LATEX + ' chklatex.ltx').find('ThisIsLaTeX2e') != -1:
@ -410,12 +408,13 @@ def checkLuatex():
# luatex binary is there # luatex binary is there
msg = "checking if LuaTeX is usable ..." msg = "checking if LuaTeX is usable ..."
# Check if luatex is usable # Check if luatex is usable
writeToFile('luatest.tex', ''' writeToFile('luatest.tex', r'''
\\nonstopmode\\documentclass{minimal} \nonstopmode
\\usepackage{fontspec} \documentclass{minimal}
\\begin{document} \usepackage{fontspec}
\begin{document}
. .
\\end{document} \end{document}
''') ''')
# run lualatex on luatest.tex and check result # run lualatex on luatest.tex and check result
luatest = cmdOutput(LUATEX + ' luatest.tex') luatest = cmdOutput(LUATEX + ' luatest.tex')
@ -1273,9 +1272,9 @@ def checkTeXAllowSpaces():
writeToFile('a b.tex', r'\message{working^^J}' ) writeToFile('a b.tex', r'\message{working^^J}' )
if LATEX != '': if LATEX != '':
if os.name == 'nt' or sys.platform == 'cygwin': if os.name == 'nt' or sys.platform == 'cygwin':
latex_out = cmdOutput(LATEX + r""" "\nonstopmode\input{\"a b\"}" """) latex_out = cmdOutput(LATEX + r""" "\nonstopmode\input{\"a b\"}\makeatletter\@@end" """)
else: else:
latex_out = cmdOutput(LATEX + r""" '\nonstopmode\input{"a b"}' """) latex_out = cmdOutput(LATEX + r""" '\nonstopmode\input{"a b"}\makeatletter\@@end' """)
else: else:
latex_out = '' latex_out = ''
if 'working' in latex_out: if 'working' in latex_out: