mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
Add utility to update documentation files
updatedocs.py is a small script that updates all documentation files to the current format.
This commit is contained in:
parent
f1032b1f4a
commit
051ebbcf40
@ -17,7 +17,11 @@ tools/gen_lfuns.py \
|
||||
tools/generate_symbols_images.lyx \
|
||||
tools/generate_symbols_images.py \
|
||||
tools/generate_symbols_list.py \
|
||||
tools/generate_symbols_svg.lyx \
|
||||
tools/generate_symbols_svg.py \
|
||||
tools/unicodesymbols.py \
|
||||
tools/updatedocs.py \
|
||||
tools/updatelayouts.py \
|
||||
tools/x-font \
|
||||
tools/README \
|
||||
tools/count_total_lines_of_compiled_code.sh \
|
||||
|
54
development/tools/updatedocs.py
Normal file
54
development/tools/updatedocs.py
Normal file
@ -0,0 +1,54 @@
|
||||
#! /usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# file updatedocs.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 documentation .lyx files to current format
|
||||
# The old files are backuped with extension ".old"
|
||||
|
||||
|
||||
import os, re, string, sys, subprocess, shutil
|
||||
|
||||
|
||||
def convertdir(docdir, prefix, lyx2lyx):
|
||||
olddir = os.getcwd()
|
||||
os.chdir(docdir)
|
||||
for i in os.listdir("."):
|
||||
if os.path.isdir(i):
|
||||
subdir = os.path.join(docdir, i)
|
||||
subprefix = os.path.join(prefix, i)
|
||||
convertdir(subdir, subprefix, lyx2lyx)
|
||||
continue
|
||||
(base, ext) = os.path.splitext(i)
|
||||
if ext != ".lyx":
|
||||
continue
|
||||
old = i + ".old"
|
||||
shutil.copy(i, old)
|
||||
if sys.executable and sys.executable != '':
|
||||
cmd = [sys.executable, lyx2lyx, old, '-o', i]
|
||||
else:
|
||||
# assume that python is in the path
|
||||
cmd = [lyx2lyx, old, '-o', i]
|
||||
sys.stderr.write('Converting %s\n' % os.path.join(prefix, i))
|
||||
subprocess.call(cmd)
|
||||
os.chdir(olddir)
|
||||
|
||||
|
||||
def main(argv):
|
||||
|
||||
toolsdir = os.path.dirname(argv[0])
|
||||
docdir = os.path.abspath(os.path.join(toolsdir, '../../lib/doc'))
|
||||
lyx2lyx = os.path.abspath(os.path.join(toolsdir, "../../lib/lyx2lyx/lyx2lyx"))
|
||||
convertdir(docdir, '', lyx2lyx)
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv)
|
Loading…
Reference in New Issue
Block a user