summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2011-11-15 14:49:33 (GMT)
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>2011-11-17 20:28:44 (GMT)
commitb4481c5b2d9914bfb14e13b3cc572014d1362537 (patch)
treef690881b4bde2ea17b7f2bb996799f95682a1311
parent623b5a8e1499fc38287c4771ab5fcec5f71fffe3 (diff)
downloadtelepathy-yell-b4481c5b2d9914bfb14e13b3cc572014d1362537.tar.gz
telepathy-yell-b4481c5b2d9914bfb14e13b3cc572014d1362537.tar.xz
Update tools to current tp-glib
Current tools don't support the EmitsChanged annotation, update so they do :)
-rw-r--r--tools/c-constants-gen.py4
-rw-r--r--tools/glib-client-gen.py62
-rw-r--r--tools/glib-ginterface-gen.py23
-rw-r--r--tools/gobject-foo.py23
-rw-r--r--tools/make-release-mail.py3
-rw-r--r--tools/with-session-bus.sh12
6 files changed, 99 insertions, 28 deletions
diff --git a/tools/c-constants-gen.py b/tools/c-constants-gen.py
index 09608c2..ff2a24d 100644
--- a/tools/c-constants-gen.py
+++ b/tools/c-constants-gen.py
@@ -79,7 +79,7 @@ extern "C" {
*/
""")
- self.write("typedef enum {\n")
+ self.write("typedef enum /*< flags >*/ {\n")
for flag in get_by_path(flags, 'flag'):
self.do_val(flag, value_prefix)
@@ -123,7 +123,7 @@ extern "C" {
self.d("""\
/**
- * NUM_%(upper-plural)s:
+ * NUM_%(upper-plural)s: (skip)
*
* 1 higher than the highest valid value of #%(mixed-name)s.
*/
diff --git a/tools/glib-client-gen.py b/tools/glib-client-gen.py
index 6b0bdeb..446d198 100644
--- a/tools/glib-client-gen.py
+++ b/tools/glib-client-gen.py
@@ -56,8 +56,16 @@ class Generator(object):
% opts.get('--subclass', 'TpProxy'))
if self.proxy_arg == 'void *':
self.proxy_arg = 'gpointer '
- self.generate_reentrant = ('--generate-reentrant' in opts or
- '--deprecate-reentrant' in opts)
+
+ self.reentrant_symbols = set()
+ try:
+ filename = opts['--generate-reentrant']
+ with open(filename, 'r') as f:
+ for line in f.readlines():
+ self.reentrant_symbols.add(line.strip())
+ except KeyError:
+ pass
+
self.deprecate_reentrant = opts.get('--deprecate-reentrant', None)
self.deprecation_attribute = opts.get('--deprecation-attribute',
'G_GNUC_DEPRECATED')
@@ -139,8 +147,12 @@ class Generator(object):
name, info, tp_type, elt = arg
ctype, gtype, marshaller, pointer = info
- self.d(' * @%s: %s' % (name,
- xml_escape(get_docstring(elt) or '(Undocumented)')))
+ docs = get_docstring(elt) or '(Undocumented)'
+
+ if ctype == 'guint ' and tp_type != '':
+ docs += ' (#%s)' % ('Tp' + tp_type.replace('_', ''))
+
+ self.d(' * @%s: %s' % (name, xml_escape(docs)))
self.d(' * @user_data: User-supplied data')
self.d(' * @weak_object: User-supplied weakly referenced object')
@@ -432,9 +444,14 @@ class Generator(object):
name, info, tp_type, elt = arg
ctype, gtype, marshaller, pointer = info
+ docs = xml_escape(get_docstring(elt) or '(Undocumented)')
+
+ if ctype == 'guint ' and tp_type != '':
+ docs += ' (#%s)' % ('Tp' + tp_type.replace('_', ''))
+
self.d(' * @%s: Used to return an \'out\' argument if @error is '
'%%NULL: %s'
- % (name, xml_escape(get_docstring(elt) or '(Undocumented)')))
+ % (name, docs))
self.d(' * @error: %NULL on success, or an error on failure')
self.d(' * @user_data: user-supplied data')
@@ -687,8 +704,13 @@ class Generator(object):
name, info, tp_type, elt = arg
ctype, gtype, marshaller, pointer = info
+ docs = xml_escape(get_docstring(elt) or '(Undocumented)')
+
+ if ctype == 'guint ' and tp_type != '':
+ docs += ' (#%s)' % ('Tp' + tp_type.replace('_', ''))
+
self.d(' * @%s: Used to pass an \'in\' argument: %s'
- % (name, xml_escape(get_docstring(elt) or '(Undocumented)')))
+ % (name, docs))
self.d(' * @callback: called when the method call succeeds or fails;')
self.d(' * may be %NULL to make a "fire and forget" call with no ')
@@ -832,9 +854,8 @@ class Generator(object):
self.b('}')
self.b('')
- if self.generate_reentrant:
- self.do_method_reentrant(method, iface_lc, member, member_lc,
- in_args, out_args, collect_callback)
+ self.do_method_reentrant(method, iface_lc, member, member_lc,
+ in_args, out_args, collect_callback)
# leave a gap for the end of the method
self.d('')
@@ -853,6 +874,10 @@ class Generator(object):
# GError **error,
# GMainLoop **loop);
+ run_method_name = '%s_%s_run_%s' % (self.prefix_lc, iface_lc, member_lc)
+ if run_method_name not in self.reentrant_symbols:
+ return
+
self.b('typedef struct {')
self.b(' GMainLoop *loop;')
self.b(' GError **error;')
@@ -930,12 +955,12 @@ class Generator(object):
if self.deprecate_reentrant:
self.h('#ifndef %s' % self.deprecate_reentrant)
- self.h('gboolean %s_%s_run_%s (%sproxy,'
- % (self.prefix_lc, iface_lc, member_lc, self.proxy_arg))
+ self.h('gboolean %s (%sproxy,'
+ % (run_method_name, self.proxy_arg))
self.h(' gint timeout_ms,')
self.d('/**')
- self.d(' * %s_%s_run_%s:' % (self.prefix_lc, iface_lc, member_lc))
+ self.d(' * %s:' % run_method_name)
self.d(' * @proxy: %s' % self.proxy_doc)
self.d(' * @timeout_ms: Timeout in milliseconds, or -1 for default')
@@ -943,8 +968,13 @@ class Generator(object):
name, info, tp_type, elt = arg
ctype, gtype, marshaller, pointer = info
+ docs = xml_escape(get_docstring(elt) or '(Undocumented)')
+
+ if ctype == 'guint ' and tp_type != '':
+ docs += ' (#%s)' % ('Tp' + tp_type.replace('_', ''))
+
self.d(' * @%s: Used to pass an \'in\' argument: %s'
- % (name, xml_escape(get_docstring(elt) or '(Undocumented)')))
+ % (name, docs))
for arg in out_args:
name, info, tp_type, elt = arg
@@ -981,8 +1011,8 @@ class Generator(object):
self.d(' */')
self.d('')
- self.b('gboolean\n%s_%s_run_%s (%sproxy,'
- % (self.prefix_lc, iface_lc, member_lc, self.proxy_arg))
+ self.b('gboolean\n%s (%sproxy,'
+ % (run_method_name, self.proxy_arg))
self.b(' gint timeout_ms,')
for arg in in_args:
@@ -1211,7 +1241,7 @@ if __name__ == '__main__':
options, argv = gnu_getopt(sys.argv[1:], '',
['group=', 'subclass=', 'subclass-assert=',
'iface-quark-prefix=', 'tp-proxy-api=',
- 'generate-reentrant', 'deprecate-reentrant=',
+ 'generate-reentrant=', 'deprecate-reentrant=',
'deprecation-attribute='])
opts = {}
diff --git a/tools/glib-ginterface-gen.py b/tools/glib-ginterface-gen.py
index 04509fd..e277b91 100644
--- a/tools/glib-ginterface-gen.py
+++ b/tools/glib-ginterface-gen.py
@@ -33,6 +33,16 @@ from libglibcodegen import Signature, type_to_gtype, cmp_by_name, \
NS_TP = "http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"
+def get_emits_changed(node):
+ try:
+ return [
+ annotation.getAttribute('value')
+ for annotation in node.getElementsByTagName('annotation')
+ if annotation.getAttribute('name') == 'org.freedesktop.DBus.Property.EmitsChangedSignal'
+ ][0]
+ except IndexError:
+ return None
+
class Generator(object):
def __init__(self, dom, prefix, basename, signal_marshal_prefix,
@@ -108,6 +118,8 @@ class Generator(object):
if tmp and not self.allow_havoc:
raise AssertionError('%s is %s' % (self.iface_name, tmp))
+ iface_emits_changed = get_emits_changed(interface)
+
self.b('static const DBusGObjectInfo _%s%s_object_info;'
% (self.prefix_, node_name_lc))
self.b('')
@@ -270,6 +282,16 @@ class Generator(object):
flags = ('TP_DBUS_PROPERTIES_MIXIN_FLAG_READ | '
'TP_DBUS_PROPERTIES_MIXIN_FLAG_WRITE')
+ prop_emits_changed = get_emits_changed(m)
+
+ if prop_emits_changed is None:
+ prop_emits_changed = iface_emits_changed
+
+ if prop_emits_changed == 'true':
+ flags += ' | TP_DBUS_PROPERTIES_MIXIN_FLAG_EMITS_CHANGED'
+ elif prop_emits_changed == 'invalidates':
+ flags += ' | TP_DBUS_PROPERTIES_MIXIN_FLAG_EMITS_INVALIDATED'
+
self.b(' { 0, %s, "%s", 0, NULL, NULL }, /* %s */'
% (flags, m.getAttribute('type'), m.getAttribute('name')))
@@ -678,6 +700,7 @@ class Generator(object):
self.d('/**')
self.d(' * %s%s::%s:'
% (self.Prefix, self.node_name_mixed, signal_name))
+ self.d(' * @self: an object')
for (ctype, name, gtype) in args:
self.d(' * @%s: %s (FIXME, generate documentation)'
% (name, ctype))
diff --git a/tools/gobject-foo.py b/tools/gobject-foo.py
index 5921cab..002a290 100644
--- a/tools/gobject-foo.py
+++ b/tools/gobject-foo.py
@@ -5,7 +5,7 @@
# The master copy of this program is in the telepathy-glib repository -
# please make any changes there.
#
-# Copyright (C) 2007 Collabora Ltd. <http://www.collabora.co.uk/>
+# Copyright (C) 2007-2010 Collabora Ltd. <http://www.collabora.co.uk/>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -33,8 +33,13 @@ def gobject_header(head, tail, as_interface=False):
gtype = head.upper() + '_TYPE_' + tail.upper()
o("typedef struct _%s %s;" % (MixedCase, MixedCase))
- o("typedef struct _%sClass %sClass;" % (MixedCase, MixedCase))
- o("typedef struct _%sPrivate %sPrivate;" % (MixedCase, MixedCase))
+
+ if as_interface:
+ o("typedef struct _%sInterface %sInterface;" % (MixedCase, MixedCase))
+ else:
+ o("typedef struct _%sClass %sClass;" % (MixedCase, MixedCase))
+ o("typedef struct _%sPrivate %sPrivate;" % (MixedCase, MixedCase))
+
o("")
o("GType %s_get_type (void);" % lower_case)
o("")
@@ -54,13 +59,17 @@ def gobject_header(head, tail, as_interface=False):
o("#define %s_IS_%s(obj) \\" % (head.upper(), tail.upper()))
o(" (G_TYPE_CHECK_INSTANCE_TYPE ((obj), %s))" % gtype)
- if not as_interface:
+ if as_interface:
+ o("#define %s_GET_IFACE(obj) \\" % UPPER_CASE)
+ o(" (G_TYPE_INSTANCE_GET_INTERFACE ((obj), %s, \\" % gtype)
+ o(" %sInterface))" % MixedCase)
+ else:
o("#define %s_IS_%s_CLASS(klass) \\" % (head.upper(), tail.upper()))
o(" (G_TYPE_CHECK_CLASS_TYPE ((klass), %s))" % gtype)
- o("#define %s_GET_CLASS(obj) \\" % UPPER_CASE)
- o(" (G_TYPE_INSTANCE_GET_CLASS ((obj), %s, \\" % gtype)
- o(" %sClass))" % MixedCase)
+ o("#define %s_GET_CLASS(obj) \\" % UPPER_CASE)
+ o(" (G_TYPE_INSTANCE_GET_CLASS ((obj), %s, \\" % gtype)
+ o(" %sClass))" % MixedCase)
return out
diff --git a/tools/make-release-mail.py b/tools/make-release-mail.py
index 2bd7c2b..5c42b47 100644
--- a/tools/make-release-mail.py
+++ b/tools/make-release-mail.py
@@ -45,6 +45,7 @@ def extract_description(package, version, news_path):
return ('\n'.join(release_name), '\n'.join(details).rstrip())
BASE_URL = 'http://telepathy.freedesktop.org/releases'
+GIT_URL = 'http://cgit.freedesktop.org/telepathy'
def main(package, version, news_path):
release_name, details = extract_description(package, version, news_path)
@@ -54,9 +55,11 @@ def main(package, version, news_path):
tarball: %(base_url)s/%(package)s/%(package)s-%(version)s.tar.gz
signature: %(base_url)s/%(package)s/%(package)s-%(version)s.tar.gz.asc
+git: %(git_url)s/%(package)s
%(details)s""".strip().rstrip() % {
'base_url': BASE_URL,
+ 'git_url': GIT_URL,
'package': package,
'version': version,
'release_name': release_name,
diff --git a/tools/with-session-bus.sh b/tools/with-session-bus.sh
index 063bd7e..b3038cd 100644
--- a/tools/with-session-bus.sh
+++ b/tools/with-session-bus.sh
@@ -59,7 +59,9 @@ cleanup ()
{
pid=`head -n1 $me-$$.pid`
if test -n "$pid" ; then
- echo "Killing temporary bus daemon: $pid" >&2
+ if [ -n "$VERBOSE_TESTS" ]; then
+ echo "Killing temporary bus daemon: $pid" >&2
+ fi
kill -INT "$pid"
fi
rm -f $me-$$.address
@@ -69,12 +71,16 @@ cleanup ()
trap cleanup INT HUP TERM
dbus-daemon $dbus_daemon_args
-{ echo -n "Temporary bus daemon is "; cat $me-$$.address; } >&2
-{ echo -n "Temporary bus daemon PID is "; head -n1 $me-$$.pid; } >&2
+if [ -n "$VERBOSE_TESTS" ]; then
+ { echo -n "Temporary bus daemon is "; cat $me-$$.address; } >&2
+ { echo -n "Temporary bus daemon PID is "; head -n1 $me-$$.pid; } >&2
+fi
e=0
DBUS_SESSION_BUS_ADDRESS="`cat $me-$$.address`"
export DBUS_SESSION_BUS_ADDRESS
+DBUS_SESSION_BUS_PID="`cat $me-$$.pid`"
+export DBUS_SESSION_BUS_PID
if [ -n "$WITH_SESSION_BUS_FORK_DBUS_MONITOR" ] ; then
echo -n "Forking dbus-monitor $WITH_SESSION_BUS_FORK_DBUS_MONITOR_OPT" >&2