On Mon, Jul 03, 2006 at 12:14:58PM +0200, Jean-Marc Lasgouttes wrote:

> I think it is more portable (and much simpler) to use the \nonstopmode
> macro at the beginning of the file.
> 
> Also, at a time when everybody wants to use only almost-prerelease
> software in LyX, code like
>       os.write(fd, r'''
>   \documentstyle{article}
>   \begin{document}\end{document}
>     ''')
> has a rather 1980's taste :) More seriously, initializing the
> whole latex machinery takes time.

Agreed.

> I am not in a position to test anything, but I'd propose a patch like
> the following. Enrico, could you check it?

It works. Now that we are at it, I also corrected the other occurrence
of -interaction=nonstopmode in configure.py. This last one cures an
annoying bug when LATEX=pplatex. I don't know why, but when launching
lyx from a cmd.exe terminal, pplatex doesn't like the -interaction switch
and causes latex to stall waiting for input. Specifically, this is what
happens:

C:\cygwin\tmp> pplatex -interaction=nonstopmode foo.tex
sed: no input files
This is e-TeX, Version 3.141592-2.2 (MiKTeX 2.4)
**

with the cursor next "**". This does not happen using a cygwin shell.
I don't know why sed is seemingly being called without arguments, or,
rather, why it is being called at all (no trace of sed in the sources).

In any case the patch takes care of this strange bug.
Please, find attached versions for both 1.4.x and 1.5.x (tested).

-- 
Enrico
Index: lib/configure.py
===================================================================
--- lib/configure.py    (revision 14311)
+++ lib/configure.py    (working copy)
@@ -85,17 +85,16 @@
     from tempfile import mkstemp
     fd, tmpfname = mkstemp(suffix='.ltx', dir='/tmp')
     os.write(fd, r'''
-\documentstyle{article}
-\begin{document}\end{document}
+\relax
   ''')
     os.close(fd)
     inpname = cmdOutput('cygpath -m ' + tmpfname)
     # a wrapper file
     wfd, wtmpfname = mkstemp(suffix='.ltx', dir='/tmp')
     wtmpfname = cmdOutput('cygpath -m ' + wtmpfname)
-    os.write(wfd, r'\input{' + inpname + '}' )
+    os.write(wfd, r'\nonstopmode\input{' + inpname + '}' )
     os.close(wfd)
-    if cmdOutput('latex -interaction=nonstopmode %s' % 
wtmpfname).find('Error') != -1:
+    if cmdOutput('latex %s' % wtmpfname).find('Error') != -1:
       print "configure: TeX engine needs posix-style paths in latex files"
       windows_style_tex_paths = 'false'
     else:
@@ -637,11 +636,11 @@
   tex_allows_spaces = 'false'
   if lyx_check_config:
     print "Checking whether TeX allows spaces in file names... ",
-    writeToFile('a b.tex', r'\message{working^^J}' )
+    writeToFile('a b.tex', r'\nonstopmode\message{working^^J}' )
     # FIXME: the bsh version uses < /dev/null which is not portable.
     # Can anyone confirm if this option (-interaction) is available
     # at other flavor of latex as well? (MikTex/win, Web2C/linux are fine.) 
-    if ''.join(cmdOutput(LATEX + ' -interaction=nonstopmode "a 
b"')).find('working') != -1:
+    if ''.join(cmdOutput(LATEX + ' "a b"')).find('working') != -1:
       print 'yes'
       tex_allows_spaces = 'true'
     else:
Index: lib/configure.py
===================================================================
--- lib/configure.py    (revision 14311)
+++ lib/configure.py    (working copy)
@@ -93,13 +93,12 @@
             inpname = cmdOutput('cygpath -m ' + tmpfname)
             wtmpfname = cmdOutput('cygpath -m ' + wtmpfname)
         os.write(fd, r'''
-\documentstyle{article}
-\begin{document}\end{document}
+\relax
     ''')
         os.close(fd)
-        os.write(wfd, r'\input{' + inpname.replace('~', '\\string~') + '}' )
+        os.write(wfd, r'\nonstopmode\input{' + inpname.replace('~', 
'\\string~') + '}' )
         os.close(wfd)
-        if cmdOutput('latex -interaction=nonstopmode ' + 
wtmpfname).find('Error') != -1:
+        if cmdOutput('latex ' + wtmpfname).find('Error') != -1:
             print "configure: TeX engine needs posix-style paths in latex 
files"
             windows_style_tex_paths = 'false'
         else:
@@ -641,11 +640,11 @@
     tex_allows_spaces = 'false'
     if lyx_check_config:
         print "Checking whether TeX allows spaces in file names... ",
-        writeToFile('a b.tex', r'\message{working^^J}' )
+        writeToFile('a b.tex', r'\nonstopmode\message{working^^J}' )
         # FIXME: the bsh version uses < /dev/null which is not portable.
         # Can anyone confirm if this option (-interaction) is available
         # at other flavor of latex as well? (MikTex/win, Web2C/linux are 
fine.) 
-        if ''.join(cmdOutput(LATEX + ' -interaction=nonstopmode "a 
b"')).find('working') != -1:
+        if ''.join(cmdOutput(LATEX + ' "a b"')).find('working') != -1:
             print 'yes'
             tex_allows_spaces = 'true'
         else:

Reply via email to