-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathsetup.py
104 lines (91 loc) · 3.14 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import ast
import re
import sys
from setuptools import find_packages, setup, __version__ as setuptools_version
def readme(name='README.rst'):
try:
with open(name) as f:
rst = f.read()
return re.sub(
r'(^|\n).. include::\s*([^\n]+)($|\n)',
lambda m: m.group(1) + (readme(m.group(2)) or '') + m.group(3),
rst
)
except (IOError, OSError):
return
def get_version():
filename = 'nirum/__init__.py'
version = None
with open(filename, 'r') as f:
tree = ast.parse(f.read(), filename)
for node in tree.body:
if (isinstance(node, ast.Assign) and
node.targets[0].id == '__version_info__'):
version = ast.literal_eval(node.value)
return '.'.join([str(x) for x in version])
setup_requires = []
install_requires = [
'six', 'iso8601',
]
tests_require = [
# flake8 does not yet support pycodestyle 2.4.0.
# Can be remove after this issue is fixed:
# https://gitlab.com/pycqa/flake8/issues/415
'pycodestyle >= 2.0, < 2.4.0',
'pytest >= 3.2.3, < 4.0.0',
'pytest-flake8 >= 0.9.1, < 1.0.0',
'flake8-import-order >= 0.12, < 1.0',
'flake8-import-order-spoqa >= 1.0.1, < 2.0.0',
]
docs_require = [
'Sphinx',
]
extras_require = {
'tests': tests_require,
'docs': docs_require,
}
below35_requires = [
'typing',
]
below34_requires = [
'enum34',
]
if 'bdist_wheel' not in sys.argv and sys.version_info < (3, 5):
install_requires.extend(below35_requires)
if tuple(map(int, setuptools_version.split('.'))) < (17, 1):
setup_requires = ['setuptools >= 17.1']
extras_require.update({":python_version=='3.4'": below35_requires})
extras_require.update({":python_version=='2.7'": below35_requires})
extras_require.update({":python_version=='2.7'": below34_requires})
else:
extras_require.update({":python_version<'3.5'": below35_requires})
extras_require.update({":python_version<'3.4'": below34_requires})
setup(
name='nirum',
version=get_version(),
description='The Nirum runtime library for Python',
long_description=readme(),
url='https://github.com/nirum-lang/nirum-python',
bugtrack_url='https://github.com/nirum-lang/nirum/issues',
author='Kang Hyojun',
author_email='iam.kanghyojun' '@' 'gmail.com',
license='MIT license',
packages=find_packages(exclude=['tests']),
install_requires=install_requires,
setup_requires=setup_requires,
extras_require=extras_require,
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Topic :: Internet :: WWW/HTTP :: WSGI :: Application',
'Topic :: Software Development :: Code Generators',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Software Development :: Object Brokering',
]
)