]> git.lyx.org Git - lyx.git/blob - development/tools/updatelayouts.py
Adapt ctest tagging rules to the changed file names of templates and examples.
[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         os.chdir(directory)
29         for i in os.listdir("."):
30             (base, ext) = os.path.splitext(i)
31             if ext == ".old":
32                 continue
33             args = ["layout2layout", i + ".old", i]
34             shutil.copy(args[2], args[1])
35             layout2layout(args)
36
37     return 0
38
39
40 if __name__ == "__main__":
41     main(sys.argv)