aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--extensions/Makefile.am3
-rw-r--r--tools/Makefile.am19
-rw-r--r--tools/c-constants-gen.py37
-rw-r--r--tools/check-c-style.sh7
-rw-r--r--tools/check-coding-style.mk2
-rw-r--r--tools/check-whitespace.sh6
-rw-r--r--tools/glib-client-gen.py85
-rw-r--r--tools/glib-client-marshaller-gen.py3
-rw-r--r--tools/glib-errors-str-gen.py7
-rw-r--r--tools/glib-ginterface-gen.py47
-rw-r--r--tools/glib-gtypes-generator.py28
-rw-r--r--tools/glib-interfaces-gen.py22
-rw-r--r--tools/lcov.am6
-rw-r--r--tools/libtpcodegen.py14
-rw-r--r--tools/make-release-mail.py16
-rw-r--r--tools/make-version-script.py7
-rw-r--r--tools/manager-file.py18
-rw-r--r--tools/telepathy.am70
-rw-r--r--tools/with-session-bus.sh2
19 files changed, 288 insertions, 111 deletions
diff --git a/extensions/Makefile.am b/extensions/Makefile.am
index 2d8b86485..8d674cd13 100644
--- a/extensions/Makefile.am
+++ b/extensions/Makefile.am
@@ -127,8 +127,7 @@ _gen/svc-misc.c _gen/svc-misc.h: _gen/misc.xml \
$(AM_V_GEN)$(PYTHON) $(tools_dir)/glib-ginterface-gen.py \
--filename=_gen/svc-misc \
--signal-marshal-prefix=_emp_ext \
- --include='<telepathy-glib/dbus.h>' \
- --include='"_gen/signals-marshal.h"' \
+ --include='<telepathy-glib/telepathy-glib.h>' \
--not-implemented-func='tp_dbus_g_method_return_not_implemented' \
--allow-unstable \
$< Emp_Svc_
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 49bcb04b5..80f4ce346 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -26,7 +26,6 @@ EXTRA_DIST = \
glib-ginterface-gen.py \
glib-gtypes-generator.py \
glib-interfaces-gen.py \
- glib-signals-marshal-gen.py \
gobject-foo.py \
lcov.am \
libtpcodegen.py \
@@ -48,23 +47,21 @@ CLEANFILES = libtpcodegen.pyc libtpcodegen.pyo libglibcodegen.pyc libglibcodegen
all: $(EXTRA_DIST)
libglibcodegen.py: libtpcodegen.py
- $(AM_V_GEN)touch $@
+ $(AM_V_GEN)test -e ${srcdir}/$@ && touch ${srcdir}/$@
c-constants-gen.py: libglibcodegen.py
- $(AM_V_GEN)touch $@
+ $(AM_V_GEN)test -e ${srcdir}/$@ && touch ${srcdir}/$@
glib-client-marshaller-gen.py: libglibcodegen.py
- $(AM_V_GEN)touch $@
+ $(AM_V_GEN)test -e ${srcdir}/$@ && touch ${srcdir}/$@
glib-errors-enum-body-gen.py: libglibcodegen.py
- $(AM_V_GEN)touch $@
+ $(AM_V_GEN)test -e ${srcdir}/$@ && touch ${srcdir}/$@
glib-errors-enum-header-gen.py: libglibcodegen.py
- $(AM_V_GEN)touch $@
+ $(AM_V_GEN)test -e ${srcdir}/$@ && touch ${srcdir}/$@
glib-ginterface-gen.py: libglibcodegen.py
- $(AM_V_GEN)touch $@
+ $(AM_V_GEN)test -e ${srcdir}/$@ && touch ${srcdir}/$@
glib-gtypes-generator.py: libglibcodegen.py
- $(AM_V_GEN)touch $@
+ $(AM_V_GEN)test -e ${srcdir}/$@ && touch ${srcdir}/$@
glib-interfaces-gen.py: libglibcodegen.py
- $(AM_V_GEN)touch $@
-glib-signals-marshal-gen.py: libglibcodegen.py
- $(AM_V_GEN)touch $@
+ $(AM_V_GEN)test -e ${srcdir}/$@ && touch ${srcdir}/$@
TELEPATHY_SPEC_SRCDIR = $(top_srcdir)/../telepathy-spec
maintainer-update-from-telepathy-spec:
diff --git a/tools/c-constants-gen.py b/tools/c-constants-gen.py
index 188ab82ac..c7a93d371 100644
--- a/tools/c-constants-gen.py
+++ b/tools/c-constants-gen.py
@@ -3,6 +3,7 @@
from sys import argv, stdout, stderr
import xml.dom.minidom
+from libtpcodegen import file_set_contents
from libglibcodegen import NS_TP, get_docstring, \
get_descendant_text, get_by_path
@@ -11,19 +12,23 @@ class Generator(object):
self.prefix = prefix + '_'
self.spec = get_by_path(dom, "spec")[0]
- self.__header = open(output_base + '.h', 'w')
- self.__docs = open(output_base + '-gtk-doc.h', 'w')
+ self.output_base = output_base
+ self.__header = []
+ self.__docs = []
def __call__(self):
self.do_header()
self.do_body()
self.do_footer()
+ file_set_contents(self.output_base + '.h', ''.join(self.__header))
+ file_set_contents(self.output_base + '-gtk-doc.h', ''.join(self.__docs))
+
def write(self, code):
- self.__header.write(code.encode('utf-8'))
+ self.__header.append(code.encode('utf-8'))
def d(self, code):
- self.__docs.write(code.encode('utf-8'))
+ self.__docs.append(code.encode('utf-8'))
# Header
def do_header(self):
@@ -62,8 +67,7 @@ extern "C" {
flags.getAttribute('name')
self.d("""\
/**
- *
-%s:
+ * %s:
""" % (self.prefix + name).replace('_', ''))
for flag in get_by_path(flags, 'flag'):
self.do_gtkdoc(flag, value_prefix)
@@ -97,8 +101,7 @@ extern "C" {
enum.getAttribute('name') + 's'
self.d("""\
/**
- *
-%s:
+ * %s:
""" % (self.prefix + name).replace('_', ''))
vals = get_by_path(enum, 'enumvalue')
for val in vals:
@@ -123,19 +126,29 @@ extern "C" {
self.d("""\
/**
- * NUM_%(upper-plural)s:
+ * %(upper-prefix)sNUM_%(upper-plural)s:
+ *
+ * 1 higher than the highest valid value of #%(mixed-name)s.
+ */
+
+/**
+ * NUM_%(upper-prefix)s%(upper-plural)s: (skip)
*
* 1 higher than the highest valid value of #%(mixed-name)s.
+ * In new code, use %(upper-prefix)sNUM_%(upper-plural)s instead.
*/
""" % {'mixed-name' : (self.prefix + name).replace('_', ''),
- 'upper-plural' : (self.prefix + name_plural).upper(),
+ 'upper-prefix' : self.prefix.upper(),
+ 'upper-plural' : name_plural.upper(),
'last-val' : vals[-1].getAttribute('value')})
self.write("""\
-#define NUM_%(upper-plural)s (%(last-val)s+1)
+#define %(upper-prefix)sNUM_%(upper-plural)s (%(last-val)s+1)
+#define NUM_%(upper-prefix)s%(upper-plural)s %(upper-prefix)sNUM_%(upper-plural)s
""" % {'mixed-name' : (self.prefix + name).replace('_', ''),
- 'upper-plural' : (self.prefix + name_plural).upper(),
+ 'upper-prefix' : self.prefix.upper(),
+ 'upper-plural' : name_plural.upper(),
'last-val' : vals[-1].getAttribute('value')})
def do_val(self, val, value_prefix):
diff --git a/tools/check-c-style.sh b/tools/check-c-style.sh
index 4330b1479..55834207a 100644
--- a/tools/check-c-style.sh
+++ b/tools/check-c-style.sh
@@ -3,13 +3,6 @@ fail=0
( . "${tools_dir}"/check-misc.sh ) || fail=$?
-if grep -n '^ *GError *\*[[:alpha:]_][[:alnum:]_]* *;' "$@"
-then
- echo "^^^ The above files contain uninitialized GError*s - they should be"
- echo " initialized to NULL"
- fail=1
-fi
-
# The first regex finds function calls like foo() (as opposed to foo ()).
# It attempts to ignore string constants (may cause false negatives).
# The second and third ignore block comments (gtkdoc uses foo() as markup).
diff --git a/tools/check-coding-style.mk b/tools/check-coding-style.mk
index 1c0a60f66..f3f74fa4a 100644
--- a/tools/check-coding-style.mk
+++ b/tools/check-coding-style.mk
@@ -10,7 +10,7 @@ check-coding-style:
sh $(top_srcdir)/tools/check-c-style.sh \
$(addprefix $(srcdir)/,$(check_c_sources)) || fail=1; \
fi;\
- if test yes = "$(ENABLE_CODING_STYLE_CHECKS)"; then \
+ if test yes = "$(enable_fatal_warnings)"; then \
exit "$$fail";\
else \
exit 0;\
diff --git a/tools/check-whitespace.sh b/tools/check-whitespace.sh
index 489322f9c..84356f20b 100644
--- a/tools/check-whitespace.sh
+++ b/tools/check-whitespace.sh
@@ -8,12 +8,6 @@ then
fail=1
fi
-if grep -n ' $' "$@"
-then
- echo "^^^ The above files contain unwanted trailing tabs"
- fail=1
-fi
-
# TODO: enable tab checking once all Empathy switched to TP coding style
#if grep -n ' ' "$@"
#then
diff --git a/tools/glib-client-gen.py b/tools/glib-client-gen.py
index 6b0bdeba1..f8465a62b 100644
--- a/tools/glib-client-gen.py
+++ b/tools/glib-client-gen.py
@@ -27,6 +27,7 @@ import os.path
import xml.dom.minidom
from getopt import gnu_getopt
+from libtpcodegen import file_set_contents
from libglibcodegen import Signature, type_to_gtype, cmp_by_name, \
get_docstring, xml_escape, get_deprecated
@@ -56,12 +57,22 @@ 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')
+ self.guard = opts.get('--guard', None)
+
def h(self, s):
if isinstance(s, unicode):
s = s.encode('utf-8')
@@ -139,8 +150,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 +447,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 +707,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 ')
@@ -758,9 +783,11 @@ class Generator(object):
self.b(' g_return_val_if_fail (callback != NULL || '
'weak_object == NULL, NULL);')
self.b('')
+ self.b(' G_GNUC_BEGIN_IGNORE_DEPRECATIONS')
self.b(' iface = tp_proxy_borrow_interface_by_id (')
self.b(' (TpProxy *) proxy,')
self.b(' interface, &error);')
+ self.b(' G_GNUC_END_IGNORE_DEPRECATIONS')
self.b('')
self.b(' if (iface == NULL)')
self.b(' {')
@@ -832,9 +859,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 +879,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 +960,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 +973,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 +1016,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:
@@ -1031,8 +1066,10 @@ class Generator(object):
self.b(' g_return_val_if_fail (%s (proxy), FALSE);'
% self.proxy_assert)
self.b('')
+ self.b(' G_GNUC_BEGIN_IGNORE_DEPRECATIONS')
self.b(' iface = tp_proxy_borrow_interface_by_id')
self.b(' ((TpProxy *) proxy, interface, error);')
+ self.b(' G_GNUC_END_IGNORE_DEPRECATIONS')
self.b('')
self.b(' if (iface == NULL)')
self.b(' return FALSE;')
@@ -1140,6 +1177,11 @@ class Generator(object):
def __call__(self):
+ if self.guard is not None:
+ self.h('#ifndef %s' % self.guard)
+ self.h('#define %s' % self.guard)
+ self.h('')
+
self.h('G_BEGIN_DECLS')
self.h('')
@@ -1198,10 +1240,13 @@ class Generator(object):
self.h('G_END_DECLS')
self.h('')
- open(self.basename + '.h', 'w').write('\n'.join(self.__header))
- open(self.basename + '-body.h', 'w').write('\n'.join(self.__body))
- open(self.basename + '-gtk-doc.h', 'w').write('\n'.join(self.__docs))
+ if self.guard is not None:
+ self.h('#endif /* defined (%s) */' % self.guard)
+ self.h('')
+ file_set_contents(self.basename + '.h', '\n'.join(self.__header))
+ file_set_contents(self.basename + '-body.h', '\n'.join(self.__body))
+ file_set_contents(self.basename + '-gtk-doc.h', '\n'.join(self.__docs))
def types_to_gtypes(types):
return [type_to_gtype(t)[1] for t in types]
@@ -1211,8 +1256,8 @@ if __name__ == '__main__':
options, argv = gnu_getopt(sys.argv[1:], '',
['group=', 'subclass=', 'subclass-assert=',
'iface-quark-prefix=', 'tp-proxy-api=',
- 'generate-reentrant', 'deprecate-reentrant=',
- 'deprecation-attribute='])
+ 'generate-reentrant=', 'deprecate-reentrant=',
+ 'deprecation-attribute=', 'guard='])
opts = {}
diff --git a/tools/glib-client-marshaller-gen.py b/tools/glib-client-marshaller-gen.py
index 54447255b..cb27d638a 100644
--- a/tools/glib-client-marshaller-gen.py
+++ b/tools/glib-client-marshaller-gen.py
@@ -40,7 +40,8 @@ class Generator(object):
for marshaller in all:
rhs = self.marshallers[marshaller]
- print ' dbus_g_object_register_marshaller (%s,' % marshaller
+ print ' dbus_g_object_register_marshaller ('
+ print ' g_cclosure_marshal_generic,'
print ' G_TYPE_NONE, /* return */'
for type in rhs:
print ' G_TYPE_%s,' % type.replace('VOID', 'NONE')
diff --git a/tools/glib-errors-str-gen.py b/tools/glib-errors-str-gen.py
index a948a7ca8..b2cf520bd 100644
--- a/tools/glib-errors-str-gen.py
+++ b/tools/glib-errors-str-gen.py
@@ -3,6 +3,7 @@
import sys
import xml.dom.minidom
+from libtpcodegen import file_set_contents
from libglibcodegen import NS_TP, get_docstring, xml_escape
class Generator(object):
@@ -71,9 +72,9 @@ class Generator(object):
self.h('')
self.b('')
- open(self.basename + '.h', 'w').write('\n'.join(self.__header))
- open(self.basename + '.c', 'w').write('\n'.join(self.__body))
- open(self.basename + '-gtk-doc.h', 'w').write('\n'.join(self.__docs))
+ file_set_contents(self.basename + '.h', '\n'.join(self.__header))
+ file_set_contents(self.basename + '.c', '\n'.join(self.__body))
+ file_set_contents(self.basename + '-gtk-doc.h', '\n'.join(self.__docs))
if __name__ == '__main__':
argv = sys.argv[1:]
diff --git a/tools/glib-ginterface-gen.py b/tools/glib-ginterface-gen.py
index 9dfdcc75d..6fec0d3c4 100644
--- a/tools/glib-ginterface-gen.py
+++ b/tools/glib-ginterface-gen.py
@@ -26,13 +26,23 @@ import sys
import os.path
import xml.dom.minidom
+from libtpcodegen import file_set_contents
from libglibcodegen import Signature, type_to_gtype, cmp_by_name, \
- NS_TP, dbus_gutils_wincaps_to_uscore, \
- signal_to_marshal_name, method_to_glue_marshal_name
+ NS_TP, dbus_gutils_wincaps_to_uscore
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')))
@@ -399,8 +421,7 @@ class Generator(object):
'not match' % (method.getAttribute('name'), lc_name))
lc_name = lc_name.lower()
- marshaller = method_to_glue_marshal_name(method,
- self.signal_marshal_prefix)
+ marshaller = 'g_cclosure_marshal_generic'
wrapper = self.prefix_ + self.node_name_lc + '_' + lc_name
self.b(" { (GCallback) %s, %s, %d }," % (wrapper, marshaller, offset))
@@ -695,8 +716,7 @@ class Generator(object):
in_base_init.append(' G_SIGNAL_RUN_LAST|G_SIGNAL_DETAILED,')
in_base_init.append(' 0,')
in_base_init.append(' NULL, NULL,')
- in_base_init.append(' %s,'
- % signal_to_marshal_name(signal, self.signal_marshal_prefix))
+ in_base_init.append(' g_cclosure_marshal_generic,')
in_base_init.append(' G_TYPE_NONE,')
tmp = ['%d' % len(args)] + [gtype for (ctype, name, gtype) in args]
in_base_init.append(' %s);' % ',\n '.join(tmp))
@@ -718,8 +738,9 @@ class Generator(object):
self.h('#include <glib-object.h>')
self.h('#include <dbus/dbus-glib.h>')
- if self.have_properties(nodes):
- self.h('#include <telepathy-glib/dbus-properties-mixin.h>')
+ for header in self.headers:
+ self.h('#include %s' % header)
+ self.h('')
self.h('')
self.h('G_BEGIN_DECLS')
@@ -727,9 +748,6 @@ class Generator(object):
self.b('#include "%s.h"' % self.basename)
self.b('')
- for header in self.headers:
- self.b('#include %s' % header)
- self.b('')
for node in nodes:
self.do_node(node)
@@ -743,10 +761,9 @@ class Generator(object):
self.h('')
self.b('')
- open(self.basename + '.h', 'w').write('\n'.join(self.__header))
- open(self.basename + '.c', 'w').write('\n'.join(self.__body))
- open(self.basename + '-gtk-doc.h', 'w').write('\n'.join(self.__docs))
-
+ file_set_contents(self.basename + '.h', '\n'.join(self.__header))
+ file_set_contents(self.basename + '.c', '\n'.join(self.__body))
+ file_set_contents(self.basename + '-gtk-doc.h', '\n'.join(self.__docs))
def cmdline_error():
print """\
diff --git a/tools/glib-gtypes-generator.py b/tools/glib-gtypes-generator.py
index a49c36e7f..21dfc6aa7 100644
--- a/tools/glib-gtypes-generator.py
+++ b/tools/glib-gtypes-generator.py
@@ -23,6 +23,7 @@
import sys
import xml.dom.minidom
+from libtpcodegen import file_set_contents
from libglibcodegen import escape_as_identifier, \
get_docstring, \
NS_TP, \
@@ -42,15 +43,16 @@ class GTypesGenerator(object):
self.PREFIX_ = self.Prefix.upper() + '_'
self.prefix_ = self.Prefix.lower() + '_'
- self.header = open(output + '.h', 'w')
- self.body = open(output + '-body.h', 'w')
- self.docs = open(output + '-gtk-doc.h', 'w')
+ self.header = []
+ self.body = []
+ self.docs = []
+ self.output = output
for f in (self.header, self.body, self.docs):
- f.write('/* Auto-generated, do not edit.\n *\n'
- ' * This file may be distributed under the same terms\n'
- ' * as the specification from which it was generated.\n'
- ' */\n\n')
+ f.append('/* Auto-generated, do not edit.\n *\n'
+ ' * This file may be distributed under the same terms\n'
+ ' * as the specification from which it was generated.\n'
+ ' */\n\n')
# keys are e.g. 'sv', values are the key escaped
self.need_mappings = {}
@@ -66,13 +68,13 @@ class GTypesGenerator(object):
self.need_other_arrays = {}
def h(self, code):
- self.header.write(code.encode("utf-8"))
+ self.header.append(code.encode("utf-8"))
def c(self, code):
- self.body.write(code.encode("utf-8"))
+ self.body.append(code.encode("utf-8"))
def d(self, code):
- self.docs.write(code.encode('utf-8'))
+ self.docs.append(code.encode('utf-8'))
def do_mapping_header(self, mapping):
members = mapping.getElementsByTagNameNS(NS_TP, 'member')
@@ -89,7 +91,7 @@ class GTypesGenerator(object):
docstring = get_docstring(mapping) or '(Undocumented)'
- self.d('/**\n * %s:\n *\n' % name)
+ self.d('/**\n * %s:\n *\n' % name.strip())
self.d(' * %s\n' % xml_escape(docstring))
self.d(' *\n')
self.d(' * This macro expands to a call to a function\n')
@@ -290,6 +292,10 @@ class GTypesGenerator(object):
self.c(' return t;\n')
self.c('}\n\n')
+ file_set_contents(self.output + '.h', ''.join(self.header))
+ file_set_contents(self.output + '-body.h', ''.join(self.body))
+ file_set_contents(self.output + '-gtk-doc.h', ''.join(self.docs))
+
if __name__ == '__main__':
argv = sys.argv[1:]
diff --git a/tools/glib-interfaces-gen.py b/tools/glib-interfaces-gen.py
index 69c721be3..410762cde 100644
--- a/tools/glib-interfaces-gen.py
+++ b/tools/glib-interfaces-gen.py
@@ -3,6 +3,7 @@
from sys import argv, stdout, stderr
import xml.dom.minidom
+from libtpcodegen import file_set_contents
from libglibcodegen import NS_TP, get_docstring, \
get_descendant_text, get_by_path
@@ -13,25 +14,33 @@ class Generator(object):
assert declfile.endswith('.h')
docfile = declfile[:-2] + '-gtk-doc.h'
- self.impls = open(implfile, 'w')
- self.decls = open(declfile, 'w')
- self.docs = open(docfile, 'w')
+ self.implfile = implfile
+ self.declfile = declfile
+ self.docfile = docfile
+
+ self.impls = []
+ self.decls = []
+ self.docs = []
self.spec = get_by_path(dom, "spec")[0]
def h(self, code):
- self.decls.write(code.encode('utf-8'))
+ self.decls.append(code.encode('utf-8'))
def c(self, code):
- self.impls.write(code.encode('utf-8'))
+ self.impls.append(code.encode('utf-8'))
def d(self, code):
- self.docs.write(code.encode('utf-8'))
+ self.docs.append(code.encode('utf-8'))
def __call__(self):
for f in self.h, self.c:
self.do_header(f)
self.do_body()
+ file_set_contents(self.implfile, ''.join(self.impls))
+ file_set_contents(self.declfile, ''.join(self.decls))
+ file_set_contents(self.docfile, ''.join(self.docs))
+
# Header
def do_header(self, f):
f('/* Generated from: ')
@@ -49,6 +58,7 @@ class Generator(object):
f("""
*/
+#include <glib.h>
""")
# Body
diff --git a/tools/lcov.am b/tools/lcov.am
index 97eed8f41..80023cb78 100644
--- a/tools/lcov.am
+++ b/tools/lcov.am
@@ -8,7 +8,9 @@ lcov-report:
--remove @top_builddir@/lcov.info.tmp telepathy-glib-scan.c
rm @top_builddir@/lcov.info.tmp
$(mkdir_p) @top_builddir@/lcov.html
- genhtml --title telepathy-glib \
+ echo "Coming soon!" > @top_builddir@/lcov.html/index.html
+ git_commit=`GIT_DIR=@top_srcdir@/.git git log -1 --pretty=format:%h 2>/dev/null`;\
+ genhtml --title "@PACKAGE_STRING@ $$git_commit" \
--output-directory @top_builddir@/lcov.html lcov.info
@echo
@echo 'lcov report can be found in:'
@@ -17,7 +19,7 @@ lcov-report:
lcov-check:
$(MAKE) lcov-reset
- $(MAKE) check
+ $(MAKE) check $(LCOV_CHECK_ARGS)
$(MAKE) lcov-report
## vim:set ft=automake:
diff --git a/tools/libtpcodegen.py b/tools/libtpcodegen.py
index 837ff2f74..7e9eb9a50 100644
--- a/tools/libtpcodegen.py
+++ b/tools/libtpcodegen.py
@@ -20,7 +20,7 @@ please make any changes there.
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
+import os
from string import ascii_letters, digits
@@ -28,6 +28,18 @@ NS_TP = "http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"
_ASCII_ALNUM = ascii_letters + digits
+def file_set_contents(filename, contents):
+ try:
+ os.remove(filename)
+ except OSError:
+ pass
+ try:
+ os.remove(filename + '.tmp')
+ except OSError:
+ pass
+
+ open(filename + '.tmp', 'w').write(contents)
+ os.rename(filename + '.tmp', filename)
def cmp_by_name(node1, node2):
return cmp(node1.getAttributeNode("name").nodeValue,
diff --git a/tools/make-release-mail.py b/tools/make-release-mail.py
index 2bd7c2bcc..b03ebd256 100644
--- a/tools/make-release-mail.py
+++ b/tools/make-release-mail.py
@@ -6,6 +6,15 @@
# to <telepathy@lists.freedesktop.org>. I hope that you enjoy your stay.
import sys
+import re
+
+def looks_like_a_header(line, package, version=None):
+ if version is None:
+ pattern = "^%s .* \(.*\)$" % package
+ else:
+ pattern = "^%s %s \(.*\)$" % (package, version)
+
+ return re.match(pattern, line) is not None
def extract_description(package, version, news_path):
release_name = []
@@ -15,7 +24,7 @@ def extract_description(package, version, news_path):
lines = (line for line in f.readlines())
for line in lines:
# Find the 'telepathy-foo 0.1.2' header
- if line.startswith("%s %s" % (package, version)):
+ if looks_like_a_header(line, package, version):
break
# Skip the ====== line, and the first blank line
@@ -27,7 +36,7 @@ def extract_description(package, version, news_path):
for line in lines:
line = line.rstrip()
# If we hit the next version header, we're done
- if line.startswith(package):
+ if looks_like_a_header(line, package):
break
# Else, if we hit a blank line and we're still reading the release
# name, we're done with the release name.
@@ -45,6 +54,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 +64,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/make-version-script.py b/tools/make-version-script.py
index 91306a014..0d30aa323 100644
--- a/tools/make-version-script.py
+++ b/tools/make-version-script.py
@@ -30,7 +30,7 @@ This script originates in telepathy-glib <http://telepathy.freedesktop.org/> -
please send us any changes that are needed.
"""
-# Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
+# Copyright (C) 2008-2010 Collabora Ltd. <http://www.collabora.co.uk/>
# Copyright (C) 2008 Nokia Corporation
#
# Copying and distribution of this file, with or without modification,
@@ -39,7 +39,6 @@ please send us any changes that are needed.
import sys
from getopt import gnu_getopt
-from sets import Set as set
def e(format, *args):
@@ -135,6 +134,10 @@ def main(abifiles, symbols=None, unreleased_version=None,
elif dpkg:
dpkg_symbols.append('%s@%s %s' % (symbol, version, release))
+ if symbol in versioned_symbols:
+ raise AssertionError('Symbol %s is in version %s and an '
+ 'earlier version' % (symbol, version))
+
versioned_symbols.add(symbol)
if gnuld:
diff --git a/tools/manager-file.py b/tools/manager-file.py
index 45f640403..e1b51a616 100644
--- a/tools/manager-file.py
+++ b/tools/manager-file.py
@@ -163,13 +163,25 @@ if __name__ == '__main__':
environment = {}
execfile(sys.argv[1], environment)
- f = open('%s/%s.manager' % (sys.argv[2], environment['MANAGER']), 'w')
+ filename = '%s/%s.manager' % (sys.argv[2], environment['MANAGER'])
+ try:
+ os.remove(filename)
+ except OSError:
+ pass
+ f = open(filename + '.tmp', 'w')
write_manager(f, environment['MANAGER'], environment['PARAMS'])
f.close()
-
- f = open('%s/param-spec-struct.h' % sys.argv[2], 'w')
+ os.rename(filename + '.tmp', filename)
+
+ filename = '%s/param-spec-struct.h' % sys.argv[2]
+ try:
+ os.remove(filename)
+ except OSError:
+ pass
+ f = open(filename + '.tmp', 'w')
for protocol in environment['PARAMS']:
write_c_params(f, environment['MANAGER'], protocol,
environment['STRUCTS'][protocol],
environment['PARAMS'][protocol])
f.close()
+ os.rename(filename + '.tmp', filename)
diff --git a/tools/telepathy.am b/tools/telepathy.am
index d061b8918..20ff0be13 100644
--- a/tools/telepathy.am
+++ b/tools/telepathy.am
@@ -3,19 +3,69 @@
dist-hook:
chmod u+w ${distdir}/ChangeLog
if test -d ${top_srcdir}/.git; then \
- git log --stat > ${distdir}/ChangeLog || \
- git log > ${distdir}/ChangeLog; \
+ ( cd ${top_srcdir} && git log --date=iso $(CHANGELOG_RANGE) ) > ${distdir}/ChangeLog; \
fi
-maintainer-upload-release: _maintainer-upload-release
+distcheck-hook:
+ @test "z$(CHECK_FOR_UNRELEASED)" = z || \
+ case @VERSION@ in \
+ *.*.*.*|*+) ;; \
+ *) \
+ if grep -r UNRELEASED $(CHECK_FOR_UNRELEASED); \
+ then \
+ echo "^^^ This is meant to be a release, but some files say UNRELEASED" >&2; \
+ exit 2; \
+ fi \
+ ;; \
+ esac
-_maintainer-upload-release-check:
+_is-release-check:
@case @VERSION@ in \
- (*.*.*.*) \
- echo "@VERSION@ is not a release" >&2; \
+ (*.*.*.*|*+) \
+ echo "Hey! @VERSION@ is not a release!" >&2; \
exit 2; \
;; \
esac
+ @cd ${top_srcdir} && \
+ if ! git diff --no-ext-diff --quiet --exit-code; then \
+ echo "Hey! Your tree is dirty! No release for you." >&2; \
+ exit 2; \
+ fi
+ @cd ${top_srcdir} && \
+ if ! git diff --cached --no-ext-diff --quiet --exit-code; then \
+ echo "Hey! You have changes staged! No release for you." >&2; \
+ exit 2; \
+ fi
+if ENABLE_GTK_DOC
+else
+ @echo "Hey! You need to pass --enable-gtk-doc to configure!"
+ @exit 2;
+endif
+
+%.tar.gz.asc: %.tar.gz
+ $(AM_V_GEN)gpg --detach-sign --armor $@
+
+@PACKAGE@-@VERSION@.tar.gz:
+ $(MAKE) _is-release-check
+ $(MAKE) check
+ $(MAKE) distcheck
+
+maintainer-prepare-release:
+ $(MAKE) _is-release-check
+ $(MAKE) all
+ $(MAKE) distcheck
+ $(MAKE) release-mail
+ git tag -s @PACKAGE@-@VERSION@ -m @PACKAGE@' '@VERSION@
+ gpg --detach-sign --armor @PACKAGE@-@VERSION@.tar.gz
+
+release-mail: NEWS
+ $(AM_V_GEN)(python $(top_srcdir)/tools/make-release-mail.py \
+ @PACKAGE@ @VERSION@ $(top_srcdir)/NEWS > $@.tmp && \
+ mv $@.tmp $@)
+
+maintainer-upload-release: _maintainer-upload-release
+
+_maintainer-upload-release-check: _is-release-check
test -f @PACKAGE@-@VERSION@.tar.gz
test -f @PACKAGE@-@VERSION@.tar.gz.asc
gpg --verify @PACKAGE@-@VERSION@.tar.gz.asc
@@ -24,4 +74,12 @@ _maintainer-upload-release: _maintainer-upload-release-check
rsync -vzP @PACKAGE@-@VERSION@.tar.gz telepathy.freedesktop.org:/srv/telepathy.freedesktop.org/www/releases/@PACKAGE@/@PACKAGE@-@VERSION@.tar.gz
rsync -vzP @PACKAGE@-@VERSION@.tar.gz.asc telepathy.freedesktop.org:/srv/telepathy.freedesktop.org/www/releases/@PACKAGE@/@PACKAGE@-@VERSION@.tar.gz.asc
+maintainer-make-release:
+ $(MAKE) maintainer-prepare-release
+ $(MAKE) maintainer-upload-release
+ @echo "Now:"
+ @echo " • bump the nano-version;"
+ @echo " • push the branch and tags upstream; and"
+ @echo " • send release-mail to <telepathy@lists.freedesktop.org>."
+
## vim:set ft=automake:
diff --git a/tools/with-session-bus.sh b/tools/with-session-bus.sh
index cfedb5b9d..b3038cd9e 100644
--- a/tools/with-session-bus.sh
+++ b/tools/with-session-bus.sh
@@ -79,6 +79,8 @@ 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