summaryrefslogtreecommitdiff
path: root/dev-python/python-levenshtein
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /dev-python/python-levenshtein
reinit the tree, so we can have metadata
Diffstat (limited to 'dev-python/python-levenshtein')
-rw-r--r--dev-python/python-levenshtein/Manifest8
-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, 325 insertions, 0 deletions
diff --git a/dev-python/python-levenshtein/Manifest b/dev-python/python-levenshtein/Manifest
new file mode 100644
index 000000000000..74fe2c6beade
--- /dev/null
+++ b/dev-python/python-levenshtein/Manifest
@@ -0,0 +1,8 @@
+AUX genextdoc.py 7029 SHA256 5da35495f806deb7a183094229e184f764d0351f78ab0da629c9ad55b3352cea SHA512 f03a6628e982da094d40e14d63cc2d233677d78ca1ad0dd0817bc69176d8d4374c2a0caa94a4d0891ba3b7ab14cbbad1b530319984df990176e151d79331b906 WHIRLPOOL 5d4c6664f3e46fc241d3f2e7a320368bffa6204fd83aa7c69b4422c238164d2a4b78353bf08a121539443c90b72ad281bf0e3a09279e827f25f11a82c94d0cb2
+DIST python-Levenshtein-0.11.2.tar.gz 45458 SHA256 c1311c71beb5b6eecea4bba200a626331ef67110357448be47ba1bfe3c4aa305 SHA512 67d701e841c9a846948a1f2c70ea06c6473e3ae1437f73df2a2747d576024889a12e00c4a61e95b6c14826554b1ebaf65375cf5be4f26df3b208568403192bf3 WHIRLPOOL 5acbb305efeebd56ce79256efdef870f5ef92832e0b7f6b5b4d7d569c1e51821def06ac0a9ddfa165211b129f109e1089a3982b004a7a1982c93e5ca09aa2c89
+DIST python-Levenshtein-0.12.0.tar.gz 48617 SHA256 033a11de5e3d19ea25c9302d11224e1a1898fe5abd23c61c7c360c25195e3eb1 SHA512 95df064490970618b003bccbef9071b1a2a3ee4645ac8e851f4205bd4e8123d21ee0ee733adfeec79085faa01ba39902e2a4a26bfb21b70678377579157df4a5 WHIRLPOOL e1e0b50efcbe82d8043e352d0e0f4275bdcad27342f699f8ad4516d5591647af8ea2b9c27395c7a982a77a0c9593ad12cb1bf8a68996c943877752bf681b41e1
+EBUILD python-levenshtein-0.11.2.ebuild 1076 SHA256 91f760d3281da6d169f1215b7a8c5ab6b2c8152cb1d006d438125fab0050c017 SHA512 6ce0eeeabc79ed2e5d219d62bf28172a9ca70bbf94fd995dcc2d227758d820407cb98a187904827514c963951956c09a4476113b9e5b3165c0417da9cf076e25 WHIRLPOOL ad9a4854095103a92c186f2a23a6b5b4bc1d7630bbe25bd46816fbebcdf54e302ae0eb0f43b8b4e69bf001101aceab5640f36c7bbb18c1709f8f83b788c6d26c
+EBUILD python-levenshtein-0.12.0.ebuild 1087 SHA256 aaa685c22db1f56641d9ee07685b2b211dd08d0d34f867ba5c26ced4f0a83e18 SHA512 9ab0faf53eaf053abcc6a7132b9f63f9b83f894d10f27f30302106d2af0dbe4e434fab4869a1c17a69a4a6c7313cd77c09b18bf8197664e0c81e09c5bbd12f8c WHIRLPOOL 15b149125401ccbb36d3fe124a8a2e8425156c0286a874ae1328d2bd8ba56ae903a7493a1c73a0ca93324e2f4e41a45065839b8fb90f1acbc31ee7ceb5218659
+MISC ChangeLog 4394 SHA256 b2751ecb594b8640ceca89daabc5166a80987b9a2c64a16a395d8a5fe422e72e SHA512 bff7042e50f33c1253490560ab88c9cf376c2e113b6813bbdd6663161e231fabc791ca615e64f12c80628db12710afca89fd53b24db190c83cc775689cf12bee WHIRLPOOL 409094f40b88a3f1791aa2995cbb725affb2eef41e0f977feeca604c5591e0fd13d66ee4587332517ac6beed0a1a19aea874e16ce5a52062f0c87c74855b90d8
+MISC ChangeLog-2015 3969 SHA256 7ae12058a211299edeaffaacbc023f86047e057a8d4f8746298f62049a8dfee8 SHA512 1ee8a96de47e9612d94ef6e3b01c33597d0df5411e6d8209d10ef95b737f3cd41f2d237efb608220050ea7c5d8d26aa1c04f795d0fcef37110445b22d797ff5a WHIRLPOOL 5475cbf722f5bd5519e66c4b46f88511accbf058799f9e2ea62f21df49fda1755b53365e2dc52f29d64665b2748f85b1c9a698fcc9a8c1481644e8a5f502210d
+MISC metadata.xml 400 SHA256 eb66806624a32c2899cdbfeab6ebbef7f6cf210d7d289e39a48389dec5248e7c SHA512 bdda13940bb23190d6d7c43f69d77a231413dbdfd81de5e35568da70e4ab2bc9906cab76890e78da7b1789a376c44658e476ba7c0a4822e7a97b0f37ce36f0f4 WHIRLPOOL 341f1ffb512ff4402c83a8e636b65365f29ec626d48534d13a7cdaa25777cf01a7bef97d08bce902c622ed3ed7e1d1d531af550d577c566b8363f2742194040b
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..1e12a16cff6c
--- /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.python.org/pypi/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..cd4d52bf3e76
--- /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.python.org/pypi/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
+}