]> git.lyx.org Git - features.git/commitdiff
Call python with the -tt switch to make mixed tab/space indentation an error
authorGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Fri, 30 Jun 2006 13:54:01 +0000 (13:54 +0000)
committerGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Fri, 30 Jun 2006 13:54:01 +0000 (13:54 +0000)
* src/support/os.[Ch]
(python): new function, return the python command

* lib/lyx2lyx/lyx_1_5.py
(revert_font_settings): replace tabs with spaces

The rest is simply s/python/python -tt/ and
s/"python"/lyx::support::os::python()/ where appropriate.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14270 a592a061-630c-0410-9148-cb99ea01b6c8

29 files changed:
lib/configure.py
lib/doc/Makefile.depend
lib/doc/depend.py
lib/doc/doc_toc.py
lib/examples/listerrors.lyx
lib/generate_contributions.py
lib/lyx2lyx/lyx2lyx
lib/lyx2lyx/lyx_1_5.py
lib/lyx2lyx/profiling.py
lib/scripts/TeXFiles.py
lib/scripts/clean_dvi.py
lib/scripts/convertDefault.py
lib/scripts/fen2ascii.py
lib/scripts/fig2pdftex.py
lib/scripts/fig2pstex.py
lib/scripts/fig_copy.py
lib/scripts/layout2layout.py
lib/scripts/legacy_lyxpreview2ppm.py
lib/scripts/lyxpreview2bitmap.py
lib/scripts/lyxpreview_tools.py
lib/scripts/tex_copy.py
src/buffer.C
src/converter.C
src/frontends/controllers/tex_helpers.C
src/graphics/GraphicsConverter.C
src/lyxtextclass.C
src/support/os.C
src/support/os.h
src/support/package.C.in

index 0b866144cccf901e452230ebeac3293bfe6f6dd4..463f57aee67c36070bc5e1a6cc1a2e5381829996 100644 (file)
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/env python -tt
 #
 # file configure.py
 # This file is part of LyX, the document processor.
@@ -183,7 +183,7 @@ def checkLatex():
             checkProg('DTL to DVI converter', ['dt2dv']) != ['', '']):
         # Windows only: DraftDVI
         converter_entry = r'''\converter latex      dvi2       "%%"    "latex"
-\converter dvi2       dvi        "python $$s/scripts/clean_dvi.py $$i $$o"     ""'''
+\converter dvi2       dvi        "python -tt $$s/scripts/clean_dvi.py $$i $$o" ""'''
     else:
         converter_entry = r'\converter latex      dvi        "%%"      "latex"'
     path, LATEX = checkProg('a Latex2e program', ['pplatex $$i', 'latex $$i', 'latex2e $$i'],
@@ -343,7 +343,7 @@ def checkConverterEntries():
     #
     path, dvipng = checkProg('dvipng', ['dvipng'])
     if dvipng == "dvipng":
-        addToRC(r'\converter lyxpreview png        "python $$s/scripts/lyxpreview2bitmap.py"   ""')
+        addToRC(r'\converter lyxpreview png        "python -tt $$s/scripts/lyxpreview2bitmap.py"       ""')
     else:
         addToRC(r'\converter lyxpreview png        ""  ""')
     #  
@@ -387,13 +387,13 @@ def checkConverterEntries():
     # checkProg('Image converter', ['convert $$i $$o'])
     #
     # Entried that do not need checkProg
-    addToRC(r'''\converter lyxpreview ppm        "python $$s/scripts/lyxpreview2bitmap.py"     ""
+    addToRC(r'''\converter lyxpreview ppm        "python -tt $$s/scripts/lyxpreview2bitmap.py" ""
 \converter date       dateout    "date +%d-%m-%Y > $$o"        ""
 \converter docbook    docbook-xml "cp $$i $$o" "xml"
-\converter fen        asciichess "python $$s/scripts/fen2ascii.py $$i $$o"     ""
-\converter fig        pdftex     "python $$s/scripts/fig2pdftex.py $$i $$o"    ""
-\converter fig        pstex      "python $$s/scripts/fig2pstex.py $$i $$o"     ""
-\converter lyx        lyx13x     "python $$s/lyx2lyx/lyx2lyx -t 221 $$i > $$o" ""
+\converter fen        asciichess "python -tt $$s/scripts/fen2ascii.py $$i $$o" ""
+\converter fig        pdftex     "python -tt $$s/scripts/fig2pdftex.py $$i $$o"        ""
+\converter fig        pstex      "python -tt $$s/scripts/fig2pstex.py $$i $$o" ""
+\converter lyx        lyx13x     "python -tt $$s/lyx2lyx/lyx2lyx -t 221 $$i > $$o"     ""
 ''')
 
 
