This repository has been archived by the owner on Apr 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
setup.py
134 lines (109 loc) · 3.73 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
import os
import re
import sys
import codecs
from setuptools import setup, find_packages, Command
from setuptools.command.test import test as TestCommand
here = os.path.abspath(os.path.dirname(__file__))
setup_requires = ['pytest', 'tox']
install_requires = ['six', 'tox', 'atomos']
tests_require = ['six', 'pytest-cov', 'pytest-cache', 'pytest-timeout']
dev_requires = ['pyflakes', 'pep8', 'pylint', 'check-manifest',
'ipython', 'ipdb', 'sphinx', 'sphinx_rtd_theme',
'sphinxcontrib-napoleon']
dev_requires.append(tests_require)
PY2 = sys.version_info.major is 2
PY3 = sys.version_info.major is 3
if PY2:
install_requires.append('futures')
install_requires.append('enum34')
if PY3:
install_requires.append('enum34')
version = "0.0.0"
changes = os.path.join(here, "CHANGES.md")
match = '^#*\s*(?P<version>[0-9]+\.[0-9]+(\.[0-9]+)?)$'
with codecs.open(changes, encoding='utf-8') as changes:
for line in changes:
match = re.match(match, line)
if match:
version = match.group("version")
break
# Get the long description
with codecs.open(os.path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
# Get version
with codecs.open(os.path.join(here, 'CHANGES.md'), encoding='utf-8') as f:
changelog = f.read()
class VersionCommand(Command):
description = "print library version"
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
print(version)
class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = ['--strict', '--verbose', '--tb=long',
'--cov', 'hystrix', '--cov-report',
'term-missing', 'tests']
self.test_suite = True
def run_tests(self):
import pytest
errno = pytest.main(self.test_args)
sys.exit(errno)
class Tox(TestCommand):
user_options = [('tox-args=', 'a', "Arguments to pass to tox")]
def initialize_options(self):
TestCommand.initialize_options(self)
self.tox_args = None
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
# import here, cause outside the eggs aren't loaded
import tox
import shlex
args = self.tox_args
if args:
args = shlex.split(self.tox_args)
errno = tox.cmdline(args=args)
sys.exit(errno)
setup(
name='hystrix-py',
version='0.1.0',
description='A Netflix Hystrix implementation in Python',
long_description=long_description,
url='https://github.com/wiliamsouza/hystrix-py',
author='The Hystrix Python Authors',
author_email='[email protected]',
license='Apache Software License 2.0',
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Topic :: Software Development :: Library',
'License :: OSI Approved :: Apache Software License 2.0',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
],
keywords='sample setuptools development',
packages=find_packages(exclude=['docs', 'tests']),
setup_requires=setup_requires,
install_requires=install_requires,
tests_require=tests_require,
extras_require={
'dev': dev_requires,
'test': tests_require,
},
cmdclass={
"version": VersionCommand,
'test': PyTest,
"tox": Tox,
},
)