-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathsetup.py
89 lines (80 loc) · 2.48 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import ast
import io
import os
import os.path
from setuptools import find_packages, setup
install_requires = [
'pytoml >= 0.1.10, < 0.2.0',
'setuptools',
'typeguard >= 2.2.1',
]
extras_require = {
'flask': ['Flask', 'Werkzeug'],
'celery': ['celery', 'kombu'],
}
all_extra_requires = [
package
for packages in extras_require.values()
for package in packages
]
tests_require = [
'pytest >= 3.6.3, < 4.0.0',
] + all_extra_requires
docs_require = [
'Sphinx >= 1.4',
'sphinx_rtd_theme',
] + all_extra_requires
def get_version():
with open(os.path.join('settei', 'version.py')) as f:
tree = ast.parse(f.read(), f.name)
for node in ast.walk(tree):
if not (isinstance(node, ast.Assign) and len(node.targets) == 1):
continue
target, = node.targets
value = node.value
if not (isinstance(target, ast.Name) and
target.id == 'VERSION_INFO' and
isinstance(value, ast.Tuple)):
continue
elts = value.elts
if any(not isinstance(elt, ast.Num) for elt in elts):
continue
return '.'.join(str(elt.n) for elt in elts)
def readme():
name = os.path.join(os.path.dirname(__file__), 'README.rst')
try:
with io.open(name, encoding='utf-8') as f:
return f.read()
except (IOError, OSError):
return
setup(
name='settei',
version=get_version(),
description='Configuration loader from a TOML file',
long_description=readme(),
url='https://github.com/spoqa/settei',
license='Apache 2.0',
author='Spoqa Creators',
author_email='dev' '@' 'spoqa.com',
packages=find_packages(exclude=('tests', 'tests.*')),
python_requires='>=3.4.0',
install_requires=install_requires,
extras_require=dict(
extras_require,
tests=tests_require,
docs=docs_require,
),
tests_require=tests_require,
classifiers=[
'Development Status :: 5 - Production/Stable',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3 :: Only',
'Intended Audience :: Developers',
'Topic :: Software Development',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Utilities',
]
)