Gentoo Archives: gentoo-commits

From: Yixun Lan <dlan@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-i18n/ibus-pinyin/, app-i18n/ibus-pinyin/files/
Date: Wed, 03 Jun 2020 09:45:16
Message-Id: 1591177469.c660bd7a9c5cc8098122810e1f4faab8725d5f98.dlan@gentoo
1 commit: c660bd7a9c5cc8098122810e1f4faab8725d5f98
2 Author: Yixun Lan <dlan <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jun 3 09:43:22 2020 +0000
4 Commit: Yixun Lan <dlan <AT> gentoo <DOT> org>
5 CommitDate: Wed Jun 3 09:44:29 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c660bd7a
7
8 app-i18n/ibus-pinyin: enable python3 support
9
10 Closes: https://bugs.gentoo.org/695002
11 Package-Manager: Portage-2.3.100, Repoman-2.3.22
12 Signed-off-by: Yixun Lan <dlan <AT> gentoo.org>
13
14 .../files/ibus-pinyin-1.5.0-python3.patch | 91 ++++++++++++++++++++++
15 app-i18n/ibus-pinyin/ibus-pinyin-1.5.0-r4.ebuild | 51 ++++++++++++
16 2 files changed, 142 insertions(+)
17
18 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
19 new file mode 100644
20 index 00000000000..03988ee0ab7
21 --- /dev/null
22 +++ b/app-i18n/ibus-pinyin/files/ibus-pinyin-1.5.0-python3.patch
23 @@ -0,0 +1,91 @@
24 +commit 616770084991de0f36bea7b5861ef1b1657c9a31
25 +Author: ZhaoQiang <zhaoqiang@×××××.org>
26 +Date: Mon Nov 19 19:35:10 2018 +0800
27 +
28 + Update ibus-setup-pinyin.in: to avoid ibus-pinyin-setup crash in pure python3 env.
29 +
30 +diff --git a/configure.ac b/configure.ac
31 +index aa6242a..ca99a6f 100644
32 +--- a/configure.ac
33 ++++ b/configure.ac
34 +@@ -82,6 +82,11 @@ AC_PATH_PROG(ENV_IBUS_TEST, env)
35 + AC_SUBST(ENV_IBUS_TEST)
36 +
37 + # check python
38 ++AC_ARG_WITH(python,
39 ++ AS_HELP_STRING([--with-python[=PATH]],
40 ++ [Select python2 or python3]),
41 ++ [PYTHON=$with_python], []
42 ++)
43 + AM_PATH_PYTHON([2.5])
44 +
45 + # --enable-boost
46 +diff --git a/setup/ibus-setup-pinyin.in b/setup/ibus-setup-pinyin.in
47 +index 2566737..314072c 100644
48 +--- a/setup/ibus-setup-pinyin.in
49 ++++ b/setup/ibus-setup-pinyin.in
50 +@@ -26,5 +26,5 @@ export IBUS_PREFIX=@prefix@
51 + export IBUS_DATAROOTDIR=@datarootdir@
52 + export IBUS_LOCALEDIR=@localedir@
53 + cd @prefix@/share/ibus-pinyin/setup/
54 +-exec python main.py $@
55 ++exec @PYTHON@ main.py $@
56 +
57 +diff --git a/setup/main.py b/setup/main.py
58 +index fb27103..2e4051a 100644
59 +--- a/setup/main.py
60 ++++ b/setup/main.py
61 +@@ -20,15 +20,21 @@
62 + # along with this program; if not, write to the Free Software
63 + # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
64 +
65 ++from __future__ import print_function
66 ++
67 + import gettext
68 + import locale
69 + import os
70 + import sys
71 +
72 ++from gi import require_version as gi_require_version
73 ++gi_require_version('GLib', '2.0')
74 ++gi_require_version('Gtk', '3.0')
75 ++gi_require_version('IBus', '1.0')
76 ++
77 + from gi.repository import GLib
78 + from gi.repository import Gtk
79 + from gi.repository import IBus
80 +-from xdg import BaseDirectory
81 +
82 + import version
83 +
84 +@@ -250,8 +256,8 @@ class PreferencesDialog:
85 +
86 + def __correct_pinyin_toggled_cb(widget):
87 + val = widget.get_active()
88 +- map(lambda w: self.__builder.get_object(w[0]).set_sensitive(val),
89 +- self.__correct_pinyin_widgets)
90 ++ for w in self.__correct_pinyin_widgets:
91 ++ self.__builder.get_object(w[0]).set_sensitive(val)
92 + self.__correct_pinyin.connect("toggled", __correct_pinyin_toggled_cb)
93 +
94 + # init value
95 +@@ -300,8 +306,8 @@ class PreferencesDialog:
96 +
97 + def __fuzzy_pinyin_toggled_cb(widget):
98 + val = widget.get_active()
99 +- map(lambda w: self.__builder.get_object(w[0]).set_sensitive(val),
100 +- self.__fuzzy_pinyin_widgets)
101 ++ for w in self.__fuzzy_pinyin_widgets:
102 ++ self.__builder.get_object(w[0]).set_sensitive(val)
103 + self.__fuzzy_pinyin.connect("toggled", __fuzzy_pinyin_toggled_cb)
104 +
105 + # init value
106 +@@ -404,7 +410,7 @@ class PreferencesDialog:
107 + elif isinstance(val, str):
108 + var = GLib.Variant.new_string(val)
109 + else:
110 +- print >> sys.stderr, "val(%s) is not in support type." % repr(val)
111 ++ print("val(%s) is not in support type." % repr(val), file=sys.stderr)
112 + return
113 +
114 + self.__values[name] = val
115
116 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
117 new file mode 100644
118 index 00000000000..2ff6a6240e3
119 --- /dev/null
120 +++ b/app-i18n/ibus-pinyin/ibus-pinyin-1.5.0-r4.ebuild
121 @@ -0,0 +1,51 @@
122 +# Copyright 1999-2020 Gentoo Authors
123 +# Distributed under the terms of the GNU General Public License v2
124 +
125 +EAPI=7
126 +PYTHON_COMPAT=( python2_7 python3_{6,7,8})
127 +
128 +inherit autotools python-single-r1
129 +
130 +DESCRIPTION="Chinese Pinyin and Bopomofo engines for IBus"
131 +HOMEPAGE="https://github.com/ibus/ibus/wiki"
132 +SRC_URI="https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/ibus/${P}.tar.gz"
133 +
134 +LICENSE="GPL-2"
135 +SLOT="0"
136 +KEYWORDS="~amd64 ~x86"
137 +IUSE="boost lua nls"
138 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
139 +
140 +RDEPEND="${PYTHON_DEPS}
141 + app-i18n/pyzy
142 + dev-db/sqlite:3
143 + $(python_gen_cond_dep '
144 + app-i18n/ibus[python(+),${PYTHON_MULTI_USEDEP}]
145 + dev-python/pygobject:3[${PYTHON_MULTI_USEDEP}]
146 + ')
147 + boost? ( dev-libs/boost )
148 + lua? ( =dev-lang/lua-5.1*:= )
149 + nls? ( virtual/libintl )"
150 +DEPEND="${RDEPEND}
151 + dev-util/intltool
152 + sys-devel/autoconf-archive
153 + virtual/pkgconfig
154 + nls? ( sys-devel/gettext )"
155 +
156 +PATCHES=(
157 + "${FILESDIR}"/${PN}-boost.patch
158 + "${FILESDIR}"/${P}-content-type-method.patch
159 + "${FILESDIR}"/${P}-python3.patch
160 +)
161 +
162 +src_prepare() {
163 + default
164 + eautoreconf
165 +}
166 +
167 +src_configure() {
168 + econf \
169 + $(use_enable boost) \
170 + $(use_enable lua lua-extension) \
171 + $(use_enable nls)
172 +}