-#! /usr/bin/env python
+#! /usr/bin/env python -tt
#
# file configure.py
# This file is part of LyX, the document processor.
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'],
#
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 "" ""')
#
# 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" ""
''')
\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"
''')
# 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
-#! /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>
# 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']
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
-#! /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>
<<listerrors>>=
\newline
-#!/usr/bin/python
+#!/usr/bin/python -tt
\newline
"""reformat noweb and compiler errors for LyX.
\newline
-#! /usr/bin/env python
+#! /usr/bin/env python -tt
# -*- coding: utf-8 -*-
'''
-#! /usr/bin/env python
+#! /usr/bin/env python -tt
# -*- coding: iso-8859-1 -*-
# Copyright (C) 2002-2004 José Matos <jamatos@lyx.org>
#
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':
-#! /usr/bin/env python
+#! /usr/bin/env python -tt
# -*- coding: iso-8859-1 -*-
# Copyright (C) 2004 José Matos <jamatos@lyx.org>
#
-#!/usr/bin/env python
+#!/usr/bin/env python -tt
# -*- coding: iso-8859-15 -*-
# file TeXFiles.py
-#! /usr/bin/env python
+#! /usr/bin/env python -tt
'''
file clean_dvi.py
-#!/usr/bin/env python
+#!/usr/bin/env python -tt
# -*- coding: iso-8859-15 -*-
# file convertDefault.py
-#! /usr/bin/env python
+#! /usr/bin/env python -tt
# file fen2ascii.py
# This file is part of LyX, the document processor.
-#!/usr/bin/env python
+#!/usr/bin/env python -tt
# -*- coding: iso-8859-15 -*-
# file fig2pdf.py
-#!/usr/bin/env python
+#!/usr/bin/env python -tt
# -*- coding: iso-8859-15 -*-
# file fig2pstex.py
-#!/usr/bin/env python
+#!/usr/bin/env python -tt
# -*- coding: iso-8859-15 -*-
# file fig_copy.py
-#! /usr/bin/env python
+#! /usr/bin/env python -tt
# -*- coding: iso-8859-1 -*-
# file layout2layout.py
-#! /usr/bin/env python
+#! /usr/bin/env python -tt
# -*- coding: iso-8859-1 -*-
# file legacy_lyxpreview2ppm.py
-#! /usr/bin/env python
+#! /usr/bin/env python -tt
# -*- coding: iso-8859-1 -*-
# file lyxpreview2bitmap.py
-#! /usr/bin/env python
+#! /usr/bin/env python -tt
# file lyxpreview_tools.py
# This file is part of LyX, the document processor.
-#! /usr/bin/env python
+#! /usr/bin/env python -tt
# -*- coding: iso-8859-1 -*-
# file tex_copy.py
return false;
}
ostringstream command;
- command << "python " << quoteName(lyx2lyx)
+ command << os::python() << ' ' << quoteName(lyx2lyx)
<< " -t " << convert<string>(LYX_FORMAT)
<< " -o " << quoteName(tmpfile) << ' '
<< quoteName(filename);
#include "support/filetools.h"
#include "support/lyxlib.h"
+#include "support/os.h"
#include "support/path.h"
#include "support/systemcall.h"
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) +
#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"
Path p(package().user_support());
Systemcall one;
one.startscript(Systemcall::Wait,
- "python " +
+ lyx::support::os::python() + ' ' +
quoteName(libFileSearch("scripts", "TeXFiles.py")));
}
#include "support/convert.h"
#include "support/lstrings.h"
#include "support/lyxlib.h"
+#include "support/os.h"
#include <boost/bind.hpp>
// 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"
if (!success) {
script_command_ =
- "python " +
+ support::os::python() + ' ' +
quoteName(libFileSearch("scripts", "convertDefault.py")) +
' ' +
quoteName((from_format.empty() ? "" : from_format + ':') + from_file) +
// 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);
}
/*
A typical script looks like:
-#!/usr/bin/env python
+#!/usr/bin/env python -tt
import os, sys
def unlinkNoThrow(file):
#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;
}
std::ostringstream command;
- command << "python " << quoteName(script)
+ command << lyx::support::os::python() << ' ' << quoteName(script)
<< ' ' << quoteName(filename)
<< ' ' << quoteName(tempfile);
string const command_str = command.str();
#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;
+}
+
+}
+}
+}
///
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);
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]