]> git.lyx.org Git - lyx.git/commitdiff
get rid of the makefile machinery that was used to build TOCs
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 24 Oct 2008 16:04:10 +0000 (16:04 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 24 Oct 2008 16:04:10 +0000 (16:04 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27084 a592a061-630c-0410-9148-cb99ea01b6c8

autogen.sh
development/scons/scons_manifest.py
lib/doc/Makefile.am
lib/doc/depend.py [deleted file]
lib/doc/doc_toc.py [deleted file]

index 291865840c4b5bf929520207ee55926f71114e67..3c92d83c3dce49eba2186deaae4e7c43449be4a5 100755 (executable)
@@ -68,9 +68,6 @@ else
        exit 1
 fi
 
-echo "Building lib/doc/Makefile.depend..."
-python lib/doc/depend.py > lib/doc/Makefile.depend
-
 echo "Building Makefile templates..."
 if ( $AUTOMAKE --version ) < /dev/null > /dev/null 2>&1; then
        $AUTOMAKE
index f5471d57745fb4cb4d55739500f08b3f5c5f43ae..9f729efc0a7063f8cc716f843ffd4eb0ce67ee22 100644 (file)
@@ -2075,10 +2075,7 @@ lib_doc_clipart_files = Split('''
 
 lib_doc_extra_files = Split('''
     Makefile.am
-    Makefile.depend
     README.Documentation
-    depend.py
-    doc_toc.py
 ''')
 
 
index cff21e31df5a0970f64f3ae27c233515f7c9c3ec..ca5a6fd227f540ad2f62f28df8e3ed5ace034723 100644 (file)
@@ -1,8 +1,6 @@
 include $(top_srcdir)/config/common.am
 
-DISTCLEANFILES += $(tocfiles)
-
-EXTRA_DIST = depend.py doc_toc.py README.Documentation $(DEPENDFILE)
+EXTRA_DIST = README.Documentation
 
 docdir = $(pkgdatadir)/doc
 dist_doc_DATA = \
@@ -282,37 +280,7 @@ doc_files = \
            $(dist_svdoc_DATA) \
            $(dist_ukdoc_DATA)
 
-DEPENDFILE = $(srcdir)/Makefile.depend
-# include $(DEPENDFILE) does not work because automake is too limited.
-include $(srcdir)/Makefile.depend
-
-TOCs : $(DEPENDFILE) $(tocfiles)
-       @echo Made TOCs succesfully.
-
-# Force regeneration of $(DEPENDFILE) when Makefile.am changes because
-# new doc files might have been added
-$(DEPENDFILE): $(srcdir)/Makefile.am $(srcdir)/depend.py
-       python $(srcdir)/depend.py > $(DEPENDFILE)
-
-# The TOCs are not built for the install and dist targets if they don't exist
-# for some weird reason.
-# Make complains although we have rules for them in $(DEPENDFILE), so we
-# must not include the TOCs in $(docfiles) and have to use the install and
-# dist hooks below.
-dist-hook: $(tocfiles)
-       for i in $(tocfiles); \
-       do \
-               if test -f "$(srcdir)/$$i"; then file="$(srcdir)/$$i"; \
-               else file="$$i"; fi; \
-               cp -p "$$file" "$(distdir)"; \
-       done
-install-data-hook: $(tocfiles)
-       for i in $(tocfiles); \
-       do \
-               if test -f "$(srcdir)/$$i"; then file="$(srcdir)/$$i"; \
-               else file="$$i"; fi; \
-               $(INSTALL_DATA) "$$file" "$(DESTDIR)$(docdir)/$$i"; \
-       done
+install-data-hook:
        for i in $(doc_files); \
        do \
                if $(EGREP) -q "LYX_DIR_VER|LYX_USERDIR_VER" "$(DESTDIR)$(docdir)/$$i"; then \
@@ -323,11 +291,3 @@ install-data-hook: $(tocfiles)
                        chmod 644 "$(DESTDIR)$(docdir)/$$i"; \
                fi; \
        done
-
-uninstall-local:
-       for i in $(tocfiles); \
-       do \
-               $(RM) "$(DESTDIR)$(docdir)/$$i" ; \
-       done
-
-.PHONY: TOCs
diff --git a/lib/doc/depend.py b/lib/doc/depend.py
deleted file mode 100644 (file)
index ab5ae6a..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-#! /usr/bin/env python
-# -*- coding: utf-8 -*-
-# This file is part of the LyX Documentation
-# Copyright (C) 2004 José Matos <jamatos@lyx.org>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-# This script creates a "master table of contents" for a set of LyX docs.
-# It does so by going through the files and printing out all of the
-# chapter, section, and sub(sub)section headings out. (It numbers the
-# sections sequentially; hopefully noone's using Section* in the docs.)
-# It calls the script doc_toc.py using this syntax:
-# depend.py doc_toc.py SetOfDocuments
-# where SetOfDocuments is a set of documents
-
-import sys
-import os
-
-import re
-
-possible_documents = ("Intro", "Tutorial", "UserGuide", "EmbeddedObjects", "Extended", "Math", "Customization")
-
-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(os.path.join(dir_prefix, lang, file + '.lyx'))
-        else:
-            result.append(os.path.join(dir_prefix, file + '.lyx'))
-    return result
-
-
-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, dir_prefix)
-    # general, English language
-    if 'en' not in languages.keys():
-        languages['en'] = documents(srcdir, 'en', dir_prefix)
-    return languages
-  
-    
-def main(argv):
-    print """# This is a Makefile for the TOC.lyx files.
-# It was automatically generated by %s
-#
-# First come the rules for each xx/TOC.lyx file. Then comes the
-# TOCs target, which prints all the TOC files.
-""" % os.path.basename(argv[0])
-
-    # What are the languages available? And its documents?
-    languages = all_documents(os.path.dirname(argv[0]), '')
-
-    # sort languages alphabetically
-    langs = languages.keys()
-    langs.sort()
-
-    tocs = []
-
-    # Write rules for other languages
-    for lang in langs:
-        if lang != 'en':
-            toc_name = os.path.join(lang, 'TOC.lyx')
-        else:
-            # for English, because there is no 'en' directory
-            toc_name = 'TOC.lyx'
-        tocs.append(toc_name)
-
-        if toc_name in languages[lang]:
-            languages[lang].remove(toc_name)
-        languages[lang].sort()
-
-        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 'tocfiles =', ' '.join(tocs)
-
-
-if __name__ == "__main__":
-    main(sys.argv)
diff --git a/lib/doc/doc_toc.py b/lib/doc/doc_toc.py
deleted file mode 100755 (executable)
index 5ecca5e..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-#! /usr/bin/env python
-# -*- coding: utf-8 -*-
-# This file is part of the LyX Documentation
-# Copyright (C) 2004 José Matos <jamatos@lyx.org>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-# This script is called by the script depend.py to create a "master table of contents"
-# for a set of LyX docs.
-# It does so by going through the files and printing out all of the
-# chapter, section, and sub(sub)section headings out. (It numbers the
-# sections sequentially; hopefully noone's using Section* in the docs.)
-# It is called using this syntax:
-# depend.py doc_toc.py SetOfDocuments
-# where SetOfDocuments is a set of documents
-
-import sys
-import os
-
-if __name__ == "__main__":
-    srcdir = os.path.dirname(sys.argv[0])
-    if srcdir == '':
-        srcdir = '.'
-    sys.path.insert(0, srcdir + "/../lyx2lyx")
-
-# when doc_toc is imported by scons, sys.path is set over there
-import parser_tools
-import LyX
-import depend
-
-# Specific language information
-# info["isoname"] = (language, language_quotes, TOC_translated)
-info = { 'cs' : ('czech', 'german', u"Obsah dokumentace LyXu"),
-         'da' : ('danish', 'german', u"Indholdsfortegnelse over LyX's dokumentation"),
-         'de' : ('german', 'german', u"Inhaltsverzeichnis LyX Dokumentation"),
-         'es' : ('spanish', 'spanish', u"Índice general LyX documentation"),
-         'fr' : ('french', 'french', u"Plan de la documentation LyX"),
-        'ja' : ('japanese', 'japanese', u"LyX取扱説明書目次"),
-         'ru' : ('russian', 'english', u"LyX Documentation Table of Contents"),
-         'sl' : ('slovene', 'german', u"Kazalo dokumentacije LyXa"),
-         'en' : ('english', 'english', u"LyX Documentation Table of Contents")}
-
-def usage(pname):
-    print """Usage: %s lang output
-
-    lang is the language to build the TOC file,
-""" % pname
-
-
-transform_table = {'Title' : 'Section*', 'Chapter': 'Enumerate',
-                   'Section':'Enumerate', 'Subsection': 'Enumerate',
-                   'Subsubsection' : 'Enumerate'}
-
-def build_from_toc(par_list):
-    if not par_list:
-        return []
-
-    if par_list[0].name == 'Title':
-        par = par_list[0]
-        par.name = transform_table[par.name]
-
-        if len(par_list) == 1:
-            return par_list
-
-        for i in range(1, len(par_list)):
-            if par_list[i].name == 'Title':
-                return [par] + \
-                       build_from_toc(par_list[1:i]) + \
-                        build_from_toc(par_list[i:])
-
-        return [par] + build_from_toc(par_list[1:])
-
-    if par_list[0].name in ('Chapter', 'Section', 'Subsection', 'Subsubsection'):
-        return nest_struct(par_list[0].name, par_list)
-
-
-def nest_struct(name, par_list):
-    if par_list[0].name == name:
-        par = par_list[0]
-        par.name = transform_table[par.name]
-
-        if len(par_list) == 1:
-            return par_list
-
-        for i in range(1, len(par_list)):
-            if par_list[i].name == name:
-                par.child = build_from_toc(par_list[1:i])
-                return [par] + build_from_toc(par_list[i:])
-        par.child = build_from_toc(par_list[1:])
-        return [ par ]
-
-
-def build_toc(output, documents, lang=None):
-    # Determine existing translated documents for that language.
-    toc_general = []
-    for file in documents:
-        file = LyX.File(input= file)
-        file.convert()
-        toc_general.extend(file.get_toc())
-
-    # if lang is not given, guess from document names. (Used in scons build)
-    if lang is None:
-        lang = 'en'
-        for file in documents:
-            dir = file.split(os.sep)[-2]
-            if dir in info.keys():
-                lang = dir
-    file = LyX.NewFile(output = output)
-    data = info[lang]
-    file.set_header(language = data[0], language_quotes = data[1], inputencoding = "auto")
-    file.language = data[0]
-    file.encoding = "utf-8"
-    body = [ LyX.Paragraph('Title', [data[2]])]
-    body.extend(build_from_toc(toc_general))
-    file.set_body(body)
-    file.write()
-
-    
-def main(argv):
-    if len(argv) != 3:
-        usage(argv[0])
-        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 lang == 'en':
-        output = os.path.join(argv[2], 'TOC.lyx')
-    else:
-        output = os.path.join(argv[2], lang, 'TOC.lyx')
-        # fallback
-        if lang not in info:
-            lang = 'en'
-
-    build_toc(output, depend.documents(srcdir, lang), lang)
-
-
-if __name__ == "__main__":
-    main(sys.argv)