forked from zalando-zmon/zmon-worker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
94 lines (75 loc) · 3.25 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
MAIN_PACKAGE = 'zmon_worker_monitor'
class PyTest(TestCommand):
user_options = [('cov-html=', None, 'Generate junit html report')]
def initialize_options(self):
TestCommand.initialize_options(self)
self.cov = None
self.pytest_args = ['--cov', MAIN_PACKAGE, '--cov-report', 'term-missing',
'--doctest-modules', '-s', '-v',
'--ignore', 'tests/plugins']
self.cov_html = False
def finalize_options(self):
TestCommand.finalize_options(self)
if self.cov_html:
self.pytest_args.extend(['--cov-report', 'html'])
def run_tests(self):
try:
import pytest
except:
raise RuntimeError('py.test is not installed, run: pip install pytest')
# HACK: circumvent strange atexit error with concurrent.futures
# https://developer.blender.org/T39399
import concurrent.futures # noqa
errno = pytest.main(self.pytest_args)
sys.exit(errno)
def load_req(fn):
return [r.strip() for r in open(fn).read().splitlines() if r.strip() and not r.strip().startswith('#')]
if __name__ == '__main__':
# just in case setup.py is launched from elsewhere than the containing directory
original_dir = os.getcwd()
os.chdir(os.path.dirname(os.path.abspath(__file__)))
try:
cmdclass = {}
cmdclass['test'] = PyTest
setup(
name="zmon-worker",
version=__import__('zmon_worker_monitor').__version__,
description='ZMON Worker Monitor',
url='https://github.com/zalando/zmon-worker',
license='Apache License 2.0',
packages=find_packages(exclude=['tests', 'tests.*']),
# workaround for bug in numpy+setuptools: https://github.com/numpy/numpy/issues/2434
setup_requires=['numpy', 'flake8'],
install_requires=load_req('requirements.txt'),
cmdclass=cmdclass,
test_suite='tests',
tests_require=load_req('test_requirements.txt'),
entry_points={
'console_scripts': [
'zmon-worker = zmon_worker_monitor.main:main',
]
},
include_package_data=True, # needed to include templates (see MANIFEST.in)
# more metadata for upload to PyPI
author="Henning Jacobs",
author_email="[email protected]",
keywords='zalando zmon zmon2 worker component monitoring infrastructure',
long_description=open('README.rst').read(),
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Topic :: Software Development :: Libraries :: Python Modules'],
platforms='All',
)
finally:
os.chdir(original_dir)