]> git.lyx.org Git - lyx.git/blobdiff - lib/doc/depend.py
Spanish updates from Ignacio
[lyx.git] / lib / doc / depend.py
index 8fdb70c3de718381492f071c666b920752e68f5c..af4d1404c3632df9c71b5d5b49f2cebedc2287ab 100644 (file)
@@ -28,15 +28,17 @@ import os
 import re
 from glob import glob
 
-possible_documents = ("Intro", "FAQ", "Tutorial", "UserGuide", "Extended", "Customization")
+possible_documents = ("Intro", "FAQ", "Tutorial", "UserGuide", "EmbeddedObjects", "Extended", "Customization")
 lang_pattern = re.compile('^([a-z]{2})_')
 
-def documents(prefix):
+def documents(srcdir, prefix):
     result = []
     for file in possible_documents:
-        fname = prefix + file + '.lyx'
+        fname = srcdir + '/' + prefix + file + '.lyx'
         if os.access(fname, os.F_OK):
             result.append(fname)
+        else:
+            result.append(srcdir + '/' + file + '.lyx')
     return result
 
 
@@ -46,11 +48,13 @@ def main(argv):
 #
 # First come the rules for each xx_TOC.lyx file. Then comes the
 # TOCs target, which prints all the TOC files.
-""" % argv[0]
+""" % os.path.basename(argv[0])
 
     # What are the languages available? And its documents?
     languages = {}
-    for file in glob('*'):
+    srcdir = os.path.dirname(argv[0])
+    for file in glob(srcdir + '/*.lyx'):
+        file = os.path.basename(file)
         lang = lang_pattern.match(file)
         if lang:
             if lang.group(1) not in languages:
@@ -63,8 +67,8 @@ def main(argv):
     langs.sort()
 
     # The default language is english and doesn't need any prefix
-    print 'TOC.lyx:', '.lyx '.join(possible_documents) + '.lyx'
-    print '\tpython doc_toc.py'
+    print 'TOC.lyx: $(srcdir)/' + '.lyx $(srcdir)/'.join(possible_documents) + '.lyx'
+    print '\tPYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py'
     print
     tocs = ['TOC.lyx']
 
@@ -73,15 +77,16 @@ def main(argv):
         toc_name = lang + '_TOC.lyx'
         tocs.append(toc_name)
 
-        languages[lang].remove(toc_name)
+        if toc_name in languages[lang]:
+            languages[lang].remove(toc_name)
+        languages[lang].sort()
 
-        print toc_name + ':', ' '.join(languages[lang])
-        print '\tpython doc_toc.py %s' % lang
+        print toc_name + ': $(srcdir)/' + ' $(srcdir)/'.join(languages[lang])
+        print '\tPYTHONPATH=$(top_builddir)/lib/lyx2lyx python -tt $(srcdir)/doc_toc.py %s' % lang
         print
 
     # Write meta-rule to call all the other rules
-    print 'TOCs:', ' '.join(tocs)
-    print '\t@echo Made TOCs succesfully.'
+    print 'tocfiles =', ' '.join(tocs)
 
 
 if __name__ == "__main__":