-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
120 lines (94 loc) · 2.9 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
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Docker Monitoring
# Copyright (C) 2015 Tobias Urdin
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import sys
import os
from distutils.core import setup
from distutils.core import Command
from unittest import TextTestRunner, TestLoader
from subprocess import call
class TestCommand(Command):
description = "run test"
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
status = self._run_tests()
sys.exit(status)
def _run_tests(self):
print "hello world"
class Pep8Command(Command):
description = "run pep8"
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
status = self._run_tests()
sys.exit(status)
def _run_tests(self):
try:
import pep8
pep8
except ImportError:
print('Missing "pep8" library. You can install it using pip:'
'pip install pep8')
sys.exit(1)
cwd = os.getcwd()
retcode = call(('pep8 %s/docker_monitoring/ %s/test/' %
(cwd, cwd)).split(' '))
sys.exit(retcode)
class CoverageCommand(Command):
description = "run coverage"
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
try:
import coverage
except ImportError:
print('Missing "coverage" library. You can install it using pip:'
'pip install coverage')
sys.exit(1)
cover = coverage.coverage(config_file='.coveragerc')
cover.start()
tc = TestCommand(self.distribution)
tc._run_tests()
cover.stop()
cover.save()
cover.html_report()
setup(name='docker-monitoring',
version='1.0',
description='Docker Monitoring checks for Nagios.',
author='Tobias Urdin',
author_email='[email protected]',
license='Apache License 2.0',
packages=['docker_monitoring'],
package_dir={
'docker_monitoring': 'docker_monitoring',
},
url='https://github.com/tobias-urdin/docker-monitoring',
cmdclass={
'test': TestCommand,
'pep8': Pep8Command,
'coverage': CoverageCommand
},
)