gtk2/gtk2-converter-python3.patch
Dominique Leuenberger c3cdf3516e Accepting request 554632 from GNOME:Next
- Switch to using python3:
  + Replace -devel's python2-xml Requires with python3-xml.
  + Add gtk2-converter-python3.patch: convert gtk-build-converter
    to be a python3 script.

OBS-URL: https://build.opensuse.org/request/show/554632
OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gtk2?expand=0&rev=254
2017-12-06 08:18:39 +00:00

73 lines
2.8 KiB
Diff

Index: gtk+-2.24.31/gtk/gtk-builder-convert
===================================================================
--- gtk+-2.24.31.orig/gtk/gtk-builder-convert
+++ gtk+-2.24.31/gtk/gtk-builder-convert
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
#
# Copyright (C) 2006-2008 Async Open Source
# Henrique Romano <henrique@async.com.br>
@@ -210,7 +210,7 @@ class GtkBuilderConverter(object):
obj.setAttribute('class', obj_class)
obj.setAttribute('id', obj_id)
if properties:
- for name, value in properties.items():
+ for name, value in list(properties.items()):
if isinstance(value, Node):
# Reuse the node, so translatable and context still will be
# set when converting nodes. See also #509153
@@ -259,7 +259,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
@@ -461,8 +461,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 +481,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)
@@ -747,7 +747,7 @@ def _indent(output):
return s.stdout.read()
def usage():
- print __doc__
+ print(__doc__)
def main(args):
try:
@@ -788,10 +788,10 @@ def main(args):
xml = _indent(conv.to_xml())
if output_filename == "-":
- print xml
+ print(xml)
else:
open(output_filename, 'w').write(xml)
- print "Wrote", output_filename
+ print("Wrote", output_filename)
return 0