-
Notifications
You must be signed in to change notification settings - Fork 19
/
setup.py
151 lines (131 loc) · 5.24 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import re
try:
from setuptools import setup, find_packages
except ImportError:
from distutils.core import setup, find_packages
long_description = "Python Alignak"
try:
with open('README.rst') as f:
long_description = f.read()
except IOError:
pass
# Define the list of requirements with specified versions
def read_requirements(filename='requirements.txt'):
"""Reads the list of requirements from given file.
:param filename: Filename to read the requirements from.
Uses ``'requirements.txt'`` by default.
:return: Requirments as list of strings.
"""
# allow for some leeway with the argument
if not filename.startswith('requirements'):
filename = 'requirements-' + filename
if not os.path.splitext(filename)[1]:
filename += '.txt' # no extension, add default
def valid_line(line):
line = line.strip()
return line and not any(line.startswith(p) for p in ('#', '-'))
def extract_requirement(line):
egg_eq = '#egg='
if egg_eq in line:
_, requirement = line.split(egg_eq, 1)
return requirement
return line
with open(filename) as f:
lines = f.readlines()
return list(map(extract_requirement, filter(valid_line, lines)))
requirements = read_requirements()
# Better to use exec to load the VERSION from alignak/version.py
# so to not have to import the alignak package:
with open(os.path.join('alignak', 'version.py')) as fh:
ns = {}
exec(fh.read(), ns)
VERSION = ns['VERSION']
# Get default configuration files recursively
data_files = [
('share/alignak', ['requirements.txt']),
('share/alignak', ['bin/python-post-install.sh',
'bin/python3-post-install.sh',
'bin/alignak-log-rotate',
'contrib/images/alignak.ico',
'contrib/images/alignak_128x128.png',
'contrib/images/alignak_blue_logo.png',
'contrib/images/alignak_white_logo.png'])
]
for dir in ['etc', 'bin/manpages/manpages', 'bin/rc.d', 'bin/systemd', 'bin/systemV']:
for subdir, dirs, files in os.walk(dir):
# Configuration directory
target = os.path.join('share/alignak', subdir)
package_files = [os.path.join(subdir, file) for file in files]
if package_files:
data_files.append((target, package_files))
setup(
name='alignak',
version=VERSION,
description='Alignak is a monitoring framework compatible with Nagios configuration and plugins',
long_description=long_description,
long_description_content_type='text/x-rst',
url='https://github.com/alignak-monitoring/alignak',
download_url='https://github.com/Alignak-monitoring/alignak/archive/master.tar.gz',
license='GNU Affero General Public License',
author="Alignak Team",
author_email="[email protected]",
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Intended Audience :: Customer Service',
'Intended Audience :: Information Technology',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: GNU Affero General Public License v3',
'Natural Language :: English',
'Operating System :: POSIX',
'Operating System :: POSIX :: Linux',
'Operating System :: POSIX :: BSD :: FreeBSD',
'Topic :: System',
'Topic :: System :: Monitoring',
'Topic :: System :: Networking :: Monitoring',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
],
keywords='python monitoring nagios shinken',
project_urls={
'Presentation': 'http://alignak.net',
'Documentation': 'http://docs.alignak.net/en/latest/',
'Source': 'https://github.com/alignak-monitoring/alignak/',
'Tracker': 'https://github.com/alignak-monitoring/alignak/issues',
'Contributions': 'https://github.com/alignak-monitoring-contrib/'
},
# Package data
packages=find_packages(exclude=['contrib', 'dev', 'doc', 'tests', 'tests_integ']),
include_package_data=True,
# Where to install distributed files
data_files=data_files,
# Unzip Egg
zip_safe=False,
platforms='any',
# Dependencies...
install_requires=requirements,
dependency_links=[
# Use the standard PyPi repository
"https://pypi.python.org/simple/",
],
# Entry points (if some) ...
entry_points={
"console_scripts": [
"alignak = alignak.bin.alignak_environment:main",
"alignak-arbiter = alignak.bin.alignak_arbiter:main",
"alignak-broker = alignak.bin.alignak_broker:main",
"alignak-receiver = alignak.bin.alignak_receiver:main",
"alignak-reactionner = alignak.bin.alignak_reactionner:main",
"alignak-poller = alignak.bin.alignak_poller:main",
"alignak-scheduler = alignak.bin.alignak_scheduler:main"
]
}
)