@@ -456,9 +456,9 @@ def checkOtherEntries():
 \print_spool_command "lpr"''',
             ''])
     # Add the rest of the entries (no checkProg is required)
-    addToRC(r'''\copier    fig        "python $$s/scripts/fig_copy.py $$i $$o"
-\copier    pstex      "python $$s/scripts/tex_copy.py $$i $$o $$l"
-\copier    pdftex     "python $$s/scripts/tex_copy.py $$i $$o $$l"
+    addToRC(r'''\copier    fig        "python -tt $$s/scripts/fig_copy.py $$i $$o"
+\copier    pstex      "python -tt $$s/scripts/tex_copy.py $$i $$o $$l"
+\copier    pdftex     "python -tt $$s/scripts/tex_copy.py $$i $$o $$l"
 ''')
 
 
index 0a4b929fc8c08ab5c57b310972b77f61e16807ed..d378362232cd5850b4d63e5457c2c8e559bc5cb0 100644 (file)
@@ -5,60 +5,60 @@
 # TOCs target, which prints all the TOC files.
 
 TOC.lyx: $(srcdir)/Intro.lyx $(srcdir)/FAQ.lyx $(srcdir)/Tutorial.lyx $(srcdir)/UserGuide.lyx $(srcdir)/Extended.lyx $(srcdir)/Customization.lyx
-       PYTHONPATH=$(top_builddir)/lib/lyx2lyx python $(srcdir)/doc_toc.py
+       PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py
 
 cs_TOC.lyx: $(srcdir)/cs_Tutorial.lyx
-       PYTHONPATH=$(top_builddir)/lib/lyx2lyx python $(srcdir)/doc_toc.py cs
+       PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py cs
 
 da_TOC.lyx: $(srcdir)/da_Intro.lyx
-       PYTHONPATH=$(top_builddir)/lib/lyx2lyx python $(srcdir)/doc_toc.py da
+       PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py da
 
 de_TOC.lyx: $(srcdir)/de_Customization.lyx $(srcdir)/de_Extended.lyx $(srcdir)/de_FAQ.lyx $(srcdir)/de_Intro.lyx $(srcdir)/de_Tutorial.lyx $(srcdir)/de_UserGuide.lyx
-       PYTHONPATH=$(top_builddir)/lib/lyx2lyx python $(srcdir)/doc_toc.py de
+       PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py de
 
 es_TOC.lyx: $(srcdir)/es_Intro.lyx $(srcdir)/es_Tutorial.lyx
-       PYTHONPATH=$(top_builddir)/lib/lyx2lyx python $(srcdir)/doc_toc.py es
+       PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py es
 
 eu_TOC.lyx: $(srcdir)/eu_Customization.lyx $(srcdir)/eu_Extended.lyx $(srcdir)/eu_FAQ.lyx $(srcdir)/eu_Intro.lyx $(srcdir)/eu_Tutorial.lyx $(srcdir)/eu_UserGuide.lyx
-       PYTHONPATH=$(top_builddir)/lib/lyx2lyx python $(srcdir)/doc_toc.py eu
+       PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py eu
 
 fr_TOC.lyx: $(srcdir)/fr_Customization.lyx $(srcdir)/fr_Extended.lyx $(srcdir)/fr_FAQ.lyx $(srcdir)/fr_Intro.lyx $(srcdir)/fr_Tutorial.lyx $(srcdir)/fr_UserGuide.lyx
-       PYTHONPATH=$(top_builddir)/lib/lyx2lyx python $(srcdir)/doc_toc.py fr
+       PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py fr
 
 he_TOC.lyx: $(srcdir)/he_Intro.lyx $(srcdir)/he_Tutorial.lyx
