head 1.2; access; symbols pkgsrc-2020Q4:1.1.0.2 pkgsrc-2020Q4-base:1.1; locks; strict; comment @# @; 1.2 date 2021.01.01.15.46.56; author nia; state dead; branches; next 1.1; commitid iytQ8AyMxzT2t2CC; 1.1 date 2020.12.20.12.17.12; author nia; state Exp; branches; next ; commitid ToWL3843qIBGGtAC; desc @@ 1.2 log @gtk2: Update to 2.24.33 Overview of Changes from GTK+ 2.24.32 to 2.24.33 ================================================ ********************************************************* * * * This is the final GTK 2.x release. * * There will be no more updates to GTK 2. * * All users are encouraged to update to GTK 3 or 4. * * * ********************************************************* * Make the output of gtk-query-immodules deterministic * GtkCalendar: Use %OB if supported * GtkIconTheme: prefer exact matches * win32: - Always process all available messages - Ignore autorepeat for modifier keys - Ensure monitor enumeration matches up - Fix pkg-config file generation with msvc - Fix UAC manifest rc file - Add Visual Studio 2019 project files * MacOS: - Use NSGraphicsContext after Yosemite - Force redraw on Mojave and later when processing updates - Fix a use-after-free * build: - Support automake 1.16 - Fix compiler warnings with newer gcc @ text @$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 @ 1.1 log @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) @ text @d1 1 a1 1 $NetBSD$ @