-
Notifications
You must be signed in to change notification settings - Fork 5
/
setup.py
64 lines (52 loc) · 1.54 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
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import os
import ast
from setuptools import setup
def readme():
with open('README.rst') as f:
return f.read()
def get_meta(filename):
"""Get top level module metadata without execution.
"""
result = {
'__file__': filename,
'__name__': os.path.splitext(os.path.basename(filename))[0],
'__package__': '',
}
with open(filename) as fp:
root = ast.parse(fp.read(), fp.name)
result['__doc__'] = ast.get_docstring(root)
for node in ast.iter_child_nodes(root):
if isinstance(node, ast.Assign):
for target in node.targets:
try:
result[target.id] = ast.literal_eval(node.value)
except ValueError:
pass
return result
install_requires = ['requests']
if sys.version[:3] < '3.4':
install_requires.append('pathlib')
if sys.version[:3] < '3.3':
install_requires.append('mock')
meta = get_meta('urlpath.py')
setup(
py_modules=[meta['__name__']],
name=meta['__name__'],
version=meta['__version__'],
author=meta['__author__'],
author_email=meta['__author_email__'],
url=meta['__url__'],
download_url=meta['__download_url__'],
description=meta['__doc__'].strip().splitlines()[0],
long_description=readme(),
classifiers=meta['__classifiers__'],
license=meta['__license__'],
install_requires=install_requires,
extras_require={
'test': ['WebOb', 'jmespath'],
'json': ['jmespath'],
},
)