2018-12-29 19:14:41 +00:00
|
|
|
#! /usr/bin/python3
|
2014-11-16 11:43:52 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
# file updatelayouts.py
|
|
|
|
# This file is part of LyX, the document processor.
|
|
|
|
# Licence details can be found in the file COPYING.
|
|
|
|
|
|
|
|
# author Georg Baum
|
|
|
|
|
|
|
|
# Full author contact details are available in file CREDITS
|
|
|
|
|
|
|
|
# This script converts all layout files to current format
|
|
|
|
# The old files are backuped with extension ".old"
|
|
|
|
|
|
|
|
|
|
|
|
import os, re, string, sys, subprocess, tempfile, shutil
|
|
|
|
|
|
|
|
sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), "../../lib/scripts"))
|
|
|
|
from layout2layout import main as layout2layout
|
|
|
|
|
|
|
|
def main(argv):
|
|
|
|
|
|
|
|
toolsdir = os.path.dirname(argv[0])
|
2017-10-13 14:08:23 +00:00
|
|
|
dirs = []
|
|
|
|
dirs.append(os.path.join(toolsdir, '../../lib/layouts'))
|
|
|
|
dirs.append(os.path.join(toolsdir, '../../lib/citeengines'))
|
|
|
|
for directory in dirs:
|
2019-09-04 14:50:07 +00:00
|
|
|
oldcwd = os.getcwd()
|
2017-10-13 14:08:23 +00:00
|
|
|
os.chdir(directory)
|
|
|
|
for i in os.listdir("."):
|
|
|
|
(base, ext) = os.path.splitext(i)
|
2023-01-07 14:43:47 +00:00
|
|
|
# Skip files like lib/layouts/TODO.txt
|
|
|
|
if ext in [ ".old", ".txt" ]:
|
2017-10-13 14:08:23 +00:00
|
|
|
continue
|
2018-12-29 19:14:41 +00:00
|
|
|
args = ["layout2layout", i + ".old", i]
|
2017-10-13 14:08:23 +00:00
|
|
|
shutil.copy(args[2], args[1])
|
|
|
|
layout2layout(args)
|
2019-09-04 14:50:07 +00:00
|
|
|
os.chdir(oldcwd)
|
2014-11-16 11:43:52 +00:00
|
|
|
|
|
|
|
return 0
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main(sys.argv)
|