-       PYTHONPATH=$(top_builddir)/lib/lyx2lyx python $(srcdir)/doc_toc.py he
+       PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py he
 
 hu_TOC.lyx: $(srcdir)/hu_Intro.lyx
-       PYTHONPATH=$(top_builddir)/lib/lyx2lyx python $(srcdir)/doc_toc.py hu
+       PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py hu
 
 it_TOC.lyx: $(srcdir)/it_Customization.lyx $(srcdir)/it_Intro.lyx $(srcdir)/it_Tutorial.lyx $(srcdir)/it_UserGuide.lyx
-       PYTHONPATH=$(top_builddir)/lib/lyx2lyx python $(srcdir)/doc_toc.py it
+       PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py it
 
 nb_TOC.lyx: $(srcdir)/nb_Intro.lyx
-       PYTHONPATH=$(top_builddir)/lib/lyx2lyx python $(srcdir)/doc_toc.py nb
+       PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py nb
 
 nl_TOC.lyx: $(srcdir)/nl_Intro.lyx $(srcdir)/nl_Tutorial.lyx
-       PYTHONPATH=$(top_builddir)/lib/lyx2lyx python $(srcdir)/doc_toc.py nl
+       PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py nl
 
 pl_TOC.lyx: $(srcdir)/pl_Extended.lyx $(srcdir)/pl_Intro.lyx $(srcdir)/pl_Tutorial.lyx
-       PYTHONPATH=$(top_builddir)/lib/lyx2lyx python $(srcdir)/doc_toc.py pl
+       PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py pl
 
 pt_TOC.lyx: $(srcdir)/pt_Intro.lyx $(srcdir)/pt_Tutorial.lyx
-       PYTHONPATH=$(top_builddir)/lib/lyx2lyx python $(srcdir)/doc_toc.py pt
+       PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py pt
 
 ro_TOC.lyx: $(srcdir)/ro_Intro.lyx
-       PYTHONPATH=$(top_builddir)/lib/lyx2lyx python $(srcdir)/doc_toc.py ro
+       PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py ro
 
 ru_TOC.lyx: $(srcdir)/ru_FAQ.lyx $(srcdir)/ru_Intro.lyx $(srcdir)/ru_Tutorial.lyx
-       PYTHONPATH=$(top_builddir)/lib/lyx2lyx python $(srcdir)/doc_toc.py ru
+       PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py ru
 
 sk_TOC.lyx: $(srcdir)/sk_Tutorial.lyx $(srcdir)/sk_UserGuide.lyx
-       PYTHONPATH=$(top_builddir)/lib/lyx2lyx python $(srcdir)/doc_toc.py sk
+       PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py sk
 
 sl_TOC.lyx: $(srcdir)/sl_Intro.lyx $(srcdir)/sl_Tutorial.lyx
-       PYTHONPATH=$(top_builddir)/lib/lyx2lyx python $(srcdir)/doc_toc.py sl
+       PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py sl
 
 sv_TOC.lyx: $(srcdir)/sv_Intro.lyx $(srcdir)/sv_Tutorial.lyx
-       PYTHONPATH=$(top_builddir)/lib/lyx2lyx python $(srcdir)/doc_toc.py sv
+       PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py sv
 
 tocfiles = TOC.lyx cs_TOC.lyx da_TOC.lyx de_TOC.lyx es_TOC.lyx eu_TOC.lyx fr_TOC.lyx he_TOC.lyx hu_TOC.lyx it_TOC.lyx nb_TOC.lyx nl_TOC.lyx pl_TOC.lyx pt_TOC.lyx ro_TOC.lyx ru_TOC.lyx sk_TOC.lyx sl_TOC.lyx sv_TOC.lyx
index 10f22bde47ee58250c7c2927def47ac5ad3c35a7..50df48a9056dee010ec9539b5dcb9882be3ff419 100644 (file)
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/env python -tt
 # -*- coding: iso-8859-1 -*-
 # This file is part of the LyX Documentation
 # Copyright (C) 2004 José Matos <jamatos@lyx.org>
@@ -68,7 +68,7 @@ def main(argv):
 
     # The default language is english and doesn't need any prefix
     print 'TOC.lyx: $(srcdir)/' + '.lyx $(srcdir)/'.join(possible_documents) + '.lyx'
