~vcs-imports/kupfer/master-new

« back to all changes in this revision

Viewing changes to help/wscript

  • Committer: Ulrik Sverdrup
  • Date: 2010-03-06 01:47:58 UTC
  • mfrom: (1703.1.3)
  • Revision ID: git-v1:8dd041c7c2d7058474d1b3fde781d910a74268af
Merge branch 'mallard-documentation'

* mallard-documentation:
  kupferui: Show bundled documentation with show_help
  help: Build tools for mallard documentation
  help: Add first draft Mallard Gnome documentation for Kupfer

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /usr/bin/env python
 
2
import os
 
3
import Task
 
4
from TaskGen import extension, feature, after
 
5
 
 
6
LINGUAS = """
 
7
de
 
8
""".split()
 
9
 
 
10
Task.simple_task_type('xml2po','${XML2PO} ${XML2POFLAGS} ${SRC} > ${TGT}',color='BLUE')
 
11
 
 
12
def configure(conf):
 
13
        xml2po = conf.find_program('xml2po', var='XML2PO')
 
14
        conf.env['XML2POFLAGS'] = '-e -p'
 
15
 
 
16
def set_options(opt):
 
17
        pass
 
18
 
 
19
def init_mallard(self):
 
20
        self.default_install_path='${PREFIX}/share/gnome/help/${PACKAGE}'
 
21
 
 
22
def apply_mallard(self):
 
23
        lst = self.to_list(self.doc_linguas)
 
24
        bld = self.bld
 
25
        cnode = self.path.find_dir("C")
 
26
        self.bld.rescan(cnode)
 
27
 
 
28
        pages = [p for p in self.bld.cache_dir_contents[cnode.id]
 
29
                        if (os.path.splitext(p)[-1].lower()) == ".page"]
 
30
        for lang in lst:
 
31
                node = self.path.find_resource("%s/%s.po" % (lang, lang))
 
32
                for page in pages:
 
33
                        tsk = self.create_task('xml2po')
 
34
                        out = self.path.find_or_declare('%s/%s' % (lang, page))
 
35
                        src = self.path.find_resource('C/%s' % page)
 
36
                        tsk.set_inputs([node,src])
 
37
                        tsk.set_outputs(out)
 
38
                        instdir = os.path.join(self.install_path, lang)
 
39
                        if bld.is_install:
 
40
                                bld.install_files(instdir, out.abspath(self.env))
 
41
        if bld.is_install:
 
42
                for page in pages:
 
43
                        out = "%s/%s" % (cnode.abspath(), page)
 
44
                        instdir = os.path.join(self.install_path, "C")
 
45
                        bld.install_files(instdir, out)
 
46
 
 
47
feature("mallard")(init_mallard)
 
48
feature("mallard")(apply_mallard)
 
49
after('init_mallard')(apply_mallard)
 
50
 
 
51
def build(bld):
 
52
        if bld.env["XML2PO"]:
 
53
                task = bld.new_task_gen(
 
54
                        features="mallard",
 
55
                        doc_linguas=LINGUAS,
 
56
                )