]> git.lyx.org Git - lyx.git/blob - development/tools/updatelayouts.py
updatedocs.py now updates templates and examples
[lyx.git] / development / tools / updatelayouts.py
1 #! /usr/bin/env python
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     layoutdir = os.path.join(toolsdir, '../../lib/layouts')
25     os.chdir(layoutdir)
26     for i in os.listdir("."):
27         (base, ext) = os.path.splitext(i)
28         if ext == ".old":
29             continue
30         args = ["layout2layout", i + ".old", i] 
31         shutil.copy(args[2], args[1])
32         layout2layout(args)
33
34     return 0
35
36
37 if __name__ == "__main__":
38     main(sys.argv)