]> git.lyx.org Git - lyx.git/blob - development/tools/updatelayouts.py
Add missing revert routine to lyx_2_0.py
[lyx.git] / development / tools / updatelayouts.py
1 #! /usr/bin/python3
2 # -*- coding: utf-8 -*-
3
4 # file updatelayouts.py
5 # This file is part of LyX, the document processor.
6 # Licence details can be found in the file COPYING.
7
8 # author Georg Baum
9
10 # Full author contact details are available in file CREDITS
11
12 # This script converts all layout files to current format
13 # The old files are backuped with extension ".old"
14
15
16 import os, re, string, sys, subprocess, tempfile, shutil
17
18 sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), "../../lib/scripts"))
19 from layout2layout import main as layout2layout
20
21 def main(argv):
22
23     toolsdir = os.path.dirname(argv[0])
24     dirs = []
25     dirs.append(os.path.join(toolsdir, '../../lib/layouts'))
26     dirs.append(os.path.join(toolsdir, '../../lib/citeengines'))
27     for directory in dirs:
28         oldcwd = os.getcwd()
29         os.chdir(directory)
30         for i in os.listdir("."):
31             (base, ext) = os.path.splitext(i)
32             if ext == ".old":
33                 continue
34             args = ["layout2layout", i + ".old", i]
35             shutil.copy(args[2], args[1])
36             layout2layout(args)
37         os.chdir(oldcwd)
38
39     return 0
40
41
42 if __name__ == "__main__":
43     main(sys.argv)