From 41a930fa3be4201ca5dba760b0d57ddd9e3a21ec8a260d93d42481c5bc72c305 Mon Sep 17 00:00:00 2001 From: Marguerite Su Date: Sat, 30 Aug 2014 18:13:04 +0000 Subject: [PATCH] Accepting request 246962 from home:MargueriteSu:branches:M17N fix for python3-ibus OBS-URL: https://build.opensuse.org/request/show/246962 OBS-URL: https://build.opensuse.org/package/show/M17N/ibus?expand=0&rev=123 --- ibus-python3-migration.patch | 480 +++++++++++++++++++++++++++++++++++ ibus.changes | 7 + ibus.spec | 3 + 3 files changed, 490 insertions(+) create mode 100644 ibus-python3-migration.patch diff --git a/ibus-python3-migration.patch b/ibus-python3-migration.patch new file mode 100644 index 0000000..57d039c --- /dev/null +++ b/ibus-python3-migration.patch @@ -0,0 +1,480 @@ +diff -urN ibus-1.5.8/ibus/attribute.py ibus-1.5.8.py3/ibus/attribute.py +--- ibus-1.5.8/ibus/attribute.py 2014-07-24 12:24:25.000000000 +0800 ++++ ibus-1.5.8.py3/ibus/attribute.py 2014-08-31 01:37:40.226988785 +0800 +@@ -38,8 +38,8 @@ + ) + + import dbus +-from exception import IBusException +-from serializable import * ++from ibus.exception import IBusException ++from ibus.serializable import * + + ATTR_TYPE_UNDERLINE = 1 + ATTR_TYPE_FOREGROUND = 2 +diff -urN ibus-1.5.8/ibus/bus.py ibus-1.5.8.py3/ibus/bus.py +--- ibus-1.5.8/ibus/bus.py 2014-07-24 12:24:25.000000000 +0800 ++++ ibus-1.5.8.py3/ibus/bus.py 2014-08-31 01:37:40.231988723 +0800 +@@ -29,10 +29,10 @@ + import dbus.connection + import dbus.mainloop.glib + import gobject +-import common +-import object +-import serializable +-import config ++from ibus import common ++from ibus import object ++from ibus import serializable ++from ibus import config + + dbus.mainloop.glib.DBusGMainLoop(set_as_default = True) + +@@ -74,9 +74,9 @@ + + def __filter_cb(self, conn, message): + if message.get_type() == 4: +- print "Signal %s" % message.get_member() +- print " sender = %s" % message.get_sender() +- print " path = %s" % message.get_path() ++ print("Signal %s" % message.get_member()) ++ print(" sender = %s" % message.get_sender()) ++ print(" path = %s" % message.get_path()) + return dbus.lowlevel.HANDLER_RESULT_NOT_YET_HANDLED + + def __dbusconn_disconnected_cb(self, dbusconn): +@@ -188,19 +188,19 @@ + mainloop = glib.MainLoop() + + def __disconnected_cb(*args): +- print "Disconnected", args ++ print("Disconnected", args) + mainloop.quit() + + b = Bus() + b.connect("disconnected", __disconnected_cb) + +- print "unique_name =", b.get_name() ++ print("unique_name =", b.get_name()) + + for i in b.list_factories(): +- print i.name ++ print(i.name) + + mainloop.run() +- print "Exit" ++ print("Exit") + + + if __name__ == "__main__": +diff -urN ibus-1.5.8/ibus/common.py ibus-1.5.8.py3/ibus/common.py +--- ibus-1.5.8/ibus/common.py 2014-07-24 12:24:25.000000000 +0800 ++++ ibus-1.5.8.py3/ibus/common.py 2014-08-31 01:37:40.231988723 +0800 +@@ -59,7 +59,7 @@ + import sys + #from xdg import BaseDirectory + import ctypes +-import _config ++from ibus import _config + + # __display = os.environ["DISPLAY"] + # __hostname, __display_screen = __display.split(":", 1) +diff -urN ibus-1.5.8/ibus/component.py ibus-1.5.8.py3/ibus/component.py +--- ibus-1.5.8/ibus/component.py 2014-07-24 12:24:25.000000000 +0800 ++++ ibus-1.5.8.py3/ibus/component.py 2014-08-31 01:37:40.228988760 +0800 +@@ -25,10 +25,10 @@ + ) + + import dbus +-from exception import IBusException +-from serializable import * +-from enginedesc import * +-from observedpath import * ++from ibus.exception import IBusException ++from ibus.serializable import * ++from ibus.enginedesc import * ++from ibus.observedpath import * + + class Component(Serializable): + __gtype_name__ = "PYIBusComponent" +diff -urN ibus-1.5.8/ibus/config.py ibus-1.5.8.py3/ibus/config.py +--- ibus-1.5.8/ibus/config.py 2014-07-24 12:24:25.000000000 +0800 ++++ ibus-1.5.8.py3/ibus/config.py 2014-08-31 01:37:40.228988760 +0800 +@@ -30,8 +30,8 @@ + IBUS_PATH_CONFIG = "/org/freedesktop/IBus/Config" + + import gobject +-import object +-import interface ++from ibus import object ++from ibus import interface + import dbus + from dbus.proxies import ProxyObject + +diff -urN ibus-1.5.8/ibus/_config.py.in ibus-1.5.8.py3/ibus/_config.py.in +--- ibus-1.5.8/ibus/_config.py.in 2014-07-24 12:24:25.000000000 +0800 ++++ ibus-1.5.8.py3/ibus/_config.py.in 2014-08-31 01:37:40.231988723 +0800 +@@ -32,10 +32,10 @@ + + import gettext + +-_ = lambda a: gettext.dgettext("@GETTEXT_PACKAGE@", a) ++_ = lambda a: gettext.dgettext("ibus10", a) + + def get_version(): +- return '@PACKAGE_VERSION@' ++ return '1.5.8' + + def get_copyright(): + return _('''Copyright (c) 2007-2010 Peng Huang +@@ -46,7 +46,7 @@ + + def get_ICON_KEYBOARD(): + import gtk +- icon = '@IBUS_ICON_KEYBOARD@' ++ icon = 'ibus-keyboard' + fallback_icon = 'ibus-keyboard' + settings = gtk.settings_get_default() + if settings.get_property('gtk-icon-theme-name') != 'gnome': +@@ -56,5 +56,5 @@ + return fallback_icon + return icon + +-LIBIBUS_SONAME='libibus-@IBUS_API_VERSION@.so.@LT_CURRENT_MINUS_AGE@' +-ISOCODES_PREFIX='@ISOCODES_PREFIX@' ++LIBIBUS_SONAME='libibus-1.0.so.5' ++ISOCODES_PREFIX='/usr' +diff -urN ibus-1.5.8/ibus/enginedesc.py ibus-1.5.8.py3/ibus/enginedesc.py +--- ibus-1.5.8/ibus/enginedesc.py 2014-07-24 12:24:25.000000000 +0800 ++++ ibus-1.5.8.py3/ibus/enginedesc.py 2014-08-31 01:37:40.231988723 +0800 +@@ -25,8 +25,8 @@ + ) + + import dbus +-from exception import IBusException +-from serializable import * ++from ibus.exception import IBusException ++from ibus.serializable import * + + class EngineDesc(Serializable): + __gtype_name__ = "PYIBusEngineDesc" +diff -urN ibus-1.5.8/ibus/engine.py ibus-1.5.8.py3/ibus/engine.py +--- ibus-1.5.8/ibus/engine.py 2014-07-24 12:24:25.000000000 +0800 ++++ ibus-1.5.8.py3/ibus/engine.py 2014-08-31 01:37:40.231988723 +0800 +@@ -24,11 +24,11 @@ + "EngineBase", + ) + +-import common +-import object +-import serializable +-import interface +-from text import Text ++from ibus import common ++from ibus import object ++from ibus import serializable ++from ibus import interface ++from ibus.text import Text + + class EngineBase(object.Object): + def __init__(self, bus, object_path): +diff -urN ibus-1.5.8/ibus/factory.py ibus-1.5.8.py3/ibus/factory.py +--- ibus-1.5.8/ibus/factory.py 2014-07-24 12:24:25.000000000 +0800 ++++ ibus-1.5.8.py3/ibus/factory.py 2014-08-31 01:37:40.228988760 +0800 +@@ -25,10 +25,10 @@ + "FactoryInfo" + ) + import dbus +-import object +-import interface +-from serializable import * +-from exception import * ++from ibus import object ++from ibus import interface ++from ibus.serializable import * ++from ibus.exception import * + + class EngineFactoryBase(object.Object): + def __init__(self, bus): +diff -urN ibus-1.5.8/ibus/__init__.py ibus-1.5.8.py3/ibus/__init__.py +--- ibus-1.5.8/ibus/__init__.py 2014-07-24 12:24:25.000000000 +0800 ++++ ibus-1.5.8.py3/ibus/__init__.py 2014-08-31 01:37:40.228988760 +0800 +@@ -24,25 +24,25 @@ + warnings.warn("The ibus module is deprecated; " + "Please use gobject-introspection instead", DeprecationWarning) + +-from object import * +-from attribute import * +-from property import * +-from common import * +-from interface import * +-from exception import * +-from lookuptable import * +-from bus import * +-from inputcontext import * +-from lang import * +-from utility import * +-from engine import * +-from factory import * +-from panel import * +-from notifications import * +-from config import * +-from serializable import * +-from text import * +-from observedpath import * +-from enginedesc import * +-from component import * +-from _config import * ++from ibus.object import * ++from ibus.attribute import * ++from ibus.property import * ++from ibus.common import * ++from ibus.interface import * ++from ibus.exception import * ++from ibus.lookuptable import * ++from ibus.bus import * ++from ibus.inputcontext import * ++from ibus.lang import * ++from ibus.utility import * ++from ibus.engine import * ++from ibus.factory import * ++from ibus.panel import * ++from ibus.notifications import * ++from ibus.config import * ++from ibus.serializable import * ++from ibus.text import * ++from ibus.observedpath import * ++from ibus.enginedesc import * ++from ibus.component import * ++from ibus._config import * +diff -urN ibus-1.5.8/ibus/inputcontext.py ibus-1.5.8.py3/ibus/inputcontext.py +--- ibus-1.5.8/ibus/inputcontext.py 2014-07-24 12:24:25.000000000 +0800 ++++ ibus-1.5.8.py3/ibus/inputcontext.py 2014-08-31 01:37:40.228988760 +0800 +@@ -28,10 +28,10 @@ + import gobject + import dbus + import dbus.lowlevel +-import object +-import common +-import serializable +-from text import Text ++from ibus import object ++from ibus import common ++from ibus import serializable ++from ibus.text import Text + + class InputContext(object.Object): + __gtype_name__ = "PYIBusInputContext" +@@ -286,10 +286,10 @@ + super(TestWindow,self).__init__() + + self.__bus = Bus() +- print self.__bus.get_name() ++ print(self.__bus.get_name()) + self.__bus.connect("disconnected", gtk.main_quit) + context_path = self.__bus.create_input_context("Test") +- print context_path ++ print(context_path) + self.__context = InputContext(self.__bus, context_path) + self.__context.set_capabilities (9) + +@@ -310,22 +310,22 @@ + self.show_all() + + def __commit_text_cb(self, context, text): +- print "commit-text:", text.text ++ print("commit-text:", text.text) + + def __update_preedit_text_cb(self, context, text, cursor_pos, visible): +- print "preedit-text:", text.text, cursor_pos, visible ++ print("preedit-text:", text.text, cursor_pos, visible) + + def __show_preedit_text_cb(self, context): +- print "show-preedit-text" ++ print("show-preedit-text") + + def __hide_preedit_text_cb(self, context): +- print "hide-preedit-text" ++ print("hide-preedit-text") + + def __update_auxiliary_text_cb(self, context, text, visible): +- print "auxiliary-text:", text.text, visible ++ print("auxiliary-text:", text.text, visible) + + def __update_lookup_table_cb(self, context, table, visible): +- print "update-lookup-table:", visible ++ print("update-lookup-table:", visible) + + def __key_press_event_cb(self, widget, event): + self.__context.process_key_event(event.keyval, event.state) +diff -urN ibus-1.5.8/ibus/interface/__init__.py ibus-1.5.8.py3/ibus/interface/__init__.py +--- ibus-1.5.8/ibus/interface/__init__.py 2014-07-24 12:24:25.000000000 +0800 ++++ ibus-1.5.8.py3/ibus/interface/__init__.py 2014-08-31 01:37:40.226988785 +0800 +@@ -20,10 +20,10 @@ + # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + # USA + +-from iibus import * +-from iinputcontext import * +-from iengine import * +-from ienginefactory import * +-from ipanel import * +-from iconfig import * +-from inotifications import * ++from ibus.interface.iibus import * ++from ibus.interface.iinputcontext import * ++from ibus.interface.iengine import * ++from ibus.interface.ienginefactory import * ++from ibus.interface.ipanel import * ++from ibus.interface.iconfig import * ++from ibus.interface.inotifications import * +diff -urN ibus-1.5.8/ibus/lang.py ibus-1.5.8.py3/ibus/lang.py +--- ibus-1.5.8/ibus/lang.py 2014-07-24 12:24:25.000000000 +0800 ++++ ibus-1.5.8.py3/ibus/lang.py 2014-08-31 01:37:40.228988760 +0800 +@@ -61,18 +61,18 @@ + + def __load_lang(): + import os +- import _config ++ from ibus import _config + iso_639_xml = os.path.join(_config.ISOCODES_PREFIX, "share/xml/iso-codes/iso_639.xml") + p = xml.parsers.expat.ParserCreate() + p.StartElementHandler = __start_element + p.EndElementHandler = __end_element + p.CharacterDataHandler = __char_data +- p.ParseFile(file(iso_639_xml)) ++ p.ParseFile(open(iso_639_xml,"rb")) + + __load_lang() + + if __name__ == "__main__": +- print get_language_name("mai") +- print get_language_name("zh") +- print get_language_name("ja") +- print get_language_name("ko") ++ print(get_language_name("mai")) ++ print(get_language_name("zh")) ++ print(get_language_name("ja")) ++ print(get_language_name("ko")) +diff -urN ibus-1.5.8/ibus/lookuptable.py ibus-1.5.8.py3/ibus/lookuptable.py +--- ibus-1.5.8/ibus/lookuptable.py 2014-07-24 12:24:25.000000000 +0800 ++++ ibus-1.5.8.py3/ibus/lookuptable.py 2014-08-31 01:37:40.231988723 +0800 +@@ -25,9 +25,9 @@ + ) + + import dbus +-from common import * +-from serializable import * +-from exception import * ++from ibus.common import * ++from ibus.serializable import * ++from ibus.exception import * + + class LookupTable(Serializable): + __gtype_name__ = "PYIBusLookupTable" +diff -urN ibus-1.5.8/ibus/observedpath.py ibus-1.5.8.py3/ibus/observedpath.py +--- ibus-1.5.8/ibus/observedpath.py 2014-07-24 12:24:25.000000000 +0800 ++++ ibus-1.5.8.py3/ibus/observedpath.py 2014-08-31 01:37:40.228988760 +0800 +@@ -25,8 +25,8 @@ + ) + + import dbus +-from exception import IBusException +-from serializable import * ++from ibus.exception import IBusException ++from ibus.serializable import * + + class ObservedPath(Serializable): + __gtype_name__ = "PYIBusObservedPath" +diff -urN ibus-1.5.8/ibus/panel.py ibus-1.5.8.py3/ibus/panel.py +--- ibus-1.5.8/ibus/panel.py 2014-07-24 12:24:25.000000000 +0800 ++++ ibus-1.5.8.py3/ibus/panel.py 2014-08-31 01:37:40.232988710 +0800 +@@ -33,9 +33,9 @@ + IBUS_SERVICE_PANEL = "org.freedesktop.IBus.Panel" + IBUS_PATH_PANEL = "/org/freedesktop/IBus/Panel" + +-from serializable import * +-from object import Object +-import interface ++from ibus.serializable import * ++from ibus.object import Object ++from ibus import interface + import dbus + + class PanelItem: +@@ -268,19 +268,19 @@ + self.__bus.request_name(IBUS_SERVICE_PANEL, 0) + + def focus_in(self, ic): +- print "focus-in:", ic ++ print("focus-in:", ic) + context = InputContext(self.__bus, ic) + info = context.get_factory_info() +- print "factory:", info.name ++ print("factory:", info.name) + + def focus_out(self, ic): +- print "focus-out:", ic ++ print("focus-out:", ic) + + def update_auxiliary_text(self, text, visible): +- print "update-auxiliary-text:", text.text ++ print("update-auxiliary-text:", text.text) + + def update_lookup_table(self, table, visible): +- print "update-lookup-table", table ++ print("update-lookup-table", table) + + panel = TestPanel() + gtk.main() +diff -urN ibus-1.5.8/ibus/property.py ibus-1.5.8.py3/ibus/property.py +--- ibus-1.5.8/ibus/property.py 2014-07-24 12:24:25.000000000 +0800 ++++ ibus-1.5.8.py3/ibus/property.py 2014-08-31 01:37:40.231988723 +0800 +@@ -34,8 +34,8 @@ + ) + + import dbus +-from text import Text +-from serializable import * ++from ibus.text import Text ++from ibus.serializable import * + + PROP_TYPE_NORMAL = 0 + PROP_TYPE_TOGGLE = 1 +@@ -239,7 +239,7 @@ + props.append(Property(u"d")) + value = serialize_object(props) + props = deserialize_object(value) +- print props ++ print(props) + + if __name__ == "__main__": + test() +diff -urN ibus-1.5.8/ibus/serializable.py ibus-1.5.8.py3/ibus/serializable.py +--- ibus-1.5.8/ibus/serializable.py 2014-07-24 12:24:25.000000000 +0800 ++++ ibus-1.5.8.py3/ibus/serializable.py 2014-08-31 01:37:40.232988710 +0800 +@@ -26,7 +26,7 @@ + "deserialize_object", + ) + +-from object import Object ++from ibus.object import Object + import dbus + import gobject + +diff -urN ibus-1.5.8/ibus/text.py ibus-1.5.8.py3/ibus/text.py +--- ibus-1.5.8/ibus/text.py 2014-07-24 12:24:25.000000000 +0800 ++++ ibus-1.5.8.py3/ibus/text.py 2014-08-31 01:37:40.226988785 +0800 +@@ -25,9 +25,9 @@ + ) + + import dbus +-from exception import IBusException +-from serializable import * +-from attribute import AttrList ++from ibus.exception import IBusException ++from ibus.serializable import * ++from ibus.attribute import AttrList + + class Text(Serializable): + __gtype_name__ = "PYIBusText" diff --git a/ibus.changes b/ibus.changes index 379b560..7d3b3f2 100644 --- a/ibus.changes +++ b/ibus.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Sat Aug 30 17:45:15 UTC 2014 - i@marguerite.su + +- Add patch: ibus-python3-migration.patch + * I didn't do the hard "port", just simple 2to3 tasks. + * it'll remove "blockage" or python3-ibus is totally unusable. + ------------------------------------------------------------------- Tue Aug 26 08:15:16 UTC 2014 - fcrozat@suse.com diff --git a/ibus.spec b/ibus.spec index 2655f53..2e6cb5f 100644 --- a/ibus.spec +++ b/ibus.spec @@ -59,6 +59,8 @@ Patch5: ibus-force-python3.patch # PATCH-FIX-UPSTREAM marguerite@opensuse.org # lower vala version Patch6: ibus-vala-0.18.patch +# PATCH-FIX-UPSTREAM marguerite@opensuse.org +Patch7: ibus-python3-migration.patch BuildRequires: dbus-1-glib-devel BuildRequires: dbus-1-python-devel >= 0.83.0 BuildRequires: dconf-devel >= 0.7.5 @@ -226,6 +228,7 @@ sed -i \ %if %{with_python3} %patch5 -p1 +%patch7 -p1 %endif cp -r %{SOURCE2} .