commit:     59b67d0c5f3eed2f123f95d49123a55dd3d8e926
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 14 05:38:43 2021 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Tue Sep 14 05:40:35 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=59b67d0c

dev-python/mecab-python: enable py3.{9,10}, enable tests

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 .../mecab-python/files/mecab-python-python3.patch  | 66 +++++++++++++++++++++-
 dev-python/mecab-python/mecab-python-0.996.ebuild  | 11 ++--
 2 files changed, 71 insertions(+), 6 deletions(-)

diff --git a/dev-python/mecab-python/files/mecab-python-python3.patch 
b/dev-python/mecab-python/files/mecab-python-python3.patch
index 33c8d97ebb2..d8fa167fff1 100644
--- a/dev-python/mecab-python/files/mecab-python-python3.patch
+++ b/dev-python/mecab-python/files/mecab-python-python3.patch
@@ -2,10 +2,72 @@
 +++ b/setup.py
 @@ -7,7 +7,7 @@
      return os.popen(str).readlines()[0][:-1]
- 
+
  def cmd2(str):
 -    return string.split (cmd1(str))
 +    return cmd1(str).split()
- 
+
  setup(name = "mecab-python",
        version = cmd1("mecab-config --version"),
+--- a/test.py
++++ b/test.py
+@@ -9,17 +9,17 @@
+
+ try:
+
+-    print MeCab.VERSION
++    print(MeCab.VERSION)
+
+     t = MeCab.Tagger (" ".join(sys.argv))
+
+-    print t.parse(sentence)
++    print(t.parse(sentence))
+
+     m = t.parseToNode(sentence)
+     while m:
+-      print m.surface, "\t", m.feature
+-      m = m.next
+-    print "EOS"
++        print(m.surface, "\t", m.feature)
++        m = m.next
++    print("EOS")
+     
+     lattice = MeCab.Lattice()
+     t.parse(lattice)
+@@ -29,24 +29,24 @@
+         b = lattice.begin_nodes(i)
+         e = lattice.end_nodes(i)
+         while b:
+-            print "B[%d] %s\t%s" % (i, b.surface, b.feature)
++            print("B[%d] %s\t%s" % (i, b.surface, b.feature))
+             b = b.bnext 
+         while e:
+-            print "E[%d] %s\t%s" % (i, e.surface, e.feature)
++            print("E[%d] %s\t%s" % (i, e.surface, e.feature))
+             e = e.bnext 
+-    print "EOS";
++    print("EOS");
+
+     d = t.dictionary_info()
+     while d:
+-        print "filename: %s" % d.filename
+-        print "charset: %s" %  d.charset
+-        print "size: %d" %  d.size
+-        print "type: %d" %  d.type
+-        print "lsize: %d" %  d.lsize
+-        print "rsize: %d" %  d.rsize
+-        print "version: %d" %  d.version
+-        d = d.next
++        print("filename: %s" % d.filename)
++        print("charset: %s" %  d.charset)
++        print("size: %d" %  d.size)
++        print("type: %d" %  d.type)
++        print("lsize: %d" %  d.lsize)
++        print("rsize: %d" %  d.rsize)
++        print("version: %d" %  d.version)
++        d = d.next
+
+-except RuntimeError, e:
+-    print "RuntimeError:", e;
++except RuntimeError as e:
++    print("RuntimeError:", e);

diff --git a/dev-python/mecab-python/mecab-python-0.996.ebuild 
b/dev-python/mecab-python/mecab-python-0.996.ebuild
index e9ff194d7f7..8f85ac04d75 100644
--- a/dev-python/mecab-python/mecab-python-0.996.ebuild
+++ b/dev-python/mecab-python/mecab-python-0.996.ebuild
@@ -1,9 +1,9 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI="7"
-PYTHON_COMPAT=( python3_{7,8} )
+EAPI=7
 
+PYTHON_COMPAT=( python3_{8..10} )
 inherit distutils-r1
 
 DESCRIPTION="Python binding for MeCab"
@@ -13,7 +13,6 @@ 
SRC_URI="https://storage.googleapis.com/google-code-archive-downloads/v2/code.go
 LICENSE="|| ( BSD LGPL-2.1 GPL-2 )"
 SLOT="0"
 KEYWORDS="amd64 ~ia64 ppc64 x86"
-IUSE=""
 
 DEPEND="~app-text/mecab-${PV}"
 RDEPEND="${DEPEND}"
@@ -21,3 +20,7 @@ RDEPEND="${DEPEND}"
 PATCHES=( "${FILESDIR}"/${PN}-python3.patch )
 DOCS=( AUTHORS README test.py )
 HTML_DOCS=( bindings.html )
+
+python_test() {
+       "${EPYTHON}" test.py || die "Tests failed with ${EPYTHON}"
+}

Reply via email to