forked from DataDog/dd-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
124 lines (106 loc) · 3.41 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
# (C) Datadog, Inc. 2010-2016
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
# stdlib
from datetime import date
import os
import sys
# 3p
from setuptools import setup
# project
from config import get_version
# 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':
# noqa for flake8, these imports are probably here to force packaging of these modules
import py2exe # noqa
# windows-specific deps
install_requires.append('pywin32==217')
# Modules to force-include in the exe
include_modules = [
# 3p
'psutil',
'servicemanager',
'subprocess',
'win32api',
'win32event',
'win32service',
'win32serviceutil',
'wmi',
]
class Target(object):
def __init__(self, **kw):
self.__dict__.update(kw)
self.version = get_version()
self.company_name = 'Datadog, Inc.'
self.copyright = 'Copyright {} Datadog, Inc.'.format(date.today().year)
self.cmdline_style = 'pywin32'
agent_svc = Target(name='Datadog Agent', modules='win32.service', dest_base='ddagent')
sys.path.append("C:\\omnibus-ruby\\src\\vc_redist")
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", "crypt32.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': [],
}
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=[],
include_package_data=True,
test_suite='nose.collector',
zip_safe=False,
**extra_args
)