mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 02:14:50 +00:00
Fix TOC generation for build dir != src dir
* lib/doc/depend.py (documents): Add dir_prefix argument (all_documents): Ditto (main): Create document list with empty prefix, since the prefix will be addded by a Makefile variable (main): Don't use isdir to detect english language, since that does not work for build dir != src dir * lib/doc/doc_toc.py (main): Don't use isdir to detect english language, since that does not work for build dir != src dir, rather create the dir if it does not exists. * lib/doc/Makefile.depend: Regenerated git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17469 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
673da6c01c
commit
f550496cee
@ -1,10 +1,67 @@
|
||||
# This is a Makefile for the TOC.lyx files.
|
||||
# It was automatically generated by depend.py
|
||||
#
|
||||
# First come the rules for each xx_TOC.lyx file. Then comes the
|
||||
# First come the rules for each xx/TOC.lyx file. Then comes the
|
||||
# TOCs target, which prints all the TOC files.
|
||||
|
||||
TOC.lyx: $(srcdir)/Intro.lyx $(srcdir)/FAQ.lyx $(srcdir)/Tutorial.lyx $(srcdir)/UserGuide.lyx $(srcdir)/EmbeddedObjects.lyx $(srcdir)/Extended.lyx $(srcdir)/Customization.lyx
|
||||
PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py
|
||||
cs/TOC.lyx: $(srcdir)/Customization.lyx $(srcdir)/EmbeddedObjects.lyx $(srcdir)/Extended.lyx $(srcdir)/FAQ.lyx $(srcdir)/Intro.lyx $(srcdir)/UserGuide.lyx $(srcdir)/cs/Tutorial.lyx
|
||||
PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py cs .
|
||||
|
||||
tocfiles = TOC.lyx
|
||||
da/TOC.lyx: $(srcdir)/Customization.lyx $(srcdir)/EmbeddedObjects.lyx $(srcdir)/Extended.lyx $(srcdir)/FAQ.lyx $(srcdir)/Tutorial.lyx $(srcdir)/UserGuide.lyx $(srcdir)/da/Intro.lyx
|
||||
PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py da .
|
||||
|
||||
de/TOC.lyx: $(srcdir)/EmbeddedObjects.lyx $(srcdir)/de/Customization.lyx $(srcdir)/de/Extended.lyx $(srcdir)/de/FAQ.lyx $(srcdir)/de/Intro.lyx $(srcdir)/de/Tutorial.lyx $(srcdir)/de/UserGuide.lyx
|
||||
PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py de .
|
||||
|
||||
TOC.lyx: $(srcdir)/Customization.lyx $(srcdir)/EmbeddedObjects.lyx $(srcdir)/Extended.lyx $(srcdir)/FAQ.lyx $(srcdir)/Intro.lyx $(srcdir)/Tutorial.lyx $(srcdir)/UserGuide.lyx
|
||||
PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py en .
|
||||
|
||||
es/TOC.lyx: $(srcdir)/Customization.lyx $(srcdir)/Extended.lyx $(srcdir)/FAQ.lyx $(srcdir)/UserGuide.lyx $(srcdir)/es/EmbeddedObjects.lyx $(srcdir)/es/Intro.lyx $(srcdir)/es/Tutorial.lyx
|
||||
PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py es .
|
||||
|
||||
eu/TOC.lyx: $(srcdir)/EmbeddedObjects.lyx $(srcdir)/eu/Customization.lyx $(srcdir)/eu/Extended.lyx $(srcdir)/eu/FAQ.lyx $(srcdir)/eu/Intro.lyx $(srcdir)/eu/Tutorial.lyx $(srcdir)/eu/UserGuide.lyx
|
||||
PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py eu .
|
||||
|
||||
fr/TOC.lyx: $(srcdir)/EmbeddedObjects.lyx $(srcdir)/fr/Customization.lyx $(srcdir)/fr/Extended.lyx $(srcdir)/fr/FAQ.lyx $(srcdir)/fr/Intro.lyx $(srcdir)/fr/Tutorial.lyx $(srcdir)/fr/UserGuide.lyx
|
||||
PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py fr .
|
||||
|
||||
gl/TOC.lyx: $(srcdir)/Customization.lyx $(srcdir)/EmbeddedObjects.lyx $(srcdir)/Extended.lyx $(srcdir)/FAQ.lyx $(srcdir)/UserGuide.lyx $(srcdir)/gl/Intro.lyx $(srcdir)/gl/Tutorial.lyx
|
||||
PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py gl .
|
||||
|
||||
he/TOC.lyx: $(srcdir)/Customization.lyx $(srcdir)/EmbeddedObjects.lyx $(srcdir)/Extended.lyx $(srcdir)/FAQ.lyx $(srcdir)/UserGuide.lyx $(srcdir)/he/Intro.lyx $(srcdir)/he/Tutorial.lyx
|
||||
PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py he .
|
||||
|
||||
hu/TOC.lyx: $(srcdir)/Customization.lyx $(srcdir)/EmbeddedObjects.lyx $(srcdir)/Extended.lyx $(srcdir)/FAQ.lyx $(srcdir)/UserGuide.lyx $(srcdir)/hu/Intro.lyx $(srcdir)/hu/Tutorial.lyx
|
||||
PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py hu .
|
||||
|
||||
it/TOC.lyx: $(srcdir)/EmbeddedObjects.lyx $(srcdir)/Extended.lyx $(srcdir)/FAQ.lyx $(srcdir)/it/Customization.lyx $(srcdir)/it/Intro.lyx $(srcdir)/it/Tutorial.lyx $(srcdir)/it/UserGuide.lyx
|
||||
PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py it .
|
||||
|
||||
nb/TOC.lyx: $(srcdir)/Customization.lyx $(srcdir)/EmbeddedObjects.lyx $(srcdir)/Extended.lyx $(srcdir)/FAQ.lyx $(srcdir)/Tutorial.lyx $(srcdir)/UserGuide.lyx $(srcdir)/nb/Intro.lyx
|
||||
PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py nb .
|
||||
|
||||
nl/TOC.lyx: $(srcdir)/Customization.lyx $(srcdir)/EmbeddedObjects.lyx $(srcdir)/Extended.lyx $(srcdir)/FAQ.lyx $(srcdir)/UserGuide.lyx $(srcdir)/nl/Intro.lyx $(srcdir)/nl/Tutorial.lyx
|
||||
PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py nl .
|
||||
|
||||
pl/TOC.lyx: $(srcdir)/Customization.lyx $(srcdir)/EmbeddedObjects.lyx $(srcdir)/FAQ.lyx $(srcdir)/UserGuide.lyx $(srcdir)/pl/Extended.lyx $(srcdir)/pl/Intro.lyx $(srcdir)/pl/Tutorial.lyx
|
||||
PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py pl .
|
||||
|
||||
pt/TOC.lyx: $(srcdir)/Customization.lyx $(srcdir)/EmbeddedObjects.lyx $(srcdir)/Extended.lyx $(srcdir)/FAQ.lyx $(srcdir)/UserGuide.lyx $(srcdir)/pt/Intro.lyx $(srcdir)/pt/Tutorial.lyx
|
||||
PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py pt .
|
||||
|
||||
ro/TOC.lyx: $(srcdir)/Customization.lyx $(srcdir)/EmbeddedObjects.lyx $(srcdir)/Extended.lyx $(srcdir)/FAQ.lyx $(srcdir)/Tutorial.lyx $(srcdir)/UserGuide.lyx $(srcdir)/ro/Intro.lyx
|
||||
PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py ro .
|
||||
|
||||
ru/TOC.lyx: $(srcdir)/Customization.lyx $(srcdir)/EmbeddedObjects.lyx $(srcdir)/Extended.lyx $(srcdir)/UserGuide.lyx $(srcdir)/ru/FAQ.lyx $(srcdir)/ru/Intro.lyx $(srcdir)/ru/Tutorial.lyx
|
||||
PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py ru .
|
||||
|
||||
sk/TOC.lyx: $(srcdir)/Customization.lyx $(srcdir)/EmbeddedObjects.lyx $(srcdir)/Extended.lyx $(srcdir)/FAQ.lyx $(srcdir)/Intro.lyx $(srcdir)/sk/Tutorial.lyx $(srcdir)/sk/UserGuide.lyx
|
||||
PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py sk .
|
||||
|
||||
sl/TOC.lyx: $(srcdir)/Customization.lyx $(srcdir)/EmbeddedObjects.lyx $(srcdir)/Extended.lyx $(srcdir)/FAQ.lyx $(srcdir)/UserGuide.lyx $(srcdir)/sl/Intro.lyx $(srcdir)/sl/Tutorial.lyx
|
||||
PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py sl .
|
||||
|
||||
sv/TOC.lyx: $(srcdir)/Customization.lyx $(srcdir)/EmbeddedObjects.lyx $(srcdir)/Extended.lyx $(srcdir)/FAQ.lyx $(srcdir)/UserGuide.lyx $(srcdir)/sv/Intro.lyx $(srcdir)/sv/Tutorial.lyx
|
||||
PYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py sv .
|
||||
|
||||
tocfiles = cs/TOC.lyx da/TOC.lyx de/TOC.lyx TOC.lyx es/TOC.lyx eu/TOC.lyx fr/TOC.lyx gl/TOC.lyx he/TOC.lyx hu/TOC.lyx it/TOC.lyx nb/TOC.lyx nl/TOC.lyx pl/TOC.lyx pt/TOC.lyx ro/TOC.lyx ru/TOC.lyx sk/TOC.lyx sl/TOC.lyx sv/TOC.lyx
|
||||
|
@ -29,29 +29,33 @@ import re
|
||||
|
||||
possible_documents = ("Intro", "FAQ", "Tutorial", "UserGuide", "EmbeddedObjects", "Extended", "Customization")
|
||||
|
||||
def documents(srcdir, lang):
|
||||
def documents(srcdir, lang, dir_prefix = None):
|
||||
'''Return documents for specified language. Translated files are in lang
|
||||
directory.
|
||||
'''
|
||||
result = []
|
||||
if dir_prefix is None:
|
||||
dir_prefix = srcdir
|
||||
for file in possible_documents:
|
||||
fname = os.path.join(srcdir, lang, file + '.lyx')
|
||||
if os.access(fname, os.F_OK):
|
||||
result.append(fname)
|
||||
result.append(os.path.join(dir_prefix, lang, file + '.lyx'))
|
||||
else:
|
||||
result.append(os.path.join(srcdir, file + '.lyx'))
|
||||
result.append(os.path.join(dir_prefix, file + '.lyx'))
|
||||
return result
|
||||
|
||||
|
||||
def all_documents(srcdir):
|
||||
def all_documents(srcdir, dir_prefix = None):
|
||||
'''Return available languages and its documents'''
|
||||
languages = {}
|
||||
if dir_prefix is None:
|
||||
dir_prefix = srcdir
|
||||
for dir in os.listdir(srcdir):
|
||||
if os.path.isdir(os.path.join(srcdir, dir)) and len(dir) == 2:
|
||||
languages[dir] = documents(srcdir, dir)
|
||||
languages[dir] = documents(srcdir, dir, dir_prefix)
|
||||
# general, English language
|
||||
if 'en' not in languages.keys():
|
||||
languages['en'] = documents(srcdir, 'en')
|
||||
languages['en'] = documents(srcdir, 'en', dir_prefix)
|
||||
return languages
|
||||
|
||||
|
||||
@ -64,7 +68,7 @@ def main(argv):
|
||||
""" % os.path.basename(argv[0])
|
||||
|
||||
# What are the languages available? And its documents?
|
||||
languages = all_documents(os.path.dirname(argv[0]))
|
||||
languages = all_documents(os.path.dirname(argv[0]), '')
|
||||
|
||||
# sort languages alphabetically
|
||||
langs = languages.keys()
|
||||
@ -74,7 +78,7 @@ def main(argv):
|
||||
|
||||
# Write rules for other languages
|
||||
for lang in langs:
|
||||
if os.path.isdir(lang):
|
||||
if lang != 'en':
|
||||
toc_name = os.path.join(lang, 'TOC.lyx')
|
||||
else:
|
||||
# for English, because there is no 'en' directory
|
||||
|
@ -127,12 +127,15 @@ def main(argv):
|
||||
usage()
|
||||
sys.exit(1)
|
||||
|
||||
lang = argv[1]
|
||||
if not os.path.isdir(os.path.join(argv[2], lang)):
|
||||
# need to create lang dir if build dir != src dir
|
||||
os.mkdir(os.path.join(argv[2], lang))
|
||||
|
||||
# choose language files
|
||||
if not os.path.isdir(argv[2], argv[1]):
|
||||
lang = "en"
|
||||
if lang == 'en':
|
||||
output = os.path.join(argv[2], 'TOC.lyx')
|
||||
else:
|
||||
lang = argv[1]
|
||||
output = os.path.join(argv[2], lang, 'TOC.lyx')
|
||||
# fallback
|
||||
if lang not in info:
|
||||
|
Loading…
Reference in New Issue
Block a user