summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYixun Lan <dlan@gentoo.org>2020-06-03 17:43:22 +0800
committerYixun Lan <dlan@gentoo.org>2020-06-03 17:44:29 +0800
commitc660bd7a9c5cc8098122810e1f4faab8725d5f98 (patch)
treecf99d93c4f81838dff0b07253db50498b840ff31 /app-i18n
parentwww-client/vivaldi-snapshot: Old (diff)
downloadgentoo-c660bd7a9c5cc8098122810e1f4faab8725d5f98.tar.gz
gentoo-c660bd7a9c5cc8098122810e1f4faab8725d5f98.tar.bz2
gentoo-c660bd7a9c5cc8098122810e1f4faab8725d5f98.zip
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@gentoo.org>
Diffstat (limited to 'app-i18n')
-rw-r--r--app-i18n/ibus-pinyin/files/ibus-pinyin-1.5.0-python3.patch91
-rw-r--r--app-i18n/ibus-pinyin/ibus-pinyin-1.5.0-r4.ebuild51
2 files changed, 142 insertions, 0 deletions
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 000000000000..03988ee0ab7e
--- /dev/null
+++ b/app-i18n/ibus-pinyin/files/ibus-pinyin-1.5.0-python3.patch
@@ -0,0 +1,91 @@
+commit 616770084991de0f36bea7b5861ef1b1657c9a31
+Author: ZhaoQiang <zhaoqiang@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 000000000000..2ff6a6240e33
--- /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)
+}