diff --git a/ibus-530711-preload-sys.patch b/ibus-530711-preload-sys.patch index 12a523c..57eaced 100644 --- a/ibus-530711-preload-sys.patch +++ b/ibus-530711-preload-sys.patch @@ -63,7 +63,7 @@ diff --git a/setup/main.py b/setup/main.py index d3f4414..235ef9c 100644 --- a/setup/main.py +++ b/setup/main.py -@@ -187,16 +187,30 @@ class Setup(object): +@@ -190,16 +190,30 @@ class Setup(object): 'active', Gio.SettingsBindFlags.DEFAULT) @@ -98,18 +98,19 @@ index d3f4414..235ef9c 100644 self.__treeview = self.__builder.get_object("treeview_engines") self.__treeview.set_engines(engines) -@@ -246,8 +260,8 @@ class Setup(object): +@@ -249,8 +263,9 @@ class Setup(object): def __combobox_notify_active_engine_cb(self, combobox, property): engine = self.__combobox.get_active_engine() button = self.__builder.get_object("button_engine_add") - button.set_sensitive( - engine != None and engine not in self.__treeview.get_engines()) + button.set_sensitive(engine != None and \ -+ engine.get_name() not in map(lambda e: e.get_name(), self.__treeview.get_engines())) ++ engine.get_name() not in [e.get_name() for e \ ++ in self.__treeview.get_engines()]) def __get_engine_setup_exec_args(self, engine): args = [] -@@ -267,6 +281,13 @@ class Setup(object): +@@ -270,6 +285,13 @@ class Setup(object): args.append(path.basename(setup_path)) return args @@ -123,7 +124,7 @@ index d3f4414..235ef9c 100644 def __treeview_notify_cb(self, treeview, prop): if prop.name not in ("active-engine", "engines"): return -@@ -318,6 +339,43 @@ class Setup(object): +@@ -321,6 +343,43 @@ class Setup(object): del self.__engine_setup_exec_list[name] self.__engine_setup_exec_list[name] = os.spawnl(os.P_NOWAIT, *args) @@ -158,9 +159,9 @@ index d3f4414..235ef9c 100644 + engine_names = self.__settings_general.get_strv('preload-engines') + engines = self.__get_engine_descs_from_names(engine_names) + current_engines = self.__treeview.get_engines() -+ engines_csv = str.join(',', map(lambda e: e.get_name(), engines)) ++ engines_csv = str.join(',', [e.get_name() for e in engines]) + current_engines_csv = \ -+ str.join(',', map(lambda e: e.get_name(), current_engines)) ++ str.join(',', [e.get_name() for e in current_engines]) + if engines_csv != current_engines_csv: + self.__treeview.set_engines(engines) + diff --git a/ibus-HEAD.patch b/ibus-HEAD.patch index 8b13789..92c5a2b 100644 --- a/ibus-HEAD.patch +++ b/ibus-HEAD.patch @@ -1 +1,530 @@ +From e6ec45d64a32d16245770f8b80e795a63e6ad553 Mon Sep 17 00:00:00 2001 +From: Colin Walters +Date: Thu, 16 Jan 2014 13:22:12 +0900 +Subject: [PATCH] data/dconf: Don't run "dconf update" if $(DESTDIR) is set + +dconf changed as of +https://git.gnome.org/browse/dconf/commit/?id=c211fc46496597c7ddabd73d623bae4037754916 +to actually emit an error if /etc/dconf/db is empty. When building +ibus in a system such as dpkg/rpm or gnome-continuous, there may +actually be nothing in that directory in the buildroot. + +This will now cause "dconf update" as executed by this Makefile to +fail. The fix is to just check $(DESTDIR), like we should do for all +triggers (e.g. gtk-update-icon-cache too). It's never useful to +execute these from per-component Makefiles if $(DESTDIR) is set. + +Instead, these meta-build systems (dpkg/rpm/jhbuild/Continuous) all +take care of execution of triggers on their own. + +Review URL: https://codereview.appspot.com/51730044 +Patch from Colin Walters . +--- + data/dconf/Makefile.am | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/data/dconf/Makefile.am b/data/dconf/Makefile.am +index c841a34..62c20a3 100644 +--- a/data/dconf/Makefile.am ++++ b/data/dconf/Makefile.am +@@ -61,6 +61,8 @@ org.freedesktop.ibus.gschema.xml.in: $(top_srcdir)/data/ibus.schemas.in + { rc=$$?; $(RM) -rf $@; exit $$rc; } + + install-data-hook: +- dconf update ++ if test -z "$(DESTDIR)"; then \ ++ dconf update; \ ++ fi + + -include $(top_srcdir)/git.mk +-- +1.8.0 + +From 8468de2f165ca7dba45b13cec09fdcde83a88204 Mon Sep 17 00:00:00 2001 +From: fujiwarat +Date: Fri, 24 Jan 2014 11:11:40 +0900 +Subject: [PATCH 1/2] Enable python3 ibus-setup. + +The default uses 'python' and if the path of python 3 is 'python3', +./configure --with-python=python3 + +Review URL: https://codereview.appspot.com/54930043 +--- + configure.ac | 8 ++++++++ + setup/enginecombobox.py | 25 +++++++++++++++++-------- + setup/enginetreeview.py | 13 +++++++------ + setup/keyboardshortcut.py | 10 +++++----- + setup/main.py | 21 ++++++++++++--------- + 5 files changed, 49 insertions(+), 28 deletions(-) + +diff --git a/configure.ac b/configure.ac +index b7ef1eb..73d99ee 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -372,6 +372,13 @@ AM_CONDITIONAL([ENABLE_PYTHON_LIBRARY], [test x"$enable_python_library" = x"yes" + AM_CONDITIONAL([ENABLE_SETUP], [test x"$enable_setup" = x"yes"]) + AM_CONDITIONAL([ENABLE_DAEMON], [true]) + ++# Define python version ++AC_ARG_WITH(python, ++ AS_HELP_STRING([--with-python[=PATH]], ++ [Select python2 or python3]), ++ [PYTHON=$with_python], [] ++) ++ + AM_PATH_PYTHON([2.5]) + + PYGOBJECT_REQUIRED=3.0.0 +@@ -598,6 +605,7 @@ Build options: + Build shared libs $enable_shared + Build static libs $enable_static + CFLAGS $CFLAGS ++ python $PYTHON + Gtk2 immodule dir $GTK2_IM_MODULEDIR + Gtk3 immodule dir $GTK3_IM_MODULEDIR + Build gtk2 immodule $enable_gtk2 +diff --git a/setup/enginecombobox.py b/setup/enginecombobox.py +index b45ad56..2a2a677 100644 +--- a/setup/enginecombobox.py ++++ b/setup/enginecombobox.py +@@ -2,8 +2,8 @@ + # + # ibus - The Input Bus + # +-# Copyright (c) 2007-2010 Peng Huang +-# Copyright (c) 2007-2010 Red Hat, Inc. ++# Copyright (c) 2007-2014 Peng Huang ++# Copyright (c) 2007-2014 Red Hat, Inc. + # + # This library is free software; you can redistribute it and/or + # modify it under the terms of the GNU Lesser General Public +@@ -21,6 +21,8 @@ + # USA + + import locale ++import functools ++import sys + + from gi.repository import GObject + from gi.repository import Gtk +@@ -72,8 +74,8 @@ class EngineComboBox(Gtk.ComboBox): + langs[l] = [] + langs[l].append(e) + +- keys = langs.keys() +- keys.sort(locale.strcoll) ++ keys = list(langs.keys()) ++ keys.sort(key=functools.cmp_to_key(locale.strcoll)) + loc = locale.getlocale()[0] + # None on C locale + if loc == None: +@@ -95,7 +97,7 @@ class EngineComboBox(Gtk.ComboBox): + if a.get_rank() == b.get_rank(): + return locale.strcoll(a.get_longname(), b.get_longname()) + return int(b.get_rank() - a.get_rank()) +- langs[l].sort(cmp_engine) ++ langs[l].sort(key=functools.cmp_to_key(cmp_engine)) + for e in langs[l]: + iter2 = self.__model.append(iter1) + self.__model.set(iter2, 0, e) +@@ -106,7 +108,10 @@ class EngineComboBox(Gtk.ComboBox): + def __icon_cell_data_cb(self, celllayout, renderer, model, iter, data): + engine = self.__model.get_value(iter, 0) + +- if isinstance(engine, str) or isinstance (engine, unicode): ++ if isinstance(engine, str): ++ renderer.set_property("visible", False) ++ renderer.set_property("sensitive", False) ++ elif sys.version < '3' and isinstance (engine, unicode): + renderer.set_property("visible", False) + renderer.set_property("sensitive", False) + elif isinstance(engine, int): +@@ -121,7 +126,11 @@ class EngineComboBox(Gtk.ComboBox): + def __name_cell_data_cb(self, celllayout, renderer, model, iter, data): + engine = self.__model.get_value(iter, 0) + +- if isinstance (engine, str) or isinstance (engine, unicode): ++ if isinstance (engine, str): ++ renderer.set_property("sensitive", False) ++ renderer.set_property("text", engine) ++ renderer.set_property("weight", Pango.Weight.NORMAL) ++ elif sys.version < '3' and isinstance (engine, unicode): + renderer.set_property("sensitive", False) + renderer.set_property("text", engine) + renderer.set_property("weight", Pango.Weight.NORMAL) +@@ -146,7 +155,7 @@ class EngineComboBox(Gtk.ComboBox): + iter = self.get_active_iter() + return self.get_model()[iter][0] + else: +- raise AttributeError, 'unknown property %s' % property.name ++ raise AttributeError('unknown property %s' % property.name) + + def get_active_engine(self): + return self.get_property("active-engine") +diff --git a/setup/enginetreeview.py b/setup/enginetreeview.py +index f8ee092..b116c54 100644 +--- a/setup/enginetreeview.py ++++ b/setup/enginetreeview.py +@@ -2,8 +2,8 @@ + # + # ibus - The Input Bus + # +-# Copyright (c) 2007-2010 Peng Huang +-# Copyright (c) 2007-2010 Red Hat, Inc. ++# Copyright (c) 2007-2014 Peng Huang ++# Copyright (c) 2007-2014 Red Hat, Inc. + # + # This library is free software; you can redistribute it and/or + # modify it under the terms of the GNU Lesser General Public +@@ -108,7 +108,8 @@ class EngineTreeView(Gtk.TreeView): + language_b = IBus.get_language_name(engine_b.get_language()) + label_a = "%s - %s" % (language_a, engine_a.get_longname()) + label_b = "%s - %s" % (language_b, engine_b.get_longname()) +- return cmp(label_a, label_b) ++ # http://docs.python.org/3.0/whatsnew/3.0.html#ordering-comparisons ++ return (label_a > label_b) - (label_a < label_b) + + def __selection_changed_cb(self, *args): + self.notify("active-engine"); +@@ -173,15 +174,15 @@ class EngineTreeView(Gtk.TreeView): + engines = [ r[0] for r in self.__model if r[0] != None] + return engines + else: +- raise AttributeError, 'unknown property %s' % prop.name ++ raise AttributeError('unknown property %s' % prop.name) + + def do_set_property(self, prop, value): + if prop.name == "active-engine": +- raise AttributeError, "active-engine is readonly" ++ raise AttributeError("active-engine is readonly") + elif prop.name == "engines": + set_engines(value) + else: +- raise AttributeError, 'unknown property %s' % prop.name ++ raise AttributeError('unknown property %s' % prop.name) + + def set_engines(self, engines): + self.__model.clear() +diff --git a/setup/keyboardshortcut.py b/setup/keyboardshortcut.py +index 1a88525..26bd77f 100644 +--- a/setup/keyboardshortcut.py ++++ b/setup/keyboardshortcut.py +@@ -2,8 +2,8 @@ + # + # ibus - The Input Bus + # +-# Copyright (c) 2007-2010 Peng Huang +-# Copyright (c) 2007-2010 Red Hat, Inc. ++# Copyright (c) 2007-2014 Peng Huang ++# Copyright (c) 2007-2014 Red Hat, Inc. + # + # This library is free software; you can redistribute it and/or + # modify it under the terms of the GNU Lesser General Public +@@ -182,7 +182,7 @@ class KeyboardShortcutSelection(Gtk.VBox): + modifiers.append(name) + if keycode.startswith("_"): + keycode = keycode[1:] +- shortcut = "".join(map(lambda m: '<' + m + '>', modifiers)) ++ shortcut = "".join(['<' + m + '>' for m in modifiers]) + shortcut += keycode + return shortcut + +@@ -335,6 +335,6 @@ if __name__ == "__main__": + Gtk.STOCK_OK, Gtk.ResponseType.OK)) + dlg.add_shortcut("Control+Shift+space") + dlg.set_shortcuts(None) +- print dlg.run() +- print dlg.get_shortcuts() ++ print((dlg.run())) ++ print((dlg.get_shortcuts())) + +diff --git a/setup/main.py b/setup/main.py +index d3f4414..cac10de 100644 +--- a/setup/main.py ++++ b/setup/main.py +@@ -2,8 +2,8 @@ + # + # ibus - The Input Bus + # +-# Copyright (c) 2007-2010 Peng Huang +-# Copyright (c) 2007-2010 Red Hat, Inc. ++# Copyright (c) 2007-2014 Peng Huang ++# Copyright (c) 2007-2014 Red Hat, Inc. + # + # This library is free software; you can redistribute it and/or + # modify it under the terms of the GNU Lesser General Public +@@ -20,6 +20,9 @@ + # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + # USA + ++# for python2 ++from __future__ import print_function ++ + import os + import signal + import sys +@@ -45,7 +48,7 @@ from i18n import DOMAINNAME, _, N_, init as i18n_init + COLUMN_VISIBLE, + COLUMN_ICON, + COLUMN_DATA, +-) = range(6) ++) = list(range(6)) + + ( + DATA_NAME, +@@ -57,7 +60,7 @@ from i18n import DOMAINNAME, _, N_, init as i18n_init + DATA_EXEC, + DATA_STARTED, + DATA_PRELOAD +-) = range(9) ++) = list(range(9)) + + class Setup(object): + def __flush_gtk_events(self): +@@ -286,7 +289,7 @@ class Setup(object): + obj.set_sensitive(False) + + if prop.name == "engines": +- engine_names = map(lambda e: e.get_name(), engines) ++ engine_names = [e.get_name() for e in engines] + self.__settings_general.set_strv('preload-engines', engine_names) + + def __button_engine_add_cb(self, button): +@@ -306,7 +309,7 @@ class Setup(object): + if len(args) == 0: + return + name = engine.get_name() +- if name in self.__engine_setup_exec_list.keys(): ++ if name in list(self.__engine_setup_exec_list.keys()): + try: + wpid, sts = os.waitpid(self.__engine_setup_exec_list[name], + os.WNOHANG) +@@ -402,7 +405,7 @@ class Setup(object): + if data[DATA_STARTED] == False: + try: + self.__bus.register_start_engine(data[DATA_LANG], data[DATA_NAME]) +- except Exception, e: ++ except Exception as e: + dlg = Gtk.MessageDialog(type = Gtk.MessageType.ERROR, + buttons = Gtk.ButtonsType.CLOSE, + message_format = str(e)) +@@ -413,7 +416,7 @@ class Setup(object): + else: + try: + self.__bus.register_stop_engine(data[DATA_LANG], data[DATA_NAME]) +- except Exception, e: ++ except Exception as e: + dlg = Gtk.MessageDialog(type = Gtk.MessageType.ERROR, + buttons = Gtk.ButtonsType.CLOSE, + message_format = str(e)) +@@ -492,7 +495,7 @@ if __name__ == "__main__": + try: + locale.setlocale(locale.LC_ALL, '') + except locale.Error: +- print >> sys.stderr, "Using the fallback 'C' locale" ++ print("Using the fallback 'C' locale", file=sys.stderr) + locale.setlocale(locale.LC_ALL, 'C') + + i18n_init() +-- +1.8.0 + +From e2cd8f0870d8b15af71e839f9035dce333af3c4e Mon Sep 17 00:00:00 2001 +From: fujiwarat +Date: Mon, 27 Jan 2014 11:38:46 +0900 +Subject: [PATCH 2/2] Install IBus.py in python2 gi.override. + +Review URL: https://codereview.appspot.com/56510043 +--- + bindings/pygobject/Makefile.am | 5 +++++ + configure.ac | 13 ++++++++++--- + 2 files changed, 15 insertions(+), 3 deletions(-) + +diff --git a/bindings/pygobject/Makefile.am b/bindings/pygobject/Makefile.am +index fc23209..d257b04 100644 +--- a/bindings/pygobject/Makefile.am ++++ b/bindings/pygobject/Makefile.am +@@ -22,6 +22,11 @@ + + NULL = + ++overrides2dir = $(py2overridesdir) ++overrides2_DATA = \ ++ gi/overrides/IBus.py \ ++ $(NULL) ++ + overridesdir = $(pyoverridesdir) + overrides_PYTHON = \ + gi/overrides/IBus.py \ +diff --git a/configure.ac b/configure.ac +index 73d99ee..43071bc 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -380,6 +380,7 @@ AC_ARG_WITH(python, + ) + + AM_PATH_PYTHON([2.5]) ++AC_PATH_PROG(PYTHON2, python2) + + PYGOBJECT_REQUIRED=3.0.0 + +@@ -387,10 +388,16 @@ PKG_CHECK_EXISTS([pygobject-3.0 >= $PYGOBJECT_REQUIRED], + [enable_pygobject=yes], [enable_pygobject=no]) + + if test "x$enable_pygobject" = "xyes"; then +- PKG_CHECK_MODULES(PYTHON, [pygobject-3.0 >= $PYGOBJECT_REQUIRED]) ++ PKG_CHECK_MODULES(PYTHON, [pygobject-3.0 >= $PYGOBJECT_REQUIRED]) + +- pyoverridesdir=`$PYTHON -c "import gi; print(gi._overridesdir)"` +- AC_SUBST(pyoverridesdir) ++ pyoverridesdir=`$PYTHON -c "import gi; print(gi._overridesdir)"` ++ AC_SUBST(pyoverridesdir) ++ ++ py2overridesdir="$pyoverridesdir" ++ if test x"$PYTHON2" != x""; then ++ py2overridesdir=`$PYTHON2 -c "import gi; print(gi._overridesdir)"` ++ fi ++ AC_SUBST(py2overridesdir) + fi + + AM_CONDITIONAL(ENABLE_PYGOBJECT, test x"$enable_pygobject" = "xyes") +-- +1.8.0 + +From 256e207d9574838c9ed5f9400eddc5ff2cbbec59 Mon Sep 17 00:00:00 2001 +From: fujiwarat +Date: Fri, 31 Jan 2014 16:10:07 +0900 +Subject: [PATCH] Install pygtk2 libraries to python2 site-packages. + +--- + bindings/pygobject/Makefile.am | 11 +++++++++++ + configure.ac | 19 ++++++++++++++----- + ibus/Makefile.am | 4 +++- + ibus/interface/Makefile.am | 4 +++- + 4 files changed, 31 insertions(+), 7 deletions(-) + +diff --git a/bindings/pygobject/Makefile.am b/bindings/pygobject/Makefile.am +index d257b04..aa4c330 100644 +--- a/bindings/pygobject/Makefile.am ++++ b/bindings/pygobject/Makefile.am +@@ -22,6 +22,7 @@ + + NULL = + ++am__py2_compile = PYTHON=$(PYTHON2) $(SHELL) $(py_compile) + overrides2dir = $(py2overridesdir) + overrides2_DATA = \ + gi/overrides/IBus.py \ +@@ -52,4 +53,14 @@ EXTRA_DIST = \ + test-override-ibus.py \ + $(NULL) + ++install-data-hook: ++ for data in $(overrides2_DATA); do \ ++ file=`echo $$data | sed -e 's|^.*/||'`; \ ++ dlist="$$dlist $$file"; \ ++ done; \ ++ $(am__py2_compile) --destdir "$(DESTDIR)" \ ++ --basedir "$(overrides2dir)" \ ++ $$dlist ++ $(NULL) ++ + -include $(top_srcdir)/git.mk +diff --git a/configure.ac b/configure.ac +index 43071bc..03e4725 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -382,6 +382,10 @@ AC_ARG_WITH(python, + AM_PATH_PYTHON([2.5]) + AC_PATH_PROG(PYTHON2, python2) + ++if test x"$PYTHON2" = x""; then ++ PYTHON2=$PYTHON ++fi ++ + PYGOBJECT_REQUIRED=3.0.0 + + PKG_CHECK_EXISTS([pygobject-3.0 >= $PYGOBJECT_REQUIRED], +@@ -393,10 +397,7 @@ if test "x$enable_pygobject" = "xyes"; then + pyoverridesdir=`$PYTHON -c "import gi; print(gi._overridesdir)"` + AC_SUBST(pyoverridesdir) + +- py2overridesdir="$pyoverridesdir" +- if test x"$PYTHON2" != x""; then +- py2overridesdir=`$PYTHON2 -c "import gi; print(gi._overridesdir)"` +- fi ++ py2overridesdir=`$PYTHON2 -c "import gi; print(gi._overridesdir)"` + AC_SUBST(py2overridesdir) + fi + +@@ -419,6 +420,13 @@ if test x"$enable_python_library" = x"yes"; then + AC_SUBST(PYTHON_CFLAGS) + AC_SUBST(PYTHON_INCLUDES) + AC_SUBST(PYTHON_LIBS) ++ ++ PYTHON2_PREFIX=`$PYTHON2 -c "import sys; sys.stdout.write(sys.prefix)"` ++ PYTHON2_VERSION=`$PYTHON2 -c "import sys; sys.stdout.write(sys.version[[:3]])"` ++ PYTHON2_LIBDIR="$PYTHON2_PREFIX/lib/python$PYTHON2_VERSION" ++ python2dir="$PYTHON2_LIBDIR/site-packages" ++ pkgpython2dir="$python2dir/ibus" ++ AC_SUBST(pkgpython2dir) + else + enable_python_library="no (disabled, use --enable-python-library to enable)" + fi +@@ -612,7 +620,8 @@ Build options: + Build shared libs $enable_shared + Build static libs $enable_static + CFLAGS $CFLAGS +- python $PYTHON ++ PYTHON $PYTHON ++ PYTHON2 $PYTHON2 + Gtk2 immodule dir $GTK2_IM_MODULEDIR + Gtk3 immodule dir $GTK3_IM_MODULEDIR + Build gtk2 immodule $enable_gtk2 +diff --git a/ibus/Makefile.am b/ibus/Makefile.am +index f120de1..0edabed 100644 +--- a/ibus/Makefile.am ++++ b/ibus/Makefile.am +@@ -23,6 +23,8 @@ SUBDIRS = \ + interface \ + $(NULL) + ++PYTHON = $(PYTHON2) ++ + ibus_PYTHON = \ + ascii.py \ + application.py \ +@@ -56,7 +58,7 @@ nodist_ibus_PYTHON = \ + _config.py \ + $(NULL) + +-ibusdir = @pkgpythondir@ ++ibusdir = @pkgpython2dir@ + + EXTRA_DIST = \ + _config.py.in \ +diff --git a/ibus/interface/Makefile.am b/ibus/interface/Makefile.am +index 6ce510b..de83c77 100644 +--- a/ibus/interface/Makefile.am ++++ b/ibus/interface/Makefile.am +@@ -20,6 +20,8 @@ + # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + # USA + ++PYTHON = $(PYTHON2) ++ + ibus_interface_PYTHON = \ + iconfig.py \ + ienginefactory.py \ +@@ -31,7 +33,7 @@ ibus_interface_PYTHON = \ + __init__.py \ + $(NULL) + +-ibus_interfacedir = @pkgpythondir@/interface ++ibus_interfacedir = @pkgpython2dir@/interface + + CLEANFILES = \ + *.pyc \ +-- +1.8.0 diff --git a/ibus-xx-setup-frequent-lang.patch b/ibus-xx-setup-frequent-lang.patch index 2724b8c..caaccdd 100644 --- a/ibus-xx-setup-frequent-lang.patch +++ b/ibus-xx-setup-frequent-lang.patch @@ -192,15 +192,15 @@ diff --git a/setup/enginecombobox.py b/setup/enginecombobox.py index b45ad56..830f0e8 100644 --- a/setup/enginecombobox.py +++ b/setup/enginecombobox.py -@@ -22,6 +22,7 @@ - - import locale +@@ -24,6 +24,7 @@ import locale + import functools + import sys +from gi.repository import Gio from gi.repository import GObject from gi.repository import Gtk from gi.repository import IBus -@@ -45,6 +46,10 @@ class EngineComboBox(Gtk.ComboBox): +@@ -47,6 +48,10 @@ class EngineComboBox(Gtk.ComboBox): self.connect("notify::active", self.__notify_active_cb) self.__model = None @@ -211,12 +211,23 @@ index b45ad56..830f0e8 100644 renderer = Gtk.CellRendererPixbuf() renderer.set_property("xalign", 0) -@@ -58,20 +63,45 @@ class EngineComboBox(Gtk.ComboBox): +@@ -60,20 +65,45 @@ class EngineComboBox(Gtk.ComboBox): self.pack_start(renderer, True) self.set_cell_data_func(renderer, self.__name_cell_data_cb, None) - def set_engines(self, engines): - self.__model = Gtk.TreeStore(object) +- +- iter1 = self.__model.append(None) +- self.__model.set(iter1, 0, 0) +- langs = {} +- for e in engines: +- l = IBus.get_language_name(e.get_language()) +- if l == None: +- l = "" +- if l not in langs: +- langs[l] = [] +- langs[l].append(e) + def __gconf_get_lang_list_from_locale(self): + common_list = ['en', 'Other'] + loc = None @@ -245,17 +256,7 @@ index b45ad56..830f0e8 100644 + if lang_list == None: + return [loc] + common_list + return lang_list + common_list - -- iter1 = self.__model.append(None) -- self.__model.set(iter1, 0, 0) -- langs = {} -- for e in engines: -- l = IBus.get_language_name(e.get_language()) -- if l == None: -- l = "" -- if l not in langs: -- langs[l] = [] -- langs[l].append(e) ++ + def __has_engine_in_lang_list(self, engine, lang_list): + retval = False + for lang in lang_list: @@ -266,10 +267,10 @@ index b45ad56..830f0e8 100644 + return retval + def __model_append_langs(self, model, langs, visible): - keys = langs.keys() - keys.sort(locale.strcoll) + keys = list(langs.keys()) + keys.sort(key=functools.cmp_to_key(locale.strcoll)) loc = locale.getlocale()[0] -@@ -89,29 +119,86 @@ class EngineComboBox(Gtk.ComboBox): +@@ -91,22 +121,62 @@ class EngineComboBox(Gtk.ComboBox): keys.remove(IBus.get_language_name("Other")) keys += [IBus.get_language_name("Other")] for l in keys: @@ -281,7 +282,7 @@ index b45ad56..830f0e8 100644 if a.get_rank() == b.get_rank(): return locale.strcoll(a.get_longname(), b.get_longname()) return int(b.get_rank() - a.get_rank()) - langs[l].sort(cmp_engine) + langs[l].sort(key=functools.cmp_to_key(cmp_engine)) for e in langs[l]: - iter2 = self.__model.append(iter1) - self.__model.set(iter2, 0, e) @@ -336,7 +337,9 @@ index b45ad56..830f0e8 100644 + model = self.get_model() + engine = model.get_value(iter, 0) - if isinstance(engine, str) or isinstance (engine, unicode): + if isinstance(engine, str): + renderer.set_property("visible", False) +@@ -115,8 +185,25 @@ class EngineComboBox(Gtk.ComboBox): renderer.set_property("visible", False) renderer.set_property("sensitive", False) elif isinstance(engine, int): @@ -364,7 +367,7 @@ index b45ad56..830f0e8 100644 else: renderer.set_property("visible", True) renderer.set_property("sensitive", True) -@@ -119,7 +206,8 @@ class EngineComboBox(Gtk.ComboBox): +@@ -124,7 +211,8 @@ class EngineComboBox(Gtk.ComboBox): renderer.set_property("pixbuf", pixbuf) def __name_cell_data_cb(self, celllayout, renderer, model, iter, data): @@ -372,9 +375,9 @@ index b45ad56..830f0e8 100644 + model = self.get_model() + engine = model.get_value(iter, 0) - if isinstance (engine, str) or isinstance (engine, unicode): + if isinstance (engine, str): renderer.set_property("sensitive", False) -@@ -127,8 +215,15 @@ class EngineComboBox(Gtk.ComboBox): +@@ -136,8 +224,15 @@ class EngineComboBox(Gtk.ComboBox): renderer.set_property("weight", Pango.Weight.NORMAL) elif isinstance(engine, int): renderer.set_property("sensitive", True) @@ -392,7 +395,7 @@ index b45ad56..830f0e8 100644 else: renderer.set_property("sensitive", True) renderer.set_property("text", engine.get_longname()) -@@ -144,7 +239,12 @@ class EngineComboBox(Gtk.ComboBox): +@@ -153,7 +248,12 @@ class EngineComboBox(Gtk.ComboBox): if i == 0 or i == -1: return None iter = self.get_active_iter() @@ -404,7 +407,7 @@ index b45ad56..830f0e8 100644 + return None + return model[iter][0] else: - raise AttributeError, 'unknown property %s' % property.name + raise AttributeError('unknown property %s' % property.name) -- 1.8.0 diff --git a/ibus.spec b/ibus.spec index 3708fa6..2122939 100644 --- a/ibus.spec +++ b/ibus.spec @@ -4,18 +4,18 @@ %global with_pkg_config %(pkg-config --version >/dev/null 2>&1 && echo -n "1" || echo -n "0") -%if (0%{?fedora} > 18 || 0%{?rhel} > 6) -%global with_python_pkg 1 -%else -%global with_python_pkg 0 -%endif - %if (0%{?fedora} > 19 || 0%{?rhel} > 7) %global with_wayland 1 %else %global with_wayland 0 %endif +%if (0%{?fedora} > 20 || 0%{?rhel} > 7) +%global with_python2_override_pkg 1 +%else +%global with_python2_override_pkg 0 +%endif + %global ibus_api_version 1.0 %global ibus_xkb_version 1.5.0.20140114 @@ -33,7 +33,7 @@ Name: ibus Version: 1.5.5 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Intelligent Input Bus for Linux OS License: LGPLv2+ Group: System Environment/Libraries @@ -45,7 +45,8 @@ Source2: %{name}.conf.5 # Renamed %%{ibus_xkb_version}.tar.gz to ibus-xkb-%%{ibus_xkb_version}.tar.gz Source3: https://github.com/ibus/ibus-xkb/archive/ibus-xkb-%{ibus_xkb_version}.tar.gz # Upstreamed patches. -# Patch0: %%{name}-HEAD.patch +# Patch0: %%{name}-HEAD.patch +Patch0: %{name}-HEAD.patch # https://bugzilla.redhat.com/show_bug.cgi?id=810211 Patch1: %{name}-810211-no-switch-by-no-trigger.patch # https://bugzilla.redhat.com/show_bug.cgi?id=541492 @@ -73,6 +74,8 @@ BuildRequires: desktop-file-utils BuildRequires: gtk-doc BuildRequires: dconf-devel BuildRequires: dbus-x11 +BuildRequires: python3-devel +BuildRequires: python3-gobject BuildRequires: python2-devel BuildRequires: vala BuildRequires: vala-devel @@ -89,9 +92,7 @@ BuildRequires: libwayland-client-devel Requires: %{name}-libs%{?_isa} = %{version}-%{release} Requires: %{name}-gtk2%{?_isa} = %{version}-%{release} Requires: %{name}-gtk3%{?_isa} = %{version}-%{release} -%if %with_python_pkg Requires: %{name}-setup = %{version}-%{release} -%endif %if %with_wayland Requires: %{name}-wayland%{?_isa} = %{version}-%{release} %endif @@ -101,20 +102,18 @@ Requires: dbus-python >= %{dbus_python_version} Requires: dbus-x11 Requires: dconf Requires: librsvg2 +%if ! %with_python2_override_pkg +# Owner of %%python2_sitearch/gi/overrides +Requires: pygobject3-base +%endif +# Owner of %%python3_sitearch/gi/overrides +Requires: python3-gobject +# Owner of %%{_sysconfdir}/X11/xinit +Requires: xorg-x11-xinit # for setxkbmap Requires: xorg-x11-xkb-utils # The feature in ibus-gnome3 is provided by gnome-shell. Obsoletes: ibus-gnome3 < %{version}-%{release} -%if ! %with_python_pkg -%if %with_pygobject3 -Requires: pygobject3 -BuildRequires: gobject-introspection-devel -BuildRequires: pygobject3-devel -%endif -%if %with_pygobject2 -Requires: pygtk2 -%endif -%endif Requires(post): desktop-file-utils Requires(postun): desktop-file-utils @@ -133,8 +132,10 @@ IBus means Intelligent Input Bus. It is an input framework for Linux OS. Summary: IBus libraries Group: System Environment/Libraries -Requires: glib2 >= %{glib_ver} Requires: dbus >= 1.2.4 +Requires: glib2 >= %{glib_ver} +# Owner of %%{_libdir}/girepository-1.0 +Requires: gobject-introspection %description libs This package contains the libraries for IBus @@ -162,13 +163,13 @@ Requires(post): glib2 >= %{glib_ver} %description gtk3 This package contains ibus im module for gtk3 -%if %with_python_pkg %if %with_pygobject3 %package setup Summary: IBus setup utility Group: System Environment/Libraries Requires: %{name} = %{version}-%{release} -Requires: pygobject3 +Requires: python3 +Requires: python3-gobject BuildRequires: gobject-introspection-devel BuildRequires: pygobject3-devel BuildArch: noarch @@ -189,6 +190,18 @@ BuildArch: noarch This is a pygtk2 library for IBus. Now major IBus engines use pygobject3 and this package will be deprecated. %endif + +%if %with_python2_override_pkg +%package py2override +Summary: IBus python2 override library +Group: System Environment/Libraries +Requires: %{name}-libs%{?_isa} = %{version}-%{release} +# Owner of %%python2_sitearch/gi/overrides +Requires: pygobject3-base + +%description py2override +This is a python2 override library for IBus. The python files override +some functions in gobject-introspection. %endif %if %with_wayland @@ -207,8 +220,12 @@ Summary: Development tools for ibus Group: Development/Libraries Requires: %{name}%{?_isa} = %{version}-%{release} Requires: %{name}-libs%{?_isa} = %{version}-%{release} -Requires: glib2-devel Requires: dbus-devel +Requires: glib2-devel +# Owner of %%{_datadir}/gir-1.0 +Requires: gobject-introspection-devel +# Owner of %%{_datadir}/vala/vapi +Requires: vala %description devel The ibus-devel package contains the header files and developer @@ -223,6 +240,8 @@ BuildArch: noarch %else Requires: %{name}%{?_isa} = %{version}-%{release} %endif +# Owner of %%{_datadir}/gtk-doc/html +Requires: gtk-doc %description devel-docs The ibus-devel-docs package contains developer documentation for ibus @@ -231,6 +250,7 @@ The ibus-devel-docs package contains developer documentation for ibus %prep %setup -q # %%patch0 -p1 +%patch0 -p1 %if (0%{?fedora} < 20 && 0%{?rhel} < 8) %patch96 -p1 -b .passwd %endif @@ -269,6 +289,7 @@ autoreconf -f -i -v --enable-gtk-doc \ --with-no-snooper-apps='gnome-do,Do.*,firefox.*,.*chrome.*,.*chromium.*' \ --enable-surrounding-text \ + --with-python=python3 \ %if %with_pygobject2 --enable-python-library \ %endif @@ -390,20 +411,16 @@ fi %{_libexecdir}/ibus-x11 %{_sysconfdir}/dconf/db/ibus.d %{_sysconfdir}/dconf/profile/ibus +%python3_sitearch/gi/overrides/__pycache__ +%python3_sitearch/gi/overrides/IBus.py +%if ! %with_python2_override_pkg %python2_sitearch/gi/overrides/IBus.py* +%endif +# ibus owns xinput.d because gnome does not like to depend on imsettings. +%dir %{_sysconfdir}/X11/xinit/xinput.d +# Do not use %%config(noreplace) to always get the new keywords in _xinputconf +# For user customization, $HOME/.xinputrc can be used instead. %config %{_xinputconf} -%if ! %with_python_pkg -%if %with_pygobject3 -%{_bindir}/ibus-setup -%{_datadir}/applications/ibus-setup.desktop -%{_datadir}/ibus/setup -%{_datadir}/man/man1/ibus-setup.1.gz -%endif -%if %with_pygobject2 -%dir %{python2_sitelib}/ibus -%{python2_sitelib}/ibus/* -%endif -%endif %files libs %{_libdir}/libibus-%{ibus_api_version}.so.* @@ -415,7 +432,6 @@ fi %files gtk3 %{_libdir}/gtk-3.0/%{gtk3_binary_version}/immodules/im-ibus.so -%if %with_python_pkg %if %with_pygobject3 %files setup %{_bindir}/ibus-setup @@ -429,6 +445,10 @@ fi %dir %{python2_sitelib}/ibus %{python2_sitelib}/ibus/* %endif + +%if %with_python2_override_pkg +%files py2override +%python2_sitearch/gi/overrides/IBus.py* %endif %if %with_wayland @@ -448,6 +468,9 @@ fi %{_datadir}/gtk-doc/html/* %changelog +* Fri Jan 31 2014 Takao Fujiwara - 1.5.5-2 +- Enabled python3 ibus-setup + * Tue Jan 14 2014 Takao Fujiwara - 1.5.5-1 - Bumped to 1.5.5 - Deleted notify-python in Requires