forked from noirbizarre/flask-restplus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
109 lines (94 loc) · 3.34 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
105
106
107
108
109
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# flake8: noqa
from __future__ import unicode_literals
import re
import sys
from setuptools import setup, find_packages
RE_REQUIREMENT = re.compile(r'^\s*-r\s*(?P<filename>.*)$')
PYPI_RST_FILTERS = (
# Replace code-blocks
(r'\.\.\s? code-block::\s*(\w|\+)+', '::'),
# Remove all badges
(r'\.\. image:: .*', ''),
(r'\s+:target: .*', ''),
(r'\s+:alt: .*', ''),
# Replace Python crossreferences by simple monospace
(r':(?:class|func|meth|mod|attr|obj|exc|data|const):`~(?:\w+\.)*(\w+)`', r'``\1``'),
(r':(?:class|func|meth|mod|attr|obj|exc|data|const):`([^`]+)`', r'``\1``'),
# replace doc references
(r':doc:`(.+) <(.*)>`', r'`\1 <http://flask-restplus.readthedocs.org/en/stable\2.html>`_'),
# replace issues references
(r':issue:`(.+)`', r'`#\1 <https://github.com/noirbizarre/flask-restplus/issues/\1>`_'),
# Drop unrecognized currentmodule
(r'\.\. currentmodule:: .*', ''),
)
def rst(filename):
'''
Load rst file and sanitize it for PyPI.
Remove unsupported github tags:
- code-block directive
- all badges
'''
content = open(filename).read()
for regex, replacement in PYPI_RST_FILTERS:
content = re.sub(regex, replacement, content)
return content
long_description = '\n'.join((
rst('README.rst'),
rst('CHANGELOG.rst'),
''
))
exec(compile(open('flask_restplus/__about__.py').read(), 'flask_restplus/__about__.py', 'exec'))
tests_require = ['nose', 'rednose', 'blinker', 'tzlocal']
install_requires = ['Flask>=0.8', 'six>=1.3.0', 'jsonschema', 'pytz', 'aniso8601>=0.82']
doc_require = ['sphinx', 'alabaster', 'sphinx_issues']
dev_requires = ['flake8', 'minibench', 'tox', 'invoke'] + tests_require + doc_require
if sys.version_info[0:2] < (2, 7):
install_requires += ['ordereddict']
tests_require += ['unittest2']
try:
from unittest.mock import Mock
except:
tests_require += ['mock']
setup(
name='flask-restplus',
version=__version__,
description=__description__,
long_description=long_description,
url='https://github.com/noirbizarre/flask-restplus',
author='Axel Haustant',
author_email='[email protected]',
packages=find_packages(),
include_package_data=True,
install_requires=install_requires,
tests_require=tests_require,
extras_require={
'test': tests_require,
'doc': doc_require,
'dev': dev_requires,
},
license='MIT',
use_2to3=True,
zip_safe=False,
keywords='',
classifiers=[
'Development Status :: 3 - Alpha',
'Programming Language :: Python',
'Environment :: Web Environment',
'Operating System :: OS Independent',
'Intended Audience :: Developers',
'Topic :: System :: Software Distribution',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Software Development :: Libraries :: Python Modules',
'License :: OSI Approved :: MIT License',
],
)