[kupfer/mallard-documentation: 6/7] help: Build tools for mallard documentation



commit fc55181b98ebda6ca3389eb27724398704cdf676
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Mon Dec 7 00:05:41 2009 +0100

    help: Build tools for mallard documentation

 help/wscript |   52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 wscript      |    4 ++--
 2 files changed, 54 insertions(+), 2 deletions(-)
---
diff --git a/help/wscript b/help/wscript
new file mode 100644
index 0000000..484b677
--- /dev/null
+++ b/help/wscript
@@ -0,0 +1,52 @@
+import os
+import Task
+from TaskGen import extension, feature, after
+
+LINGUAS = """
+de
+""".split()
+
+Task.simple_task_type('xml2po','${XML2PO} ${XML2POFLAGS} ${SRC} > ${TGT}',color='BLUE')
+
+def configure(conf):
+	xml2po = conf.find_program('xml2po', var='XML2PO')
+	conf.env['XML2POFLAGS'] = '-e -p'
+
+def init_mallard(self):
+	self.default_install_path='${PREFIX}/share/gnome/help/${PACKAGE}'
+
+def apply_mallard(self):
+	lst = self.to_list(self.doc_linguas)
+	bld = self.bld
+	cnode = self.path.find_dir("C")
+	self.bld.rescan(cnode)
+
+	pages = [p for p in self.bld.cache_dir_contents[cnode.id]
+			if (os.path.splitext(p)[-1].lower()) == ".page"]
+	for lang in lst:
+		node = self.path.find_resource("%s/%s.po" % (lang, lang))
+		for page in pages:
+			tsk = self.create_task('xml2po')
+			out = self.path.find_or_declare('%s/%s' % (lang, page))
+			src = self.path.find_resource('C/%s' % page)
+			tsk.set_inputs([node,src])
+			tsk.set_outputs(out)
+			instdir = os.path.join(self.install_path, lang)
+			if bld.is_install:
+				bld.install_files(instdir, out.abspath(self.env))
+	if bld.is_install:
+		for page in pages:
+			out = "%s/%s" % (cnode.abspath(), page)
+			instdir = os.path.join(self.install_path, "C")
+			bld.install_files(instdir, out)
+
+feature("mallard")(init_mallard)
+feature("mallard")(apply_mallard)
+after('init_mallard')(apply_mallard)
+
+def build(bld):
+	if bld.env["XML2PO"]:
+		task = bld.new_task_gen(
+			features="mallard",
+			doc_linguas=LINGUAS,
+		)
diff --git a/wscript b/wscript
index e02ebba..4f59b27 100644
--- a/wscript
+++ b/wscript
@@ -93,7 +93,7 @@ def configure(conf):
 
 	conf.env["KUPFER"] = Utils.subst_vars("${BINDIR}/kupfer", conf.env)
 	conf.env["VERSION"] = VERSION
-	conf.sub_config("extras")
+	conf.sub_config("extras help")
 
 	if not Options.options.pythondir_install:
 		conf.env["PYTHONDIR"] = Utils.subst_vars("${DATADIR}/kupfer", conf.env)
@@ -212,7 +212,7 @@ def build(bld):
 			install_path = "${MANDIR}/man1",
 		)
 
-	bld.add_subdirs("po data extras")
+	bld.add_subdirs("po data extras help")
 
 def intlupdate(util):
 	print "You should use intltool-update directly."



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]