[kupfer: 4/4] Merge branch 'mallard-documentation'



commit 8dd041c7c2d7058474d1b3fde781d910a74268af
Merge: 3e3cc8b dec57a9
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Sat Mar 6 02:44:14 2010 +0100

    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

 help/C/index.page        |   27 +++
 help/C/introduction.page |   40 ++++
 help/C/license.page      |   51 ++++
 help/C/plugins.page      |  185 +++++++++++++++
 help/C/tips.page         |   68 ++++++
 help/de/de.po            |  586 ++++++++++++++++++++++++++++++++++++++++++++++
 help/kupfer.omf.in       |   10 +
 help/wscript             |   56 +++++
 kupfer/kupferui.py       |    4 +-
 wscript                  |    4 +-
 10 files changed, 1027 insertions(+), 4 deletions(-)
---
diff --cc help/wscript
index 0000000,484b677..002f361
mode 000000,100644..100644
--- a/help/wscript
+++ b/help/wscript
@@@ -1,0 -1,52 +1,56 @@@
++#! /usr/bin/env python
+ 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 set_options(opt):
++	pass
++
+ 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 --cc wscript
index 9b4c5fa,4f59b27..31c5c44
--- a/wscript
+++ b/wscript
@@@ -51,44 -40,32 +51,44 @@@ _read_git_version(
  srcdir = '.'
  blddir = 'build'
  
- config_subdirs = "auxdata extras"
- build_subdirs = "auxdata data po extras"
 -def dist_hook():
 -	"""in the dist preparation dir, delete unwanted files"""
 -	DIST_GIT_IGNORE = """
 -		debug.py
 -		makedist.sh
 -		""".split()
++config_subdirs = "auxdata extras help"
++build_subdirs = "auxdata data po extras help"
  
 -	for ignfile in filter(os.path.exists, DIST_GIT_IGNORE):
 -		os.unlink(ignfile)
 +EXTRA_DIST = [
 +	"waf",
 +	"GIT_VERSION",
 +]
  
 -def dist():
 -	"""Make the dist tarball and print its SHA-1 """
 -	def write_git_version():
 -		""" Write the revision to a file called GIT_VERSION,
 -		to grab the current version number from git when
 -		generating the dist tarball."""
 -		version = _get_git_version()
 -		if not version:
 -			return False
 -		version_file = open("GIT_VERSION", "w")
 -		version_file.write(version + "\n")
 -		version_file.close()
 -		return True
 +def _tarfile_append_as(tarname, filename, destname):
 +	import tarfile
 +	tf = tarfile.TarFile.open(tarname, "a")
 +	try:
 +		tf.add(filename, destname)
 +	finally:
 +		tf.close()
 +
 +def gitdist(ctx):
 +	"""Make the release tarball using git-archive"""
 +	import subprocess
 +	if not _write_git_version():
 +		raise Exception("No version")
 +	basename = "%s-%s" % (APPNAME, VERSION)
 +	outname = basename + ".tar"
 +	proc = subprocess.Popen(
 +		["git", "archive", "--format=tar", "--prefix=%s/" % basename, "HEAD"],
 +		stdout=subprocess.PIPE)
 +	fd = os.open(outname, os.O_CREAT | os.O_EXCL | os.O_WRONLY, 0666)
 +	os.write(fd, proc.communicate()[0])
 +	os.close(fd)
 +	for distfile in EXTRA_DIST:
 +		_tarfile_append_as(outname, distfile, os.path.join(basename, distfile))
 +	subprocess.call(["gzip", outname])
 +	subprocess.call(["sha1sum", outname + ".gz"])
  
 +def dist():
 +	"The standard waf dist process"
  	import Scripting
 -	write_git_version()
 +	_write_git_version()
  	Scripting.g_gz = "gz"
  	Scripting.dist(APPNAME, VERSION)
  



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