-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·90 lines (78 loc) · 2.43 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
#!/usr/bin/python
## setup.py ###
from distutils.core import setup, Command
from distutils.command.build_py import build_py as _build_py
from pynag import __version__
from subprocess import call, PIPE, Popen
import sys
NAME = "pynag"
SHORT_DESC = "Python modules for Nagios plugins and configuration"
LONG_DESC = """
Python modules and utilities for pragmatically handling Nagios configuration
file maintenance, status information, log file parsing and plug-in development.
"""
class BuildMan(Command):
"""Builds the man page using sphinx"""
user_options = []
def run(self):
cmd = "sphinx-build -b man docs man"
sphinx_proc = Popen(cmd.split(),
stdout=PIPE,
stderr=PIPE)
stdout, stderr = sphinx_proc.communicate()
return_code = sphinx_proc.wait()
if return_code:
print "Warning: Build of manpage failed \"%s\":\n%s\n%s" % (
cmd,
stdout,
stderr)
def initialize_options(self):
pass
def finalize_options(self):
pass
class PynagTest(Command):
"""Runs the build-test.py testing suite"""
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
errno = call([sys.executable, 'tests/build-test.py'])
raise SystemExit(errno)
if __name__ == "__main__":
manpath = "share/man/man1"
etcpath = "/etc/%s" % NAME
etcmodpath = "/etc/%s/modules" % NAME
initpath = "/etc/init.d/"
logpath = "/var/log/%s/" % NAME
varpath = "/var/lib/%s/" % NAME
rotpath = "/etc/logrotate.d"
setup(
name='%s' % NAME,
version=__version__,
author='Drew Stinnett',
description=SHORT_DESC,
long_description=LONG_DESC,
author_email='[email protected]',
url='http://pynag.org/',
license='GPLv2',
scripts=['scripts/pynag'],
packages=[
'pynag',
'pynag.Model',
'pynag.Model.EventHandlers',
'pynag.Plugins',
'pynag.Parsers',
'pynag.Control',
'pynag.Utils',
'pynag.Control',
'pynag.Control.Command',
],
data_files=[(manpath, ['man/pynag.1.gz',]),],
cmdclass={
'test': PynagTest,
'build_man': BuildMan,
},
requires=['unittest2'],
)