File: build_help.py

package info (click to toggle)
hotwire 0.721-2
  • links: PTS
  • area: main
  • in suites: squeeze, wheezy
  • size: 1,440 kB
  • ctags: 2,331
  • sloc: python: 15,555; makefile: 14
file content (44 lines) | stat: -rw-r--r-- 1,552 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
"""distutils_extra.command.build_help

Implements the Distutils 'build_help' command."""

import distutils
import glob
import os
import os.path
import re
import sys
import distutils.command.build

class build_help(distutils.cmd.Command):

    description = "install a docbook based documentation"

    user_options= [('help_dir', None, 'help directory of the source tree')]

    def initialize_options(self):
        self.help_dir = None

    def finalize_options(self):
        if self.help_dir is None:
            self.help_dir = os.path.join("help")

    def run(self):
        data_files = self.distribution.data_files

        self.announce("Setting up help files...")
        for filepath in glob.glob("help/*"):
            lang = filepath[len("help/"):]
            self.announce(" Language: %s" % lang)
            path_xml = os.path.join("share/gnome/help",
                                    self.distribution.metadata.name,
                                    lang)
            path_figures = os.path.join("share/gnome/help",
                                        self.distribution.metadata.name,
                                        lang, "figures")
            data_files.append((path_xml, (glob.glob("%s/*.xml" % filepath))))
            data_files.append((path_figures,
                               (glob.glob("%s/figures/*.png" % filepath))))
        data_files.append((os.path.join('share/omf',
                                         self.distribution.metadata.name),
                           glob.glob("help/*/*.omf")))