-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
72 lines (64 loc) · 2.1 KB
/
setup.py
File metadata and controls
72 lines (64 loc) · 2.1 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
"""
Infrastructure Agent: Setup configuration
Copyright (C) 2003-2026 ITRS Group Ltd. All rights reserved
"""
import os
import sys
TOX = 'TOX_WORK_DIR' in os.environ
SCRIPT_DIR = os.path.dirname(__file__)
if TOX:
from setuptools import setup
else:
from cx_Freeze import Executable, setup
try:
with open(os.path.join(SCRIPT_DIR, 'VERSION'), 'r') as f_in:
VERSION = f_in.read().strip()
except FileNotFoundError:
VERSION = '0.0.0' # Probably from `make test` or similar
EXECUTABLE_CONFIG = {
"copyright": "Copyright (C) 2003-2026 ITRS Group Ltd.",
"icon": "icon.ico"
}
build_exe_options = {
'excludes': ['asyncio', 'unittest', 'tkinter', 'test', 'mock'],
}
if TOX:
executables = []
elif sys.platform.startswith('win32'):
executables = [
# Service Executable
Executable(script="win_svce_config.py", target_name="infra-svce.exe", base="service", **EXECUTABLE_CONFIG),
# Main Executable
Executable(script="main.py", target_name="infra-agent.exe", **EXECUTABLE_CONFIG)
]
build_exe_options = build_exe_options | {
"include_files": ["icon.ico"],
"includes": ["win_svce_handler"],
# pywin32 packages required by cx_Freeze "service" base for --install/--uninstall and service runtime
"packages": ["win32serviceutil", "win32service", "win32event", "servicemanager", "win32timezone"],
# Not setting include_msvcr as we bundle the eventual MSI with the Visual C++ redistributable installer
}
else:
executables = [
Executable(script='main.py', target_name="infrastructure-agent", base='Console', **EXECUTABLE_CONFIG)
]
setup_kwargs = {
"name": "infrastructure-agent",
"version": VERSION,
"description": "Infrastructure Agent",
"author": "ITRS Group Ltd",
"author_email": "",
"url": "https://itrsgroup.com/",
"options": {"build_exe": build_exe_options},
"executables": executables,
"py_modules": [],
}
if TOX:
setup_kwargs["tests_require"] = [
"coverage",
"flake8",
"pytest",
"pytest-cov",
"pytest-mock",
]
setup(**setup_kwargs)