2 # -*- coding: utf-8 -*-
5 # This file is part of LyX, the document processor.
6 # Licence details can be found in the file COPYING.
10 # Full author contact details are available in file CREDITS
12 # This script converts documentation .lyx files to current format
13 # The old files are backuped with extension ".old"
16 import os, re, string, sys, subprocess, shutil
19 def convertdir(docdir, prefix, lyx2lyx):
22 for i in os.listdir("."):
24 subdir = os.path.join(docdir, i)
25 subprefix = os.path.join(prefix, i)
26 convertdir(subdir, subprefix, lyx2lyx)
28 (base, ext) = os.path.splitext(i)
33 if sys.executable and sys.executable != '':
34 cmd = [sys.executable, lyx2lyx, old, '-o', i]
36 # assume that python is in the path
37 cmd = [lyx2lyx, old, '-o', i]
38 sys.stderr.write('Converting %s\n' % os.path.join(prefix, i))
45 toolsdir = os.path.dirname(argv[0])
46 docdir = os.path.abspath(os.path.join(toolsdir, '../../lib/doc'))
47 lyx2lyx = os.path.abspath(os.path.join(toolsdir, "../../lib/lyx2lyx/lyx2lyx"))
48 convertdir(docdir, '', lyx2lyx)
53 if __name__ == "__main__":