[hamster-applet] moving to waf



commit 30ef6496ee68287ea704b514335b0cc93d122aa9
Author: Toms Bauģis <toms baugis gmail com>
Date:   Tue May 25 20:51:19 2010 +0100

    moving to waf

 data/wscript_build |   47 +++++++++++++++++++++++++++++
 help/wscript       |   84 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 po/wscript         |    6 ++++
 waf                |  Bin 0 -> 92322 bytes
 wscript            |   62 ++++++++++++++++++++++++++++++++++++++
 5 files changed, 199 insertions(+), 0 deletions(-)
---
diff --git a/data/wscript_build b/data/wscript_build
new file mode 100644
index 0000000..e0b8b62
--- /dev/null
+++ b/data/wscript_build
@@ -0,0 +1,47 @@
+#! /usr/bin/env python
+# encoding: utf-8
+# Thomas Nagy, 2006-2009 (ita)
+
+bld.install_files('${DATADIR}/hamster-applet', '*.ui')
+bld.install_files('${DATADIR}/hamster-applet', 'hamster.db Hamster_Applet.xml')
+bld.install_files('${DATADIR}/hamster-applet/art', 'art/*.png')
+
+bld.install_files('${DATADIR}/icons/hicolor/16x16/apps',   'art/16x16/hamster-applet.png')
+bld.install_files('${DATADIR}/icons/hicolor/22x22/apps',   'art/22x22/hamster-applet.png')
+bld.install_files('${DATADIR}/icons/hicolor/32x32/apps',   'art/32x32/hamster-applet.png')
+bld.install_files('${DATADIR}/icons/hicolor/48x48/apps',   'art/scalable/hamster-applet.png')
+bld.install_files('${DATADIR}/icons/hicolor/scalable/apps','art/scalable/hamster-applet.svg')
+
+
+bld(features = "subst",
+				 source= "hamster-standalone.desktop.in.in",
+				 target= "hamster-standalone.desktop.in",
+				 dict = bld.env
+				)
+
+bld(features = "subst",
+				 source= "Hamster_Applet.server.in.in",
+				 target= "Hamster_Applet.server.in",
+				 dict = bld.env
+				)
+
+bld.add_group()
+
+# process .in files with intl_tool
+bld(features = 'intltool_in',
+	source   = 'hamster-applet.schemas.in',
+	install_path = '${PREFIX}/etc/gconf/schemas',
+	podir    = '../po',
+	flags    = ['-s', '-u', '-c'])
+
+bld(features = 'intltool_in',
+	source   = 'hamster-standalone.desktop.in',
+	install_path = '${DATADIR}/applications',
+	podir    = '../po',
+	flags    = ['-d', '-q', '-u', '-c'])
+
+bld(features = 'intltool_in',
+	source   = 'Hamster_Applet.server.in',
+	install_path = '${LIBDIR}/bonobo/servers',
+	podir    = '../po',
+	flags    = ['-o', '-u', '-c'])
diff --git a/help/wscript b/help/wscript
new file mode 100644
index 0000000..ee6de9b
--- /dev/null
+++ b/help/wscript
@@ -0,0 +1,84 @@
+#!/usr/bin/env python
+
+## Mallard functionality definitions ##
+import os
+import Task
+import TaskGen
+
+def _read_makefile_am(filename):
+	"read a Makefile.am file for DOC_* variable definitions, return a dict"
+	varstring = open(filename).read()
+	varstring = varstring.replace("\\\n", " ")
+	varlines = [L for L in varstring.splitlines() if L.startswith("DOC")]
+	return dict(tuple(map(str.strip, var.split("=", 1))) for var in varlines)
+
+def init_mallard(self):
+	mf_am = self.path.find_resource(self.variable_definitions)
+	DOC_VAR = _read_makefile_am(mf_am.abspath())
+
+	require_vars = "DOC_ID DOC_LINGUAS DOC_PAGES".split()
+	have_vars = set(var for var in DOC_VAR if DOC_VAR[var])
+	missing_vars = set(require_vars).difference(have_vars)
+	if missing_vars:
+		print "Missing DOC variable declarations in %s:" % (mf_am.abspath())
+		print "\n".join(missing_vars)
+
+	self.bld.env.update(DOC_VAR)
+	self.default_install_path='${PREFIX}/share/gnome/help/${DOC_ID}'
+
+def apply_mallard(self):
+	bld = self.bld
+	lst = self.to_list(bld.env["DOC_LINGUAS"])
+	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"]
+
+	# Check if the declared page list is consistent
+	declared_pages = self.to_list(bld.env["DOC_PAGES"])
+	missing_pages = set(pages).difference(declared_pages)
+	if missing_pages:
+		print "Warning: Some pages not declared:"
+		print "\n".join(missing_pages)
+
+	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)
+			tsk.install_path = os.path.join(self.install_path, lang)
+	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)
+
+Task.simple_task_type('xml2po', '${XML2PO} ${XML2POFLAGS} ${SRC} > ${TGT}',
+		color='BLUE')
+
+TaskGen.feature("mallard")(init_mallard)
+TaskGen.feature("mallard")(apply_mallard)
+TaskGen.after('init_mallard')(apply_mallard)
+
+## End Mallard functionality ##
+
+
+# Build Configuration
+
+def set_options(opt):
+	pass
+
+def configure(conf):
+	xml2po = conf.find_program('xml2po', var='XML2PO')
+	conf.env['XML2POFLAGS'] = '-mmallard -p'
+
+def build(bld):
+	if bld.env["XML2PO"]:
+		task = bld.new_task_gen(
+			features="mallard",
+			variable_definitions="Makefile.am",
+		)
diff --git a/po/wscript b/po/wscript
new file mode 100644
index 0000000..59943f5
--- /dev/null
+++ b/po/wscript
@@ -0,0 +1,6 @@
+#! /usr/bin/env python
+# encoding: utf-8
+# Thomas Nagy, 2006-2009 (ita)
+
+def build(bld):
+    bld(features = 'intltool_po', appname = 'hamster-applet')
diff --git a/waf b/waf
new file mode 100755
index 0000000..4d32d50
Binary files /dev/null and b/waf differ
diff --git a/wscript b/wscript
new file mode 100644
index 0000000..7f479f3
--- /dev/null
+++ b/wscript
@@ -0,0 +1,62 @@
+# -*- python -*-
+VERSION = '2.31.3'
+APPNAME = 'hamster-applet'
+top = '.'
+out = 'build'
+
+import intltool, gnome
+
+def configure(conf):
+    conf.check_tool('python')
+    conf.check_tool('misc')
+    conf.check_python_version((2,4,2))
+
+    conf.check_tool('gnome intltool dbus')
+
+    conf.define('ENABLE_NLS', 1)
+
+
+    conf.define('HAVE_BIND_TEXTDOMAIN_CODESET', 1)
+
+    conf.define('VERSION', VERSION)
+    conf.define('GETTEXT_PACKAGE', "hamster-applet")
+    conf.define('PACKAGE', "hamster-applet")
+    conf.define('PYEXECDIR', conf.env["PYTHONDIR"]) # i don't know the difference
+    conf.define('prefix', conf.env["PREFIX"]) # to keep compatibility for now
+
+
+    conf.sub_config("help")
+
+def build(bld):
+    bld.install_files('${LIBDIR}/hamster-applet', 'src/hamster-applet')
+    bld.install_files('${BINDIR}', 'src/hamster-standalone src/gnome-time-tracker src/hamster-client src/hamster-service')
+
+
+    # set correct flags in defs.py
+    bld.new_task_gen("subst",
+                     source= "src/hamster/defs.py.in",
+                     target= "src/hamster/defs.py",
+                     install_path="${PYTHONDIR}/hamster",
+                     dict = bld.env
+                    )
+
+    bld.install_files('${PYTHONDIR}/hamster', 'src/hamster/*.py')
+    bld.install_files('${PYTHONDIR}/hamster/widgets', 'src/hamster/widgets/*.py')
+
+    bld.new_task_gen("subst",
+                     source= "org.gnome.hamster.service.in",
+                     target= "org.gnome.hamster.service",
+                     install_path="${DATADIR}/dbus-1/services",
+                     dict = bld.env
+                    )
+
+    bld.add_subdirs("po help data")
+
+
+    def post(ctx):
+        # Postinstall tasks:
+        # gnome.postinstall_scrollkeeper('hamster-applet') # Installing the user docs
+        # gnome.postinstall_schemas('hamster-applet') # Installing GConf schemas
+        gnome.postinstall_icons() # Updating the icon cache
+
+    bld.add_post_fun(post)



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