forked from DataDog/dd-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
166 lines (146 loc) · 4.67 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# stdlib
from datetime import date
import os
import sys
# 3p
from setuptools import find_packages, setup
from requests.certs import where
# project
from config import get_version
from utils.jmx import JMX_FETCH_JAR_NAME
# Extra arguments to pass to the setup function
extra_args = {}
# Prereqs of the build. Won't get installed when deploying the egg.
setup_requires = []
# Prereqs of the install. Will install when deploying the egg.
install_requires = []
# Modified on mac
app_name = 'datadog-agent'
# plist (used only on mac)
plist = None
if sys.platform == 'win32':
from glob import glob
# noqa for flake8, these imports are probably here to force packaging of these modules
import py2exe # noqa
import pysnmp_mibs # noqa
import pyVim # noqa
import pyVmomi # noqa
# That's just a copy/paste of requirements.txt
for reqfile in ('requirements.txt', 'requirements-opt.txt'):
with open(reqfile) as f:
for line in f:
line = line.strip()
if line.startswith('#') or not line:
continue
# we skip psycopg2 now because don't want to install PG
# on windows
if 'psycopg2' in line:
continue
install_requires.append(line)
# windows-specific deps
install_requires.append('pywin32==217')
# Modules to force-include in the exe
include_modules = [
# 3p
'wmi',
'win32service',
'win32serviceutil',
'win32event',
'simplejson',
'adodbapi',
'pycurl',
'tornado.curl_httpclient',
'pymongo',
'pymysql',
'psutil',
'pg8000',
'redis',
'requests',
'pysnmp',
'pysnmp.smi.mibs.*',
'pysnmp.smi.mibs.instances.*',
'pysnmp_mibs.*',
'pysnmp.entity.rfc3413.oneliner.*',
'pyVim.*',
'pyVmomi.*',
# agent
'checks.network_checks',
'checks.libs.vmware.*',
'httplib2',
# pup
'tornado.websocket',
'tornado.web',
'tornado.ioloop',
]
class Target(object):
def __init__(self, **kw):
self.__dict__.update(kw)
self.version = get_version()
self.company_name = 'Datadog, Inc.'
self.copyright = 'Copyright 2013 Datadog, Inc.'
self.cmdline_style = 'pywin32'
agent_svc = Target(name='Datadog Agent', modules='win32.agent', dest_base='ddagent')
extra_args = {
'options': {
'py2exe': {
'includes': ','.join(include_modules),
'optimize': 0,
'compressed': True,
'bundle_files': 3,
'excludes': ['numpy'],
'dll_excludes': ["IPHLPAPI.DLL", "NSI.dll", "WINNSI.DLL", "WTSAPI32.dll"],
'ascii':False,
},
},
'console': ['win32\shell.py'],
'service': [agent_svc],
'windows': [{'script': 'win32\gui.py',
'dest_base': "agent-manager",
'uac_info': "requireAdministrator", # The manager needs to be administrator to stop/start the service
'icon_resources': [(1, r"packaging\datadog-agent\win32\install_files\dd_agent_win_256.ico")],
}],
'data_files': [
("Microsoft.VC90.CRT", glob(r'C:\Python27\redist\*.*')),
('jmxfetch', [r'checks\libs\%s' % JMX_FETCH_JAR_NAME]),
('gohai', [r'gohai\gohai.exe']),
('', [where()]), # CA certificates bundled with `requests`
],
}
elif sys.platform == 'darwin':
app_name = 'Datadog Agent'
from plistlib import Plist
plist = Plist.fromFile(os.path.dirname(os.path.realpath(__file__)) + '/packaging/Info.plist')
plist.update(dict(
CFBundleGetInfoString="{0}, Copyright (c) 2009-{1}, Datadog Inc.".format(
get_version(), date.today().year),
CFBundleVersion=get_version()
))
extra_args = {
'app': ['gui.py'],
'data_files': [
'images',
'status.html',
],
'options': {
'py2app': {
'optimize': 0,
'iconfile': 'packaging/Agent.icns',
'plist': plist
}
}
}
setup(
name=app_name,
version=get_version(),
description="DevOps' best friend",
author='DataDog',
author_email='[email protected]',
url='http://www.datadoghq.com',
install_requires=install_requires,
setup_requires=setup_requires,
packages=find_packages(),
include_package_data=True,
test_suite='nose.collector',
zip_safe=False,
**extra_args
)