-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
99 lines (81 loc) · 2.12 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
"""
Flask-ResponseBuilder
---------------------
"""
import os
import re
import sys
from setuptools import find_packages, setup
from setuptools.command.test import test
BASE_PATH = os.path.dirname(__file__)
VERSION_FILE = os.path.join('flask_response_builder', 'version.py')
def read(file):
"""
:param file:
:return:
"""
with open(os.path.join(BASE_PATH, file)) as f:
return f.read()
def grep(file, name):
"""
:param file:
:param name:
:return:
"""
pattern = r"{attr}\W*=\W*'([^']+)'".format(attr=name)
strval, = re.findall(pattern, read(file))
return strval
def readme(file):
"""
:param file:
:return:
"""
try:
return read(file)
except OSError as exc:
print(str(exc), file=sys.stderr)
class PyTest(test):
def finalize_options(self):
"""
"""
test.finalize_options(self)
def run_tests(self):
"""
"""
import pytest
sys.exit(pytest.main(['tests']))
setup(
name='Flask-ResponseBuilder',
version=grep(VERSION_FILE, '__version__'),
url='https://github.com/cs91chris/flask_response_builder',
license='MIT',
author=grep(VERSION_FILE, '__author_name__'),
author_email=grep(VERSION_FILE, '__author_email__'),
description='Implementations of flask response in many format notation',
long_description=readme('README.rst'),
packages=find_packages(),
zip_safe=False,
include_package_data=True,
platforms='any',
tests_require=[
'pytest >= 5',
'pytest-cov >= 2'
],
install_requires=[
'Flask >= 1.0.4',
'PyYAML >= 5',
'xmltodict >= 0',
'json2html >= 1'
],
cmdclass={'test': PyTest},
test_suite='tests',
classifiers=[
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Software Development :: Libraries :: Python Modules'
]
)