commit:     c660bd7a9c5cc8098122810e1f4faab8725d5f98
Author:     Yixun Lan <dlan <AT> gentoo <DOT> org>
AuthorDate: Wed Jun  3 09:43:22 2020 +0000
Commit:     Yixun Lan <dlan <AT> gentoo <DOT> org>
CommitDate: Wed Jun  3 09:44:29 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c660bd7a

app-i18n/ibus-pinyin: enable python3 support

Closes: https://bugs.gentoo.org/695002
Package-Manager: Portage-2.3.100, Repoman-2.3.22
Signed-off-by: Yixun Lan <dlan <AT> gentoo.org>

 .../files/ibus-pinyin-1.5.0-python3.patch          | 91 ++++++++++++++++++++++
 app-i18n/ibus-pinyin/ibus-pinyin-1.5.0-r4.ebuild   | 51 ++++++++++++
 2 files changed, 142 insertions(+)

diff --git a/app-i18n/ibus-pinyin/files/ibus-pinyin-1.5.0-python3.patch 
b/app-i18n/ibus-pinyin/files/ibus-pinyin-1.5.0-python3.patch
new file mode 100644
index 00000000000..03988ee0ab7
--- /dev/null
+++ b/app-i18n/ibus-pinyin/files/ibus-pinyin-1.5.0-python3.patch
@@ -0,0 +1,91 @@
+commit 616770084991de0f36bea7b5861ef1b1657c9a31
+Author: ZhaoQiang <zhaoqi...@gnome.org>
+Date:   Mon Nov 19 19:35:10 2018 +0800
+
+    Update ibus-setup-pinyin.in: to avoid ibus-pinyin-setup crash in pure 
python3 env.
+
+diff --git a/configure.ac b/configure.ac
+index aa6242a..ca99a6f 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -82,6 +82,11 @@ AC_PATH_PROG(ENV_IBUS_TEST, env)
+ AC_SUBST(ENV_IBUS_TEST)
+ 
+ # check python
++AC_ARG_WITH(python,
++    AS_HELP_STRING([--with-python[=PATH]],
++        [Select python2 or python3]),
++    [PYTHON=$with_python], []
++)
+ AM_PATH_PYTHON([2.5])
+ 
+ # --enable-boost
+diff --git a/setup/ibus-setup-pinyin.in b/setup/ibus-setup-pinyin.in
+index 2566737..314072c 100644
+--- a/setup/ibus-setup-pinyin.in
++++ b/setup/ibus-setup-pinyin.in
+@@ -26,5 +26,5 @@ export IBUS_PREFIX=@prefix@
+ export IBUS_DATAROOTDIR=@datarootdir@
+ export IBUS_LOCALEDIR=@localedir@
+ cd @prefix@/share/ibus-pinyin/setup/
+-exec python main.py $@
++exec @PYTHON@ main.py $@
+ 
+diff --git a/setup/main.py b/setup/main.py
+index fb27103..2e4051a 100644
+--- a/setup/main.py
++++ b/setup/main.py
+@@ -20,15 +20,21 @@
+ # along with this program; if not, write to the Free Software
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ 
++from __future__ import print_function
++
+ import gettext
+ import locale
+ import os
+ import sys
+ 
++from gi import require_version as gi_require_version
++gi_require_version('GLib', '2.0')
++gi_require_version('Gtk', '3.0')
++gi_require_version('IBus', '1.0')
++
+ from gi.repository import GLib
+ from gi.repository import Gtk
+ from gi.repository import IBus
+-from xdg import BaseDirectory
+ 
+ import version
+ 
+@@ -250,8 +256,8 @@ class PreferencesDialog:
+ 
+         def __correct_pinyin_toggled_cb(widget):
+             val = widget.get_active()
+-            map(lambda w: self.__builder.get_object(w[0]).set_sensitive(val),
+-                self.__correct_pinyin_widgets)
++            for w in self.__correct_pinyin_widgets:
++                self.__builder.get_object(w[0]).set_sensitive(val)
+         self.__correct_pinyin.connect("toggled", __correct_pinyin_toggled_cb)
+ 
+         # init value
+@@ -300,8 +306,8 @@ class PreferencesDialog:
+ 
+         def __fuzzy_pinyin_toggled_cb(widget):
+             val = widget.get_active()
+-            map(lambda w: self.__builder.get_object(w[0]).set_sensitive(val),
+-                self.__fuzzy_pinyin_widgets)
++            for w in self.__fuzzy_pinyin_widgets:
++                self.__builder.get_object(w[0]).set_sensitive(val)
+         self.__fuzzy_pinyin.connect("toggled", __fuzzy_pinyin_toggled_cb)
+ 
+         # init value
+@@ -404,7 +410,7 @@ class PreferencesDialog:
+         elif isinstance(val, str):
+             var = GLib.Variant.new_string(val)
+         else:
+-            print >> sys.stderr, "val(%s) is not in support type." % repr(val)
++            print("val(%s) is not in support type." % repr(val), 
file=sys.stderr)
+             return
+ 
+         self.__values[name] = val

diff --git a/app-i18n/ibus-pinyin/ibus-pinyin-1.5.0-r4.ebuild 
b/app-i18n/ibus-pinyin/ibus-pinyin-1.5.0-r4.ebuild
new file mode 100644
index 00000000000..2ff6a6240e3
--- /dev/null
+++ b/app-i18n/ibus-pinyin/ibus-pinyin-1.5.0-r4.ebuild
@@ -0,0 +1,51 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+PYTHON_COMPAT=( python2_7 python3_{6,7,8})
+
+inherit autotools python-single-r1
+
+DESCRIPTION="Chinese Pinyin and Bopomofo engines for IBus"
+HOMEPAGE="https://github.com/ibus/ibus/wiki";
+SRC_URI="https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/ibus/${P}.tar.gz";
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="boost lua nls"
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+RDEPEND="${PYTHON_DEPS}
+       app-i18n/pyzy
+       dev-db/sqlite:3
+       $(python_gen_cond_dep '
+               app-i18n/ibus[python(+),${PYTHON_MULTI_USEDEP}]
+               dev-python/pygobject:3[${PYTHON_MULTI_USEDEP}]
+       ')
+       boost? ( dev-libs/boost )
+       lua? ( =dev-lang/lua-5.1*:= )
+       nls? ( virtual/libintl )"
+DEPEND="${RDEPEND}
+       dev-util/intltool
+       sys-devel/autoconf-archive
+       virtual/pkgconfig
+       nls? ( sys-devel/gettext )"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-boost.patch
+       "${FILESDIR}"/${P}-content-type-method.patch
+       "${FILESDIR}"/${P}-python3.patch
+)
+
+src_prepare() {
+       default
+       eautoreconf
+}
+
+src_configure() {
+       econf \
+               $(use_enable boost) \
+               $(use_enable lua lua-extension) \
+               $(use_enable nls)
+}

Reply via email to