1 |
commit: 59b67d0c5f3eed2f123f95d49123a55dd3d8e926 |
2 |
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Sep 14 05:38:43 2021 +0000 |
4 |
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Sep 14 05:40:35 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=59b67d0c |
7 |
|
8 |
dev-python/mecab-python: enable py3.{9,10}, enable tests |
9 |
|
10 |
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org> |
11 |
|
12 |
.../mecab-python/files/mecab-python-python3.patch | 66 +++++++++++++++++++++- |
13 |
dev-python/mecab-python/mecab-python-0.996.ebuild | 11 ++-- |
14 |
2 files changed, 71 insertions(+), 6 deletions(-) |
15 |
|
16 |
diff --git a/dev-python/mecab-python/files/mecab-python-python3.patch b/dev-python/mecab-python/files/mecab-python-python3.patch |
17 |
index 33c8d97ebb2..d8fa167fff1 100644 |
18 |
--- a/dev-python/mecab-python/files/mecab-python-python3.patch |
19 |
+++ b/dev-python/mecab-python/files/mecab-python-python3.patch |
20 |
@@ -2,10 +2,72 @@ |
21 |
+++ b/setup.py |
22 |
@@ -7,7 +7,7 @@ |
23 |
return os.popen(str).readlines()[0][:-1] |
24 |
- |
25 |
+ |
26 |
def cmd2(str): |
27 |
- return string.split (cmd1(str)) |
28 |
+ return cmd1(str).split() |
29 |
- |
30 |
+ |
31 |
setup(name = "mecab-python", |
32 |
version = cmd1("mecab-config --version"), |
33 |
+--- a/test.py |
34 |
++++ b/test.py |
35 |
+@@ -9,17 +9,17 @@ |
36 |
+ |
37 |
+ try: |
38 |
+ |
39 |
+- print MeCab.VERSION |
40 |
++ print(MeCab.VERSION) |
41 |
+ |
42 |
+ t = MeCab.Tagger (" ".join(sys.argv)) |
43 |
+ |
44 |
+- print t.parse(sentence) |
45 |
++ print(t.parse(sentence)) |
46 |
+ |
47 |
+ m = t.parseToNode(sentence) |
48 |
+ while m: |
49 |
+- print m.surface, "\t", m.feature |
50 |
+- m = m.next |
51 |
+- print "EOS" |
52 |
++ print(m.surface, "\t", m.feature) |
53 |
++ m = m.next |
54 |
++ print("EOS") |
55 |
+ |
56 |
+ lattice = MeCab.Lattice() |
57 |
+ t.parse(lattice) |
58 |
+@@ -29,24 +29,24 @@ |
59 |
+ b = lattice.begin_nodes(i) |
60 |
+ e = lattice.end_nodes(i) |
61 |
+ while b: |
62 |
+- print "B[%d] %s\t%s" % (i, b.surface, b.feature) |
63 |
++ print("B[%d] %s\t%s" % (i, b.surface, b.feature)) |
64 |
+ b = b.bnext |
65 |
+ while e: |
66 |
+- print "E[%d] %s\t%s" % (i, e.surface, e.feature) |
67 |
++ print("E[%d] %s\t%s" % (i, e.surface, e.feature)) |
68 |
+ e = e.bnext |
69 |
+- print "EOS"; |
70 |
++ print("EOS"); |
71 |
+ |
72 |
+ d = t.dictionary_info() |
73 |
+ while d: |
74 |
+- print "filename: %s" % d.filename |
75 |
+- print "charset: %s" % d.charset |
76 |
+- print "size: %d" % d.size |
77 |
+- print "type: %d" % d.type |
78 |
+- print "lsize: %d" % d.lsize |
79 |
+- print "rsize: %d" % d.rsize |
80 |
+- print "version: %d" % d.version |
81 |
+- d = d.next |
82 |
++ print("filename: %s" % d.filename) |
83 |
++ print("charset: %s" % d.charset) |
84 |
++ print("size: %d" % d.size) |
85 |
++ print("type: %d" % d.type) |
86 |
++ print("lsize: %d" % d.lsize) |
87 |
++ print("rsize: %d" % d.rsize) |
88 |
++ print("version: %d" % d.version) |
89 |
++ d = d.next |
90 |
+ |
91 |
+-except RuntimeError, e: |
92 |
+- print "RuntimeError:", e; |
93 |
++except RuntimeError as e: |
94 |
++ print("RuntimeError:", e); |
95 |
|
96 |
diff --git a/dev-python/mecab-python/mecab-python-0.996.ebuild b/dev-python/mecab-python/mecab-python-0.996.ebuild |
97 |
index e9ff194d7f7..8f85ac04d75 100644 |
98 |
--- a/dev-python/mecab-python/mecab-python-0.996.ebuild |
99 |
+++ b/dev-python/mecab-python/mecab-python-0.996.ebuild |
100 |
@@ -1,9 +1,9 @@ |
101 |
-# Copyright 1999-2020 Gentoo Authors |
102 |
+# Copyright 1999-2021 Gentoo Authors |
103 |
# Distributed under the terms of the GNU General Public License v2 |
104 |
|
105 |
-EAPI="7" |
106 |
-PYTHON_COMPAT=( python3_{7,8} ) |
107 |
+EAPI=7 |
108 |
|
109 |
+PYTHON_COMPAT=( python3_{8..10} ) |
110 |
inherit distutils-r1 |
111 |
|
112 |
DESCRIPTION="Python binding for MeCab" |
113 |
@@ -13,7 +13,6 @@ SRC_URI="https://storage.googleapis.com/google-code-archive-downloads/v2/code.go |
114 |
LICENSE="|| ( BSD LGPL-2.1 GPL-2 )" |
115 |
SLOT="0" |
116 |
KEYWORDS="amd64 ~ia64 ppc64 x86" |
117 |
-IUSE="" |
118 |
|
119 |
DEPEND="~app-text/mecab-${PV}" |
120 |
RDEPEND="${DEPEND}" |
121 |
@@ -21,3 +20,7 @@ RDEPEND="${DEPEND}" |
122 |
PATCHES=( "${FILESDIR}"/${PN}-python3.patch ) |
123 |
DOCS=( AUTHORS README test.py ) |
124 |
HTML_DOCS=( bindings.html ) |
125 |
+ |
126 |
+python_test() { |
127 |
+ "${EPYTHON}" test.py || die "Tests failed with ${EPYTHON}" |
128 |
+} |