summaryrefslogtreecommitdiff
path: root/dev-python/python-levenshtein
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2018-07-14 21:03:06 +0100
committerV3n3RiX <venerix@redcorelinux.org>2018-07-14 21:03:06 +0100
commit8376ef56580626e9c0f796d5b85b53a0a1c7d5f5 (patch)
tree7681bbd4e8b05407772df40a4bf04cbbc8afc3fa /dev-python/python-levenshtein
parent30a9caf154332f12ca60756e1b75d2f0e3e1822d (diff)
gentoo resync : 14.07.2018
Diffstat (limited to 'dev-python/python-levenshtein')
-rw-r--r--dev-python/python-levenshtein/Manifest6
-rw-r--r--dev-python/python-levenshtein/files/genextdoc.py214
-rw-r--r--dev-python/python-levenshtein/metadata.xml12
-rw-r--r--dev-python/python-levenshtein/python-levenshtein-0.11.2.ebuild45
-rw-r--r--dev-python/python-levenshtein/python-levenshtein-0.12.0.ebuild46
5 files changed, 323 insertions, 0 deletions
diff --git a/dev-python/python-levenshtein/Manifest b/dev-python/python-levenshtein/Manifest
new file mode 100644
index 000000000000..45246c7963a7
--- /dev/null
+++ b/dev-python/python-levenshtein/Manifest
@@ -0,0 +1,6 @@
+AUX genextdoc.py 7029 BLAKE2B 0d4b2c1110838696e1bbe7ef07b30d4bed04955da3451717558ed5a290ed5d1270a0fbea188f21098109f429979995e9548baedc3b9282e33e6703f03390861c SHA512 f03a6628e982da094d40e14d63cc2d233677d78ca1ad0dd0817bc69176d8d4374c2a0caa94a4d0891ba3b7ab14cbbad1b530319984df990176e151d79331b906
+DIST python-Levenshtein-0.11.2.tar.gz 45458 BLAKE2B 073871d18a2b02ba31be51af49ec907ffdf6c390f90e965c0710b5d3462f15238620e6a25b64b5fd19b922074493beec7753a0719714d893c5257eaf753aa4c0 SHA512 67d701e841c9a846948a1f2c70ea06c6473e3ae1437f73df2a2747d576024889a12e00c4a61e95b6c14826554b1ebaf65375cf5be4f26df3b208568403192bf3
+DIST python-Levenshtein-0.12.0.tar.gz 48617 BLAKE2B 67a720f2a76152b008bce86405b4f15f14f203e55c09931f83624c85199626582dcbc255ace914e103e7cd459c8570b0ea0c0d69abfd2c314aa488cb235583a4 SHA512 95df064490970618b003bccbef9071b1a2a3ee4645ac8e851f4205bd4e8123d21ee0ee733adfeec79085faa01ba39902e2a4a26bfb21b70678377579157df4a5
+EBUILD python-levenshtein-0.11.2.ebuild 1072 BLAKE2B a3e3c7045880e409fa013aa272aa25aa0d746e8ede425b9f8a9ba48b2fa0c516eda6a59311ef68e292ae6d1a8fabdc1af04ead7dd0052df4e557ac980c8d9c1f SHA512 099ead116f81bfe8adae4baabc4f8890144faaaffcfd3053c76491a40234bc84e323696ac2f1c9e28bb98da54d63ca0dee017fa0d3a1c943c4c76675fdf11847
+EBUILD python-levenshtein-0.12.0.ebuild 1083 BLAKE2B 6ed41eadc6a95a23dedad110eb7f91a1d106eac5d412916eaecc151c8bd1ee3cc28a07647b8a78788939e3bff32b792a52fcb9182f808268f417847e857c3a72 SHA512 fe913aca1fa40a4fbf6bc296eacc63399da6e9833208e1eea69c4345be5e2aed9e98bad834b2260b82d58c011e1c5fb58708ea7a6ef44255329dc2918e106238
+MISC metadata.xml 400 BLAKE2B 6cb97d53cfebfe6960f5adb6b1b10fef856a0944456e89d1f6ade86d8cf8183aa4acc33cbd4829c35a46158b6955a1454ce7143b5cd5538375ad4ab08ebf3097 SHA512 bdda13940bb23190d6d7c43f69d77a231413dbdfd81de5e35568da70e4ab2bc9906cab76890e78da7b1789a376c44658e476ba7c0a4822e7a97b0f37ce36f0f4
diff --git a/dev-python/python-levenshtein/files/genextdoc.py b/dev-python/python-levenshtein/files/genextdoc.py
new file mode 100644
index 000000000000..54ce008e88ac
--- /dev/null
+++ b/dev-python/python-levenshtein/files/genextdoc.py
@@ -0,0 +1,214 @@
+#!/usr/bin/python
+# Simple Python extension module doc generator.
+# @(#) $Id: genextdoc.py,v 1.4 2003/12/23 22:38:28 yeti Exp $
+# Written by Yeti <yeti@physics.muni.cz>
+# This program is in the public domain.
+import re, sys, types, inspect
+from cgi import escape as q
+
+args = sys.argv
+args.pop(0)
+if not args: sys.exit(0)
+
+selfcontained = False
+if args[0].startswith('-') and 'selfcontained'.startswith(args[0].strip('-')):
+ selfcontained = True
+ args.pop(0)
+if not args: sys.exit(0)
+modname = args.pop(0)
+plain_docs = args
+
+html_head = """\
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head><title>%s %s</title></head>
+<body>
+"""
+
+html_foot = """\
+</body>
+</html>
+"""
+
+def split_para(doc):
+ p = []
+ for x in doc.split('\n\n'):
+ x = x.strip()
+ if x.find('\n>>>') > -1:
+ h, t = x.split('\n>>>', 1)
+ p.append(h)
+ p.append('>>>' + t)
+ else:
+ p.append(x)
+ return p
+
+def get_doc(members):
+ try: doc = members['__doc__']
+ except KeyError: pass
+ if doc: return doc
+ try: doc = 'Python module %s' % members['__name__']
+ except KeyError: pass
+ if doc: return doc
+ else: return 'A Python module'
+
+def format_synopsis(synopsis, link=False, classname=None):
+ lst = synopsis.split('\n')
+ for i, s in zip(range(len(lst)), lst):
+ m = re.match(r'(?P<func>\w+)(?P<args>.*)', s)
+ args = re.sub(r'([a-zA-Z]\w+)', r'<var>\1</var>', m.group('args'))
+ func = m.group('func')
+ if link:
+ if classname:
+ func = '<a href="#%s-%s">%s</a>' % (classname, func, func)
+ else:
+ func = '<a href="#%s">%s</a>' % (func, func)
+ lst[i] = func + args
+ return '<br/>\n'.join(lst)
+
+def format_para(p):
+ if not p: return ''
+ doc = ''
+ if p.startswith('>>>'): doc += '<pre>\n%s\n</pre>\n' % q(p)
+ else:
+ if not re.search('^- ', p, re.M): doc += '<p>%s</p>\n' % q(p)
+ else:
+ p = re.split('(?m)^- ', p)
+ if p[0]: doc += '<p>%s</p>\n' % q(p[0].strip())
+ del p[0]
+ doc += ('<ul>%s</ul>\n'
+ % '\n'.join(['<li>%s</li>' % q(p.strip()) for p in p]))
+ return doc
+
+def preprocess_routine(name, doc):
+ parts = split_para(doc)
+ if parts: summary = parts.pop(0)
+ else: summary = 'FIXME'
+ if parts and re.match(r'\w+\(.*\)', parts[0]): synopsis = parts.pop(0)
+ else: synopsis = name + '()'
+ return {'synopsis': synopsis, 'summary': summary, 'details': parts}
+
+def analyse(obj):
+ members = obj.__dict__
+ if inspect.isclass(obj):
+ main_doc = preprocess_routine(obj.__name__, get_doc(members))
+ bases = [x.__name__ for x in obj.__bases__]
+ else:
+ main_doc = split_para(get_doc(members))
+ bases = []
+ routines = {}
+ classes = {}
+ data = {}
+ for name, m in members.items():
+ if name.startswith('__'): continue
+ try:
+ mro = list(inspect.getmro(m))
+ if mro[0] != m: continue
+ except AttributeError: pass
+ if inspect.isroutine(m):
+ try: doc = m.__doc__
+ except KeyError: pass
+ if not doc: doc = 'FIXME'
+ routines[name] = preprocess_routine(name, doc)
+ continue
+ if inspect.isclass(m):
+ classes[name] = analyse(m)
+ continue
+ t = type(m)
+ if t == types.IntType or t == types.StringType:
+ data[name] = repr(m)
+ else:
+ data[name] = m.__doc__
+ return {'name': obj.__name__, 'doc': main_doc, 'routines': routines,
+ 'classes': classes, 'data': data, 'bases': bases}
+
+def format(tree, level, prefix=''):
+ name = tree['name']
+ if prefix: fullname = '%s-%s' % (prefix, name)
+ else: fullname = name
+ ##### Main doc
+ doc = []
+ if level > 1:
+ doc = ['<h%d id="%s">' % (level, fullname)]
+ try: doc.append(format_synopsis(tree['doc']['synopsis']))
+ except TypeError:
+ doc.append(name)
+ doc.append('</h%d>\n' % level)
+ if tree.has_key('bases'):
+ doc.append('<p>Bases: %s.</p>\n' % ', '.join(tree['bases']))
+ try: lst = [tree['doc']['summary']] + tree['doc']['details']
+ except TypeError: lst = tree['doc']
+ for p in lst: doc.append(format_para(p))
+ ##### Table of contents
+ routines = tree['routines'].keys()
+ classes = tree['classes'].keys()
+ data = tree['data'].keys()
+ if routines:
+ routines.sort()
+ if level == 1: doc.append('<p><b>Functions:</b></p>\n')
+ else: doc.append('<p><b>Methods:</b></p>\n')
+ doc.append('<ul class="ltoc">\n')
+ for r in routines:
+ synopsis = tree['routines'][r]['synopsis']
+ doc.append('<li>%s</li>\n' % format_synopsis(synopsis, True,
+ fullname))
+ doc.append('</ul>\n')
+ if classes:
+ classes.sort()
+ doc.append('<p><b>Classes:</b></p>\n')
+ doc.append('<ul class="ltoc">\n')
+ for r in classes:
+ synopsis = tree['classes'][r]['doc']['synopsis']
+ doc.append('<li>%s</li>\n' % format_synopsis(synopsis, True,
+ fullname))
+ doc.append('</ul>\n')
+ if data:
+ data.sort()
+ doc.append('<p><b>Data:</b></p>\n')
+ doc.append('<ul class="ltoc">\n')
+ for r in data:
+ doc.append('<li>%s = %s</li>\n' % (r, q(tree['data'][r])))
+ doc.append('</ul>\n')
+ ##### Functions
+ if routines:
+ if level == 1: doc.append('<hr/>\n')
+ doc.append('<dl>\n')
+ for r in routines:
+ doc.append('<dt id="%s-%s">' % (fullname, r))
+ rt = tree['routines'][r]
+ doc.append('%s</dt>\n<dd>' % format_synopsis(rt['synopsis']))
+ for p in [rt['summary']] + rt['details']:
+ doc.append(format_para(p))
+ doc.append('</dd>\n')
+ doc.append('</dl>\n')
+ ##### Classes
+ if classes:
+ for r in classes:
+ doc.append('<hr/>\n')
+ doc.append(format(tree['classes'][r], level+1, fullname))
+ return ''.join(doc)
+
+exec 'import %s as __test__' % modname
+doctree = analyse(__test__)
+document = format(doctree, 1)
+print modname + '.html'
+fh = file(modname + '.html', 'w')
+if selfcontained: fh.write(html_head % (modname, 'module API'))
+fh.write(document)
+if selfcontained: fh.write(html_foot)
+fh.close()
+for f in plain_docs:
+ try: fh = file(f, 'r')
+ except: continue
+ document = fh.read()
+ fh.close()
+ print f + '.xhtml'
+ fh = file(f + '.xhtml', 'w')
+ if selfcontained: fh.write(html_head % (modname, f))
+ fh.write('<h1>%s %s</h1>\n\n' % (modname, f))
+ fh.write('<pre class="main">\n')
+ fh.write(document)
+ fh.write('</pre>\n')
+ if selfcontained: fh.write(html_foot)
+ fh.close()
diff --git a/dev-python/python-levenshtein/metadata.xml b/dev-python/python-levenshtein/metadata.xml
new file mode 100644
index 000000000000..fd06134a3ea0
--- /dev/null
+++ b/dev-python/python-levenshtein/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>python@gentoo.org</email>
+ <name>Python</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="pypi">python-Levenshtein</remote-id>
+ <remote-id type="github">miohtama/python-Levenshtein</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/dev-python/python-levenshtein/python-levenshtein-0.11.2.ebuild b/dev-python/python-levenshtein/python-levenshtein-0.11.2.ebuild
new file mode 100644
index 000000000000..5278d9f1bab0
--- /dev/null
+++ b/dev-python/python-levenshtein/python-levenshtein-0.11.2.ebuild
@@ -0,0 +1,45 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+PYTHON_COMPAT=( python{2_7,3_4} pypy )
+
+inherit distutils-r1
+
+MY_PN="python-Levenshtein"
+MY_P="${MY_PN}-${PV}"
+
+DESCRIPTION="Functions for fast computation of Levenshtein distance, and edit operations"
+HOMEPAGE="
+ https://github.com/ztane/python-Levenshtein/
+ https://pypi.org/project/python-Levenshtein/"
+SRC_URI="mirror://pypi/${PN:0:1}/${MY_PN}/${MY_P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ia64 x86"
+IUSE="doc"
+
+REQUIRED_USE="doc? ( || ( $(python_gen_useflags 'python2*' pypy) ) )"
+
+DEPEND="dev-python/setuptools[${PYTHON_USEDEP}]"
+RDEPEND=""
+
+S="${WORKDIR}/${MY_P}"
+
+pkg_setup() {
+ use doc && DISTUTILS_ALL_SUBPHASE_IMPLS=( 'python2*' pypy )
+}
+
+python_compile_all() {
+ if use doc; then
+ einfo "Generation of documentation"
+ "${PYTHON}" "${FILESDIR}/genextdoc.py" Levenshtein \
+ || die "Generation of documentation failed"
+ fi
+}
+
+python_install_all() {
+ use doc && local HTML_DOCS=( Levenshtein.html )
+ distutils-r1_python_install_all
+}
diff --git a/dev-python/python-levenshtein/python-levenshtein-0.12.0.ebuild b/dev-python/python-levenshtein/python-levenshtein-0.12.0.ebuild
new file mode 100644
index 000000000000..8ac0164ade2a
--- /dev/null
+++ b/dev-python/python-levenshtein/python-levenshtein-0.12.0.ebuild
@@ -0,0 +1,46 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PYTHON_COMPAT=( python{2_7,3_4,3_5,3_6} pypy )
+
+inherit distutils-r1
+
+MY_PN="python-Levenshtein"
+MY_P="${MY_PN}-${PV}"
+
+DESCRIPTION="Functions for fast computation of Levenshtein distance, and edit operations"
+HOMEPAGE="
+ https://github.com/ztane/python-Levenshtein/
+ https://pypi.org/project/python-Levenshtein/"
+SRC_URI="mirror://pypi/${PN:0:1}/${MY_PN}/${MY_P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ~ia64 x86"
+IUSE="doc"
+
+REQUIRED_USE="doc? ( || ( $(python_gen_useflags 'python2*' pypy) ) )"
+
+DEPEND="dev-python/setuptools[${PYTHON_USEDEP}]"
+RDEPEND=""
+
+S="${WORKDIR}/${MY_P}"
+
+pkg_setup() {
+ use doc && DISTUTILS_ALL_SUBPHASE_IMPLS=( 'python2*' pypy )
+}
+
+python_compile_all() {
+ if use doc; then
+ einfo "Generation of documentation"
+ "${EPYTHON}" "${FILESDIR}/genextdoc.py" Levenshtein \
+ || die "Generation of documentation failed"
+ fi
+}
+
+python_install_all() {
+ use doc && local HTML_DOCS=( Levenshtein.html )
+ distutils-r1_python_install_all
+}