-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsetup.py
More file actions
99 lines (87 loc) · 3.71 KB
/
setup.py
File metadata and controls
99 lines (87 loc) · 3.71 KB
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
# This work was supported by the Oak Ridge Leadership Computing Facility at
# the Oak Ridge National Laboratory, which is managed by UT Battelle, LLC for
# the U.S. DOE (under the contract No. DE-AC05-00OR22725).
#
#
# This file is part of OddMon.
#
# OddMon is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 2 of the License, or (at your option) any later
# version.
#
# OddMon is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along
# with OddMon. If not, see <http://www.gnu.org/licenses/>.
import setuptools
import platform
import sys
def get_distro():
'''
Returns a tuple consisting of the distro name (string) and major
number (int)
'''
distro, version = platform.dist()[0:2]
majorVersion = int(version.split('.')[0])
return (distro, majorVersion)
# Do some sanity checks on the distribution we're packaging for
(distro, version) = get_distro()
if not (distro == "redhat" or
distro == "centos"):
raise RuntimeError("Unknown Linux distribution: '%s'. " % distro +
"We can only build packages for RedHat Enterprise " +
"Linux and CentOS.")
if version < 6:
raise RuntimeError("Linux distribution too old. We need at least v6.")
if version > 7:
raise RuntimeError("Linux distribution too new. v7 is the latest " +
"currently supported.")
if sys.version_info[:3] < (2,6,0):
raise RuntimeError("This application requires Python 2.6+")
details="""
More details on the package
"""
# Choose the appropriate startup script to include in the package
if version == 7:
# Use the systemd script
startup_tuple = ('/usr/lib/systemd/system', ['oddmon_aggregator.service','oddmon_collector.service'])
else:
# Use the upstart script
startup_tuple = ('/etc/init', ['oddmon_aggregator.conf','oddmon_collector.conf'])
setuptools.setup(name='oddmon',
description="A distributed monitoring tool suite",
url="http://github.com/ORNL-TechInt/oddmon",
license="LGPL",
version='1.6.4',
author='Feiyi Wang, Ross Miller, Jeremy Anantharaj',
author_email='fwang2@ornl.gov, rgmiller@ornl.gov, anantharajjd@ornl.gov',
packages = ['oddmon', 'oddmon.metric_plugins'],
# Note: metrics isn't technically a package (it has no __init__.py), but
# it is where all of the plugins live and we definitely want to include
# them in the distribution...
# ToDo: explore using setuptools.findpackages()
scripts = ['monctl.py'],
data_files=[ ('/etc/oddmon', ['oddmon.cfg.sample']),
('share/doc/oddmon', ['README.md']),
startup_tuple
],
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: System Administrators',
'Topic :: System :: Monitoring',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
],
# Work around distutils' lack of "%config(noreplace)" support by using a
# post install scriptlet to copy /etc/oddmon/oddmon.cfg.sample over to
# /etc/oddmon/oddmon.cfg *IF* the latter file doesn't already exist.
# We could also add a "post_uninstall" option if we need it.
options = { 'bdist_rpm':{'post_install' : 'post_install'}},
long_description=details
)