-    print '\tPYTHONPATH=$(top_builddir)/lib/lyx2lyx python $(srcdir)/doc_toc.py'
+    print '\tPYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py'
     print
     tocs = ['TOC.lyx']
 
@@ -82,7 +82,7 @@ def main(argv):
         languages[lang].sort()
 
         print toc_name + ': $(srcdir)/' + ' $(srcdir)/'.join(languages[lang])
-        print '\tPYTHONPATH=$(top_builddir)/lib/lyx2lyx python $(srcdir)/doc_toc.py %s' % lang
+        print '\tPYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py %s' % lang
         print
 
     # Write meta-rule to call all the other rules
index 8fa2eedc47ccce989098d8ec675b058a3982bbda..15add7cbe344b4c9aa9379d062f54b5394c21bac 100755 (executable)
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/env python -tt
 # -*- coding: iso-8859-1 -*-
 # This file is part of the LyX Documentation
 # Copyright (C) 2004 José Matos <jamatos@lyx.org>
index 893c131ba947be17b4c8ff2ca23e7ec8c0bdedbd..075cbd8e1214b81d125b8691b26ef467cbc7623e 100644 (file)
@@ -268,7 +268,7 @@ listerrors
 
 <<listerrors>>=
 \newline
-#!/usr/bin/python
+#!/usr/bin/python -tt
 \newline
 """reformat noweb and compiler errors for LyX.
 \newline
index b4fc91533ad1f8a055b9d9ed34c5a23a34303ef1..6bba7cfaea9df8414c6f39e2e4bb6a43d5d3beff 100755 (executable)
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/env python -tt
 # -*- coding: utf-8 -*-
 
 '''
index ce0e45278d8a9ce536e24d399658763573082e50..d61e02e235ff378a18db421235759e247decc5dc 100755 (executable)
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/env python -tt
 # -*- coding: iso-8859-1 -*-
 # Copyright (C) 2002-2004 José Matos <jamatos@lyx.org>
 #
index 1598f636c5d2b9adf712e3e70d62bf6491877dc4..1ce73f661001304d6c51c24a6eb5e02b80c6c7a9 100644 (file)
@@ -139,9 +139,9 @@ def revert_font_settings(file):
             file.header.insert(insert_line, '\\fontscheme %s' % font_scheme)
             if font_default_family != 'default':
                 file.preamble.append('\\renewcommand{\\familydefault}{\\%s}' % font_default_family)
-           if font_osf == 'true':
+            if font_osf == 'true':
                 file.warning("Ignoring `\\font_osf = true'")
-           return
+            return
     font_scheme = 'default'
     file.header.insert(insert_line, '\\fontscheme %s' % font_scheme)
     if fonts['roman'] == 'cmr':
index b83ec6fc85d6447d749e4547bba9d0f241677331..01dcbc403d91d1dc30f392625e0144394abf7005 100755 (executable)
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/env python -tt
 # -*- coding: iso-8859-1 -*-
 # Copyright (C) 2004 José Matos <jamatos@lyx.org>
 #
index bf85ebf44d80f2fa9d21b1a81b5bfbd13e7973b8..5bff511d75e98b0138828dca4ce4ce1e9f4c4fd9 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python -tt
 # -*- coding: iso-8859-15 -*-
 
 # file TeXFiles.py
index 39fde890d27b5c4b34bc0801876c18380dcee6f6..3cd67da7bd17e9c1fdebb1d7d8252fe5b0340ee7 100644 (file)
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/env python -tt
 
 '''
 file clean_dvi.py
index acc0853321b5d3286e7c59a0d52771cdcf28c077..183007a854177c20932405e56473c175a51f5482 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python -tt
 # -*- coding: iso-8859-15 -*-
 
 # file convertDefault.py
index 96bd6e0e1c93424e242ae33aabcd3e99e993740e..ddf35593d234bad8f07fd0f64531b8facac66552 100644 (file)
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/env python -tt
 
 # file fen2ascii.py
 # This file is part of LyX, the document processor.
index 3be7004fdfa85dd0dc57a289e90895e0bf0a0b35..12ea958c4d9ab16cb9eedd077a875e6a0bac972d 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python -tt
 # -*- coding: iso-8859-15 -*-
 
 # file fig2pdf.py
index 54bd35558d69ff1670278ecea2cd20d8b58d128e..05d468b9020270b9c885df34b6cdd7a0df2f0269 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python -tt
 # -*- coding: iso-8859-15 -*-
 
 # file fig2pstex.py
index 3f8524c1c96f6fd5c15e910712d3c922672ac904..3c9d894a830bc8099f86f2fe448f513f72f1d54a 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python -tt
 # -*- coding: iso-8859-15 -*-
 
 # file fig_copy.py
index ff16f5cb962cad32a3ad0c165d5cd86e931fd0c6..0a9953d7f284549e0cefaca05871c83ed5c6c5b0 100644 (file)
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/env python -tt
 # -*- coding: iso-8859-1 -*-
 
 # file layout2layout.py
index f887b5c4dce96f95cfc027a034d62f1a8b49a0ee..8dc78ee9f110c017ea264160ef9fd513b08356a7 100644 (file)
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/env python -tt
 # -*- coding: iso-8859-1 -*-
 
 # file legacy_lyxpreview2ppm.py
index 245848fee230bfd3c4d7b422ca9f1908d5e42a62..a5ccc06a02de842ebdde9616fe81bfb26216dc2f 100755 (executable)
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/env python -tt
 # -*- coding: iso-8859-1 -*-
 
 # file lyxpreview2bitmap.py
index bab609706ad92e8df8cfe848e9af5c8ecf0db426..f3077e210107ffd15e7914da2999f4fdd7df6440 100644 (file)
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/env python -tt
 
 # file lyxpreview_tools.py
 # This file is part of LyX, the document processor.
index 6c634c115e10bac01f3ba1659fc790d1d009eb90..19ff5e479f41f5a169c6f3731f8fa4a13760482c 100644 (file)
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/env python -tt
 # -*- coding: iso-8859-1 -*-
 
 # file tex_copy.py
index a5c14f8ab1f87ac5a5acc90848dc99bc9dfeed60..7603751c806c842f5b523f166a2b314b5b05b331 100644 (file)
@@ -643,7 +643,7 @@ bool Buffer::readFile(LyXLex & lex, string const & filename)
                        return false;
                }
                ostringstream command;
-               command << "python " << quoteName(lyx2lyx)
+               command << os::python() << ' ' << quoteName(lyx2lyx)
                        << " -t " << convert<string>(LYX_FORMAT)
                        << " -o " << quoteName(tmpfile) << ' '
                        << quoteName(filename);
index d55633b0d30077970bab2c1cd945a0ba5495a20a..01da621ade4a1f2a2c0d707123fe50c3b9930407 100644 (file)
@@ -26,6 +26,7 @@
 
 #include "support/filetools.h"
 #include "support/lyxlib.h"
+#include "support/os.h"
 #include "support/path.h"
 #include "support/systemcall.h"
 
@@ -298,7 +299,7 @@ bool Converters::convert(Buffer const * buffer,
                                getExtension(from_file) :
                                formats.extension(from_format);
                        string const command =
-                               "python " +
+                               lyx::support::os::python() + ' ' +
                                quoteName(libFileSearch("scripts", "convertDefault.py")) +
                                ' ' +
                                quoteName(from_ext + ':' + from_file) +
index 6d0bd6f38129875ddde43d5dc3f44ef089c0063e..143f7d6f295f3adfb5bfcbe9a020eb6f7da7eac0 100644 (file)
@@ -17,6 +17,7 @@
 #include "support/filetools.h"
 #include "support/lstrings.h"
 #include "support/lyxalgo.h"
+#include "support/os.h"
 #include "support/package.h"
 #include "support/path.h"
 #include "support/systemcall.h"
@@ -52,7 +53,7 @@ void rescanTexStyles()
        Path p(package().user_support());
        Systemcall one;
        one.startscript(Systemcall::Wait,
-                       "python " +
+                       lyx::support::os::python() + ' ' +
                        quoteName(libFileSearch("scripts", "TeXFiles.py")));
 }
 
index 941aeb2a0ff1c531b28fb20c7b6c4c0d94b3fdfb..3bd1a1a29b1b7f0da868be63eade50103486fd68 100644 (file)
@@ -21,6 +21,7 @@
 #include "support/convert.h"
 #include "support/lstrings.h"
 #include "support/lyxlib.h"
+#include "support/os.h"
 
 #include <boost/bind.hpp>
 
@@ -161,7 +162,7 @@ Converter::Impl::Impl(string const & from_file,   string const & to_file_base,
 
        // The conversion commands are stored in a stringstream
        ostringstream script;
-       script << "#!/usr/bin/env python\n"
+       script << "#!/usr/bin/env python -tt\n"
                   << "import os, sys\n\n"
                   << "def unlinkNoThrow(file):\n"
                   << "  ''' remove a file, do not throw if an error occurs '''\n"
@@ -175,7 +176,7 @@ Converter::Impl::Impl(string const & from_file,   string const & to_file_base,
 
        if (!success) {
                script_command_ =
-                       "python " +
+                       support::os::python() + ' ' +
                        quoteName(libFileSearch("scripts", "convertDefault.py")) +
                        ' ' +
                        quoteName((from_format.empty() ? "" : from_format + ':') + from_file) +
@@ -214,7 +215,8 @@ Converter::Impl::Impl(string const & from_file,   string const & to_file_base,
                // We create a dummy command for ease of understanding of the
                // list of forked processes.
                // Note: 'sh ' is absolutely essential, or execvp will fail.
-               script_command_ = "python " + quoteName(script_file_) + ' ' +
+               script_command_ = support::os::python() + ' ' +
+                       quoteName(script_file_) + ' ' +
                        quoteName(onlyFilename(from_file)) + ' ' +
                        quoteName(to_format);
        }
@@ -286,7 +288,7 @@ string const move_file(string const & from_file, string const & to_file)
 /*
 A typical script looks like:
 
-#!/usr/bin/env python
+#!/usr/bin/env python -tt
 import os, sys
 
 def unlinkNoThrow(file):
index 5d87cf18237d4f2c9942221f58ccdc755ad0645e..95d6212f0a1af036d20fb212813c4e0e1fea2660 100644 (file)
@@ -24,6 +24,8 @@
 #include "support/lstrings.h"
 #include "support/lyxlib.h"
 #include "support/filetools.h"
+#include "support/os.h"
+
 #include <boost/filesystem/operations.hpp>
 namespace fs = boost::filesystem;
 
@@ -72,7 +74,7 @@ bool layout2layout(string const & filename, string const & tempfile)
        }
 
        std::ostringstream command;
-       command << "python " << quoteName(script)
+       command << lyx::support::os::python() << ' ' << quoteName(script)
                << ' ' << quoteName(filename)
                << ' ' << quoteName(tempfile);
        string const command_str = command.str();
index 9a82e62784b69f6627270d703c56686473f87c43..7d679dea43570abe374b76c78e411a93b61b0695 100644 (file)
 #else
 #include "os_unix.C"
 #endif
+
+namespace lyx {
+namespace support {
+namespace os {
+
+std::string const python()
+{
+       // Use the -tt switch so that mixed tab/whitespace indentation is
+       // an error
+       static std::string const command("python -tt");
+       return command;
+}
+
+}
+}
+}
index 1c29d57a20261e9229355434bbb18599721a224c..90cf569da2b1832709449d37204bb99021833587 100644 (file)
@@ -38,6 +38,9 @@ std::string current_root();
 ///
 shell_type shell();
 
+/// Name of the python interpreter
+std::string const python();
+
 /// Extract the path common to both @c p1 and @c p2. DBCS aware!
 std::string::size_type common_path(std::string const & p1, std::string const & p2);
 
index 86bcd69582c748f6f266732b0dd205aabb7994b2..dd35c5d969834eb2c29f2657a88816b58570591a 100644 (file)
@@ -152,7 +152,7 @@ Package::Package(string const & command_line_arg0,
                                     command_line_user_support_dir);
 
        string const configure_script = addName(system_support(), "configure.py");
-       configure_command_ = "python " + quoteName(configure_script)
+       configure_command_ = os::python() + ' ' + quoteName(configure_script)
                                       + with_version_suffix();
 
        lyxerr[Debug::INIT]