-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
51 lines (46 loc) · 1.67 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
from setuptools import setup, find_packages
import compiler, pydoc
from compiler import visitor
class ModuleVisitor(object):
def __init__(self):
self.mod_doc = None
self.mod_version = None
def default(self, node):
for child in node.getChildNodes():
self.visit(child)
def visitModule(self, node):
self.mod_doc = node.doc
self.default(node)
def visitAssign(self, node):
if self.mod_version:
return
asn = node.nodes[0]
assert asn.name == '__version__', (
"expected __version__ node: %s" % asn)
self.mod_version = node.expr.value
self.default(node)
def get_module_meta(modfile):
ast = compiler.parseFile(modfile)
modnode = ModuleVisitor()
visitor.walk(ast, modnode)
if modnode.mod_doc is None:
raise RuntimeError(
"could not parse doc string from %s" % modfile)
if modnode.mod_version is None:
raise RuntimeError(
"could not parse __version__ from %s" % modfile)
return (modnode.mod_version,) + pydoc.splitdoc(modnode.mod_doc)
version, description, long_description = get_module_meta("./wsgi_intercept/__init__.py")
setup(
name = 'wsgi_intercept',
version = version,
author = 'Titus Brown, Kumar McMillan',
author_email = '[email protected]',
description = description,
url="http://code.google.com/p/wsgi-intercept/",
long_description = long_description,
license = 'MIT License',
packages = find_packages(),
test_suite = "nose.collector",
tests_require=['nose', 'Paste', 'httplib2', 'mechanize', 'mechanoid', 'WebTest', 'zope.testbrowser', 'webunit'],
)