forked from kblin/mockaioredis
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
83 lines (71 loc) · 2.24 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
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
install_requires = [
'aioredis',
'mockredispy-kblin >= 2.9.3.3',
]
tests_require = [
'coverage',
'pytest',
'pytest-asyncio',
'pytest-cov',
]
classifiers = [
'License :: OSI Approved :: Apache Software License',
'Development Status :: 3 - Alpha',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Operating System :: POSIX',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'Topic :: Software Development',
'Topic :: Software Development :: Libraries',
]
def read_version():
import re
import os.path
regexp = re.compile(r"^__version__\W*=\W*'([\d.abrc]+)'")
init_py = os.path.join(os.path.dirname(__file__),
'mockaioredis', '__init__.py')
with open(init_py, 'r') as fh:
for line in fh:
match = regexp.match(line)
if match is not None:
return match.group(1)
else:
raise RuntimeError('Unable to find version in ' + init_py)
def read(filename):
with open(filename, 'r') as fh:
return fh.read()
class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
import sys
import pytest
errcode = pytest.main(self.test_args)
sys.exit(errcode)
setup(name='mockaioredis',
version=read_version(),
description="Mock implementation of aioredis",
long_description=read('README.md'),
long_description_content_type='text/markdown',
classifiers=classifiers,
platforms=["POSIX"],
author="Kai Blin",
author_email="[email protected]",
url="https://github.com/kblin/mockaioredis",
license="Apache Software License",
packages=find_packages(exclude=["tests"]),
install_requires=install_requires,
tests_require=tests_require,
cmdclass={'test': PyTest},
include_package_data=True,
extras_require={
'testing': tests_require,
'shipping': ['twine'],
},
)