pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/x11/gtk2 gtk2: Add support for Python 3
details: https://anonhg.NetBSD.org/pkgsrc/rev/bdee60f6db79
branches: trunk
changeset: 443740:bdee60f6db79
user: nia <nia%pkgsrc.org@localhost>
date: Sun Dec 20 12:17:12 2020 +0000
description:
gtk2: Add support for Python 3
The only thing using Python in the main gtk2 package is the optional
gtk-builder-convert script that is shipped with the distribution.
This script can run in a Python 3 interpreter using some preexisting
patches (in this case, taken from MacPorts)
diffstat:
x11/gtk2/Makefile | 5 +-
x11/gtk2/distinfo | 3 +-
x11/gtk2/patches/patch-gtk_gtk-builder-convert | 123 +++++++++++++++++++++++++
3 files changed, 127 insertions(+), 4 deletions(-)
diffs (165 lines):
diff -r 2ea16f7b7e6e -r bdee60f6db79 x11/gtk2/Makefile
--- a/x11/gtk2/Makefile Sun Dec 20 11:38:34 2020 +0000
+++ b/x11/gtk2/Makefile Sun Dec 20 12:17:12 2020 +0000
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.318 2020/12/04 20:45:50 nia Exp $
+# $NetBSD: Makefile,v 1.319 2020/12/20 12:17:12 nia Exp $
DISTNAME= gtk+-2.24.32
PKGNAME= ${DISTNAME:S/gtk/gtk2/}
-PKGREVISION= 18
+PKGREVISION= 19
CATEGORIES= x11 gnome
MASTER_SITES= ${MASTER_SITE_GNOME:=sources/gtk+/2.24/}
EXTRACT_SUFX= .tar.xz
@@ -74,7 +74,6 @@
SUBST_SED.iconcache= -e 's,gtk-update-icon-cache,gtk2-update-icon-cache,g'
SUBST_FILES.iconcache= gtk/Makefile.in
-PYTHON_VERSIONS_ACCEPTED= 27 # not yet ported as of 2.24.22
REPLACE_PYTHON= gtk/gtk-builder-convert
# We remove the module databases during post-install since we create them
diff -r 2ea16f7b7e6e -r bdee60f6db79 x11/gtk2/distinfo
--- a/x11/gtk2/distinfo Sun Dec 20 11:38:34 2020 +0000
+++ b/x11/gtk2/distinfo Sun Dec 20 12:17:12 2020 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.164 2019/01/06 18:58:34 rillig Exp $
+$NetBSD: distinfo,v 1.165 2020/12/20 12:17:12 nia Exp $
SHA1 (gtk+-2.24.32.tar.xz) = c885ade62b06854590822c8eb906daf7dd15d90a
RMD160 (gtk+-2.24.32.tar.xz) = c0c83479fad040e25159bf7a8a9eb51322716a56
@@ -7,5 +7,6 @@
SHA1 (patch-ab) = 9c82cc60f3825d377a197c876fcc6faa379cbde3
SHA1 (patch-af) = d59414e24a7da7f8694dbefbd2f0c2c2b60ec5ad
SHA1 (patch-aj) = 9887573ac7ade9e8f8ee2ead68e279f67836a1a3
+SHA1 (patch-gtk_gtk-builder-convert) = b6fced6b25e671a13e917967ec95d5f040578d8c
SHA1 (patch-gtk_gtksearchenginesimple.c) = 3c44b84f2e0d3f7cdfb594bf56370f588d165b14
SHA1 (patch-gtk_gtktooltips.c) = 94f384b4becd74a9effcdbb72bbe3ee9a58d2bb8
diff -r 2ea16f7b7e6e -r bdee60f6db79 x11/gtk2/patches/patch-gtk_gtk-builder-convert
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/x11/gtk2/patches/patch-gtk_gtk-builder-convert Sun Dec 20 12:17:12 2020 +0000
@@ -0,0 +1,123 @@
+$NetBSD: patch-gtk_gtk-builder-convert,v 1.1 2020/12/20 12:17:12 nia Exp $
+
+Compatibility with Python 3. From MacPorts.
+
+--- gtk/gtk-builder-convert.orig 2016-10-22 04:12:40.000000000 +0000
++++ gtk/gtk-builder-convert
+@@ -54,6 +54,24 @@ try:
+ except ImportError:
+ subprocess = None
+
++# Sorted
++try:
++ sorted = sorted
++except NameError:
++ def sorted(iterable, cmp=None, key=None, reverse=False):
++ if key is None:
++ lst = list(iterable)
++ else:
++ lst = [(key(val), idx, val) for idx, val in enumerate(iterable)]
++ lst.sort()
++ if key is None:
++ if reverse:
++ return lst[::-1]
++ return lst
++ if reverse:
++ lst = lst[::-1]
++ return [i[-1] for i in lst]
++
+ def get_child_nodes(node):
+ assert node.tagName == 'object'
+ nodes = []
+@@ -259,7 +277,7 @@ class GtkBuilderConverter(object):
+ for node in objects:
+ self._convert(node.getAttribute("class"), node)
+ if self._get_object(node.getAttribute('id')) is not None:
+- print "WARNING: duplicate id \"" + node.getAttribute('id') + "\""
++ print("WARNING: duplicate id \"" + node.getAttribute('id') + "\"")
+ self.objects[node.getAttribute('id')] = node
+
+ # Convert Gazpachos UI tag
+@@ -270,15 +288,7 @@ class GtkBuilderConverter(object):
+ for node in self._dom.getElementsByTagName("accessibility"):
+ self._convert_accessibility(node)
+
+- # Output the newly created root objects and sort them
+- # by attribute id
+- # FIXME: Use sorted(self.root_objects,
+- # key=lambda n: n.getAttribute('id'),
+- # reverse=True):
+- # when we can depend on python 2.4 or higher
+- root_objects = self.root_objects[:]
+- root_objects.sort(lambda a, b: cmp(b.getAttribute('id'),
+- a.getAttribute('id')))
++ root_objects = sorted(self.root_objects, key=lambda n: n.getAttribute('id'), reverse=True)
+ for obj in root_objects:
+ self._interface.childNodes.insert(0, obj)
+
+@@ -461,8 +471,8 @@ class GtkBuilderConverter(object):
+ if signal_name in ['activate', 'toggled']:
+ action.appendChild(signal)
+ else:
+- print 'Unhandled signal %s::%s' % (node.getAttribute('class'),
+- signal_name)
++ print('Unhandled signal %s::%s' % (node.getAttribute('class'),
++ signal_name))
+
+ if not uimgr.childNodes:
+ child = self._dom.createElement('child')
+@@ -481,8 +491,8 @@ class GtkBuilderConverter(object):
+ for accelerator in get_accelerator_nodes(node):
+ signal_name = accelerator.getAttribute('signal')
+ if signal_name != 'activate':
+- print 'Unhandled accelerator signal for %s::%s' % (
+- node.getAttribute('class'), signal_name)
++ print('Unhandled accelerator signal for %s::%s' % (
++ node.getAttribute('class'), signal_name))
+ continue
+ accelerator.removeAttribute('signal')
+ child.appendChild(accelerator)
+@@ -547,12 +557,12 @@ class GtkBuilderConverter(object):
+ if prop.childNodes:
+ data = prop.childNodes[0].data
+ value, lower, upper, step, page, page_size = data.split(' ')
+- properties.update(value=value,
+- lower=lower,
+- upper=upper,
+- step_increment=step,
+- page_increment=page,
+- page_size=page_size)
++ properties.update(dict(value=value,
++ lower=lower,
++ upper=upper,
++ step_increment=step,
++ page_increment=page,
++ page_size=page_size))
+ else:
+ prop.appendChild(self._dom.createTextNode(""))
+
+@@ -747,7 +757,7 @@ def _indent(output):
+ return s.stdout.read()
+
+ def usage():
+- print __doc__
++ print(__doc__)
+
+ def main(args):
+ try:
+@@ -786,12 +796,12 @@ def main(args):
+ root=root)
+ conv.parse_file(input_filename)
+
+- xml = _indent(conv.to_xml())
++ xml = _indent(conv.to_xml()).decode()
+ if output_filename == "-":
+- print xml
++ print(xml)
+ else:
+ open(output_filename, 'w').write(xml)
+- print "Wrote", output_filename
++ print("Wrote", output_filename)
+
+ return 0
+
Home |
Main Index |
Thread Index |
Old Index