From 6f1bca575bef9a8a58cd7cd90175f38cbce3c940 Mon Sep 17 00:00:00 2001 From: Samuel Martin Date: Sat, 18 Aug 2012 14:05:40 +0200 Subject: libglib2: make codegen python2/python3 compliant Signed-off-by: Samuel Martin create mode 100644 package/libglib2/libglib2-make-codegen-python2-python3-compliant.patch Signed-off-by: Thomas Petazzoni --- ...b2-make-codegen-python2-python3-compliant.patch | 192 +++++++++++++++++++++ 1 file changed, 192 insertions(+) create mode 100644 package/libglib2/libglib2-make-codegen-python2-python3-compliant.patch (limited to 'package') diff --git a/package/libglib2/libglib2-make-codegen-python2-python3-compliant.patch b/package/libglib2/libglib2-make-codegen-python2-python3-compliant.patch new file mode 100644 index 000000000..b4838270b --- /dev/null +++ b/package/libglib2/libglib2-make-codegen-python2-python3-compliant.patch @@ -0,0 +1,192 @@ +Fetch from http://git.gnome.org/browse/glib/patch/?id=03611f7c0670ea14eedbc121972aed7ce60bb9ee + +This patch is already included upstream, from the glib-2.32.4 release. + +Signed-off-by: Samuel Martin +--- +From 03611f7c0670ea14eedbc121972aed7ce60bb9ee Mon Sep 17 00:00:00 2001 +From: Simon Feltman +Date: Thu, 14 Jun 2012 06:20:17 +0000 +Subject: Updated codegen to work with python3. + +Most changes were just replacing usage of "has_key" with "in". +Also updated the sorting function which was simplified and +changed to a "key" function instead of "cmp" (which is no longer +supported in python3. Verified everything builds with +python 2.7 and 3. + +https://bugzilla.gnome.org/show_bug.cgi?id=678066 +--- +diff --git a/gio/gdbus-2.0/codegen/codegen.py b/gio/gdbus-2.0/codegen/codegen.py +index 41ea8fa..bca3490 100644 +--- a/gio/gdbus-2.0/codegen/codegen.py ++++ b/gio/gdbus-2.0/codegen/codegen.py +@@ -304,11 +304,8 @@ class CodeGenerator: + # + # See https://bugzilla.gnome.org/show_bug.cgi?id=647577#c5 + # for discussion +- keys = function_pointers.keys() +- if len(keys) > 0: +- keys.sort(cmp=utils.my_version_cmp) +- for key in keys: +- self.h.write('%s'%function_pointers[key]) ++ for key in sorted(function_pointers.keys(), key=utils.version_cmp_key): ++ self.h.write('%s'%function_pointers[key]) + + self.h.write('};\n') + self.h.write('\n') +@@ -1022,11 +1019,9 @@ class CodeGenerator: + value = '@get_%s: '%(p.name_lower) + value += 'Getter for the #%s:%s property.'%(i.camel_name, p.name_hyphen) + doc_bits[key] = value +- keys = doc_bits.keys() +- if len(keys) > 0: +- keys.sort(cmp=utils.my_version_cmp) +- for key in keys: +- self.c.write(' * %s\n'%doc_bits[key]) ++ for key in sorted(doc_bits.keys(), key=utils.version_cmp_key): ++ self.c.write(' * %s\n'%doc_bits[key]) ++ + self.c.write(self.docbook_gen.expand( + ' *\n' + ' * Virtual table for the D-Bus interface #%s.\n' +diff --git a/gio/gdbus-2.0/codegen/codegen_docbook.py b/gio/gdbus-2.0/codegen/codegen_docbook.py +index 4ceef57..00581f1 100644 +--- a/gio/gdbus-2.0/codegen/codegen_docbook.py ++++ b/gio/gdbus-2.0/codegen/codegen_docbook.py +@@ -259,14 +259,12 @@ class DocbookCodeGenerator: + self.expand_member_dict[key] = value + # Make sure to expand the keys in reverse order so e.g. #org.foo.Iface:MediaCompat + # is evaluated before #org.foo.Iface:Media ... +- self.expand_member_dict_keys = self.expand_member_dict.keys() +- self.expand_member_dict_keys.sort(reverse=True) +- self.expand_iface_dict_keys = self.expand_iface_dict.keys() +- self.expand_iface_dict_keys.sort(reverse=True) ++ self.expand_member_dict_keys = sorted(self.expand_member_dict.keys(), reverse=True) ++ self.expand_iface_dict_keys = sorted(self.expand_iface_dict.keys(), reverse=True) + + def generate(self): + for i in self.ifaces: +- self.out = file('%s-%s.xml'%(self.docbook, i.name), 'w') ++ self.out = open('%s-%s.xml'%(self.docbook, i.name), 'w') + self.out.write(''%()) + self.out.write('\n'%()) + self.out.write(' 0 and len(b[0]) > 0: +- va = distutils.version.LooseVersion(a[0]) +- vb = distutils.version.LooseVersion(b[0]) +- ret = va.__cmp__(vb) +- else: +- ret = cmp(a[0], b[0]) +- if ret != 0: +- return ret +- return cmp(a[1], b[1]) ++def version_cmp_key(key): ++ # If the 'since' version is empty put a 0 in its place as this will ++ # allow LooseVersion to work and will always compare lower. ++ v = key[0] if key[0] else '0' ++ return (distutils.version.LooseVersion(v), key[1]) +-- +cgit v0.9.0.2 -- cgit v1.2.3