benchlab-pytools 3.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- benchlab/__init__.py +14 -0
- benchlab/__main__.py +21 -0
- benchlab/config/README.md +325 -0
- benchlab/config/__init__.py +9 -0
- benchlab/config/config_client.py +631 -0
- benchlab/config/config_manager.py +495 -0
- benchlab/config/config_tool.py +358 -0
- benchlab/config/diff.py +163 -0
- benchlab/config/examples/complete_config.json +56 -0
- benchlab/config/examples/rgb_lighting.json +24 -0
- benchlab/config/examples/simple_fan.json +32 -0
- benchlab/config/schema.py +138 -0
- benchlab/core/README.md +154 -0
- benchlab/core/__init__.py +78 -0
- benchlab/core/config.py +145 -0
- benchlab/core/datasource.py +1209 -0
- benchlab/core/datasource_manager.py +418 -0
- benchlab/core/device_registry.py +206 -0
- benchlab/core/discovery.py +92 -0
- benchlab/core/infrastructure.py +309 -0
- benchlab/core/process_manager.py +356 -0
- benchlab/core/retry.py +85 -0
- benchlab/core/shared_serial.py +235 -0
- benchlab/core/statistics.py +224 -0
- benchlab/csv_log/README.md +206 -0
- benchlab/csv_log/__init__.py +5 -0
- benchlab/csv_log/csv_logger_enhanced.py +416 -0
- benchlab/csv_log/message_batcher.py +361 -0
- benchlab/csv_log/requirements.txt +3 -0
- benchlab/csv_log/smart_retry.py +466 -0
- benchlab/graph/README.md +117 -0
- benchlab/graph/__init__.py +5 -0
- benchlab/graph/app.py +353 -0
- benchlab/graph/requirements.txt +2 -0
- benchlab/graph/runner.py +42 -0
- benchlab/graph/ui.py +288 -0
- benchlab/hwinfo/README.md +135 -0
- benchlab/hwinfo/__init__.py +5 -0
- benchlab/hwinfo/hwinfo_export.py +386 -0
- benchlab/hwinfo/requirements.txt +1 -0
- benchlab/launcher.py +387 -0
- benchlab/link/.env.EXAMPLE +10 -0
- benchlab/link/README.md +172 -0
- benchlab/link/__init__.py +1 -0
- benchlab/link/link_main.py +479 -0
- benchlab/main.py +462 -0
- benchlab/menu.py +729 -0
- benchlab/menu_classic.py +410 -0
- benchlab/mqtt/README.md +201 -0
- benchlab/mqtt/__init__.py +5 -0
- benchlab/mqtt/mqtt.config_template +2 -0
- benchlab/mqtt/mqtt_publisher.py +540 -0
- benchlab/mqtt/requirements.txt +3 -0
- benchlab/prefs.py +67 -0
- benchlab/restapi/.env.example +17 -0
- benchlab/restapi/__init__.py +5 -0
- benchlab/restapi/favicon.ico +0 -0
- benchlab/restapi/readme.md +202 -0
- benchlab/restapi/requirements.txt +5 -0
- benchlab/restapi/telemetry_api.py +808 -0
- benchlab/sources.py +515 -0
- benchlab/tools.py +147 -0
- benchlab/tui/README.md +266 -0
- benchlab/tui/__init__.py +5 -0
- benchlab/tui/config.py +477 -0
- benchlab/tui/requirements.txt +2 -0
- benchlab/tui/tui_core.py +1298 -0
- benchlab/tui/tui_main.py +418 -0
- benchlab/vu/README.md +64 -0
- benchlab/vu/VU-Server/NOTICE.md +13 -0
- benchlab/vu/VU-Server/README.md +80 -0
- benchlab/vu/VU-Server/Running_from_source_on_linux.md +97 -0
- benchlab/vu/VU-Server/__init__.py +0 -0
- benchlab/vu/VU-Server/assets/vu1_hello_world.png +0 -0
- benchlab/vu/VU-Server/community_applications.md +13 -0
- benchlab/vu/VU-Server/config.yaml +9 -0
- benchlab/vu/VU-Server/database.py +256 -0
- benchlab/vu/VU-Server/dial_driver.py +534 -0
- benchlab/vu/VU-Server/dials/Comms_Hub_Gauge.py +78 -0
- benchlab/vu/VU-Server/dials/Comms_Hub_Server.py +100 -0
- benchlab/vu/VU-Server/dials/__init__.py +0 -0
- benchlab/vu/VU-Server/dials/base_logger.py +100 -0
- benchlab/vu/VU-Server/installer/inc/icon.ico +0 -0
- benchlab/vu/VU-Server/installer/install.nsi +148 -0
- benchlab/vu/VU-Server/make_version.py +40 -0
- benchlab/vu/VU-Server/pylintrc +628 -0
- benchlab/vu/VU-Server/requirements.txt +9 -0
- benchlab/vu/VU-Server/serial_driver.py +244 -0
- benchlab/vu/VU-Server/server.py +670 -0
- benchlab/vu/VU-Server/server_config.py +255 -0
- benchlab/vu/VU-Server/server_dial_handler.py +334 -0
- benchlab/vu/VU-Server/vu_notifications.py +24 -0
- benchlab/vu/VU-Server/www/android-chrome-192x192.png +0 -0
- benchlab/vu/VU-Server/www/android-chrome-512x512.png +0 -0
- benchlab/vu/VU-Server/www/apple-touch-icon.png +0 -0
- benchlab/vu/VU-Server/www/assets/css/demo.css +291 -0
- benchlab/vu/VU-Server/www/assets/css/demo.min.css +9 -0
- benchlab/vu/VU-Server/www/assets/css/demo.rtl.css +276 -0
- benchlab/vu/VU-Server/www/assets/css/demo.rtl.min.css +9 -0
- benchlab/vu/VU-Server/www/assets/css/tabler-flags.css +1084 -0
- benchlab/vu/VU-Server/www/assets/css/tabler-flags.min.css +9 -0
- benchlab/vu/VU-Server/www/assets/css/tabler-flags.rtl.css +1084 -0
- benchlab/vu/VU-Server/www/assets/css/tabler-flags.rtl.min.css +9 -0
- benchlab/vu/VU-Server/www/assets/css/tabler-payments.css +528 -0
- benchlab/vu/VU-Server/www/assets/css/tabler-payments.min.css +9 -0
- benchlab/vu/VU-Server/www/assets/css/tabler-payments.rtl.css +528 -0
- benchlab/vu/VU-Server/www/assets/css/tabler-payments.rtl.min.css +9 -0
- benchlab/vu/VU-Server/www/assets/css/tabler-social.css +10 -0
- benchlab/vu/VU-Server/www/assets/css/tabler-social.min.css +8 -0
- benchlab/vu/VU-Server/www/assets/css/tabler-social.rtl.css +10 -0
- benchlab/vu/VU-Server/www/assets/css/tabler-social.rtl.min.css +8 -0
- benchlab/vu/VU-Server/www/assets/css/tabler-vendors.css +1504 -0
- benchlab/vu/VU-Server/www/assets/css/tabler-vendors.min.css +9 -0
- benchlab/vu/VU-Server/www/assets/css/tabler-vendors.rtl.css +1504 -0
- benchlab/vu/VU-Server/www/assets/css/tabler-vendors.rtl.min.css +9 -0
- benchlab/vu/VU-Server/www/assets/css/tabler.css +25813 -0
- benchlab/vu/VU-Server/www/assets/css/tabler.min.css +13 -0
- benchlab/vu/VU-Server/www/assets/css/tabler.rtl.css +25777 -0
- benchlab/vu/VU-Server/www/assets/css/tabler.rtl.min.css +13 -0
- benchlab/vu/VU-Server/www/assets/css/theme.min.css +261 -0
- benchlab/vu/VU-Server/www/assets/img/header.png +0 -0
- benchlab/vu/VU-Server/www/assets/img/logo.png +0 -0
- benchlab/vu/VU-Server/www/assets/js/dark-theme.js +35 -0
- benchlab/vu/VU-Server/www/assets/js/dark-theme.min.js +9 -0
- benchlab/vu/VU-Server/www/assets/js/demo.js +132 -0
- benchlab/vu/VU-Server/www/assets/js/demo.min.js +9 -0
- benchlab/vu/VU-Server/www/assets/js/jquery.min.js +2 -0
- benchlab/vu/VU-Server/www/assets/js/tabler.esm.js +7482 -0
- benchlab/vu/VU-Server/www/assets/js/tabler.esm.min.js +15 -0
- benchlab/vu/VU-Server/www/assets/js/tabler.js +7543 -0
- benchlab/vu/VU-Server/www/assets/js/tabler.min.js +15 -0
- benchlab/vu/VU-Server/www/assets/js/vu1_api.js +68 -0
- benchlab/vu/VU-Server/www/assets/js/vu1_gui_api_key_settings.js +167 -0
- benchlab/vu/VU-Server/www/assets/js/vu1_gui_api_keys.js +138 -0
- benchlab/vu/VU-Server/www/assets/js/vu1_gui_dial.js +179 -0
- benchlab/vu/VU-Server/www/assets/js/vu1_gui_home.js +60 -0
- benchlab/vu/VU-Server/www/assets/js/vu1_gui_root.js +125 -0
- benchlab/vu/VU-Server/www/favicon-16x16.png +0 -0
- benchlab/vu/VU-Server/www/favicon-32x32.png +0 -0
- benchlab/vu/VU-Server/www/favicon.ico +0 -0
- benchlab/vu/VU-Server/www/favicon.png +0 -0
- benchlab/vu/VU-Server/www/index.html +47 -0
- benchlab/vu/VU-Server/www/views/api_keys.html +151 -0
- benchlab/vu/VU-Server/www/views/dial.html +286 -0
- benchlab/vu/VU-Server/www/views/footer.html +27 -0
- benchlab/vu/VU-Server/www/views/header.html +86 -0
- benchlab/vu/VU-Server/www/views/key_settings.html +132 -0
- benchlab/vu/VU-Server/www/views/start.html +124 -0
- benchlab/vu/__init__.py +5 -0
- benchlab/vu/assets/Barlow-Bold.ttf +0 -0
- benchlab/vu/assets/bl_dial_144x200.png +0 -0
- benchlab/vu/assets/bl_logo_144x200.png +0 -0
- benchlab/vu/devices.py +166 -0
- benchlab/vu/requirements.txt +24 -0
- benchlab/vu/sensors.py +18 -0
- benchlab/vu/vu_dial.config_template +90 -0
- benchlab/vu/vu_logo_gen.py +97 -0
- benchlab/vu/vu_server.config_template +5 -0
- benchlab/vu/vu_server_config.py +40 -0
- benchlab/vu/vu_server_manager.py +192 -0
- benchlab/vu/vu_tui.py +919 -0
- benchlab/vu/vu_updater.py +540 -0
- benchlab/wigidash/README.md +182 -0
- benchlab/wigidash/__init__.py +5 -0
- benchlab/wigidash/assets/Inter-Bold.ttf +0 -0
- benchlab/wigidash/assets/Inter.ttf +0 -0
- benchlab/wigidash/assets/benchlab.png +0 -0
- benchlab/wigidash/benchlab_fleet.py +150 -0
- benchlab/wigidash/benchlab_graph.py +517 -0
- benchlab/wigidash/benchlab_overview.py +426 -0
- benchlab/wigidash/benchlab_telemetry.py +105 -0
- benchlab/wigidash/benchlab_ui.py +190 -0
- benchlab/wigidash/benchlab_utils.py +182 -0
- benchlab/wigidash/requirements.txt +9 -0
- benchlab/wigidash/wigidash_device.py +541 -0
- benchlab/wigidash/wigidash_manager.py +342 -0
- benchlab/wigidash/wigidash_session.py +355 -0
- benchlab/wigidash/wigidash_usb.py +247 -0
- benchlab/wigidash/wigidash_widget.py +88 -0
- benchlab_pytools-3.0.0.dist-info/METADATA +239 -0
- benchlab_pytools-3.0.0.dist-info/RECORD +184 -0
- benchlab_pytools-3.0.0.dist-info/WHEEL +4 -0
- benchlab_pytools-3.0.0.dist-info/entry_points.txt +2 -0
- benchlab_pytools-3.0.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# This file was automatically generated using `generate_pyton_classes.py` script.
|
|
2
|
+
# Please don't make any direct modifications to this file as they will be overwritten and lost in the next cycle.
|
|
3
|
+
# Instead please make modification in the respective .yaml file.
|
|
4
|
+
# Generated on 2023-10-06 23:18
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class hub_config:
|
|
8
|
+
GAUGE_COMM_HEADER_LEN = 9
|
|
9
|
+
GAUGE_COMM_MAX_TX_DATA_LEN = 1000
|
|
10
|
+
GAUGE_COMM_MAX_RX_DATA_LEN = 5000
|
|
11
|
+
GAUGE_COMM_START_CHAR = '>'
|
|
12
|
+
GAUGE_COMM_POS_CMD = 1
|
|
13
|
+
GAUGE_COMM_POS_DATA_TYPE = 3
|
|
14
|
+
GAUGE_COMM_POS_DATA_LENGTH_UPPER = 5
|
|
15
|
+
GAUGE_COMM_POS_DATA_LENGTH_LOWER = 7
|
|
16
|
+
GAUGE_COMM_POS_DATA_START = 9
|
|
17
|
+
GAUGE_COMM_SERIAL_RX_TIMEOUT = 1000
|
|
18
|
+
GAUGE_COMM_SERIAL_TX_TIMEOUT = 1000
|
|
19
|
+
GAUGE_SERIAL_PROTOCOL_VERSION = "v1"
|
|
20
|
+
GAUGE_SERIAL_JUMP_TO_BTL_KEY1 = 0x53
|
|
21
|
+
GAUGE_SERIAL_JUMP_TO_BTL_KEY2 = 0x4B
|
|
22
|
+
|
|
23
|
+
class hub_commands:
|
|
24
|
+
COMM_CMD_FIRST = 0x00
|
|
25
|
+
COMM_CMD_SET_DIAL_RAW_SINGLE = 0x01
|
|
26
|
+
COMM_CMD_SET_DIAL_RAW_MULTIPLE = 0x02
|
|
27
|
+
COMM_CMD_SET_DIAL_PERC_SINGLE = 0x03
|
|
28
|
+
COMM_CMD_SET_DIAL_PERC_MULTIPLE = 0x04
|
|
29
|
+
COMM_CMD_SET_DIAL_CALIBRATE_MAX = 0x05
|
|
30
|
+
COMM_CMD_SET_DIAL_CALIBRATE_HALF = 0x06
|
|
31
|
+
COMM_CMD_GET_DEVICES_MAP = 0x07
|
|
32
|
+
COMM_CMD_PROVISION_DEVICE = 0x08
|
|
33
|
+
COMM_CMD_RESET_ALL_DEVICES = 0x09
|
|
34
|
+
COMM_CMD_DIAL_POWER = 0x0A
|
|
35
|
+
COMM_CMD_GET_DEVICE_UID = 0x0B
|
|
36
|
+
COMM_CMD_RESCAN_BUS = 0x0C
|
|
37
|
+
COMM_CMD_DISPLAY_CLEAR = 0x0D
|
|
38
|
+
COMM_CMD_DISPLAY_GOTO_XY = 0x0E
|
|
39
|
+
COMM_CMD_DISPLAY_IMG_DATA = 0x0F
|
|
40
|
+
COMM_CMD_DISPLAY_SHOW_IMG = 0x10
|
|
41
|
+
COMM_CMD_RX_BUFFER_SIZE = 0x11
|
|
42
|
+
COMM_CMD_RESET_CFG = 0x12
|
|
43
|
+
COMM_CMD_SET_RGB_BACKLIGHT = 0x13
|
|
44
|
+
COMM_CMD_SET_DIAL_EASING_STEP = 0x14
|
|
45
|
+
COMM_CMD_SET_DIAL_EASING_PERIOD = 0x15
|
|
46
|
+
COMM_CMD_SET_BACKLIGHT_EASING_STEP = 0x16
|
|
47
|
+
COMM_CMD_SET_BACKLIGHT_EASING_PERIOD = 0x17
|
|
48
|
+
COMM_CMD_GET_EASING_CONFIG = 0x18
|
|
49
|
+
COMM_CMD_GET_BUILD_INFO = 0x19
|
|
50
|
+
COMM_CMD_GET_FW_INFO = 0x20
|
|
51
|
+
COMM_CMD_GET_HW_INFO = 0x21
|
|
52
|
+
COMM_CMD_GET_PROTOCOL_INFO = 0x22
|
|
53
|
+
COMM_CMD_DEBUG_I2C_SCAN = 0xF3
|
|
54
|
+
COMM_CMD_HUB_BTL_JUMP_TO_BOOTLOADER = 0xF4
|
|
55
|
+
COMM_CMD_DIAL_BTL_JUMP_TO_BOOTLOADER = 0xF5
|
|
56
|
+
COMM_CMD_DIAL_BTL_GET_INFO = 0xF6
|
|
57
|
+
COMM_CMD_DIAL_BTL_GET_CRC = 0xF7
|
|
58
|
+
COMM_CMD_DIAL_BTL_ERASE_APP = 0xF8
|
|
59
|
+
COMM_CMD_DIAL_BTL_FWUP_SEND_PACKAGE = 0xF9
|
|
60
|
+
COMM_CMD_DIAL_BTL_FWUP_FINISHED = 0xFA
|
|
61
|
+
COMM_CMD_DIAL_BTL_EXIT = 0xFB
|
|
62
|
+
COMM_CMD_DIAL_BTL_RESTART_FW_UPLOAD = 0xFC
|
|
63
|
+
COMM_CMD_DIAL_BTL_READ_LAST_STATUS = 0xFD
|
|
64
|
+
COMM_CMD_LAST = None
|
|
65
|
+
|
|
66
|
+
class hub_data_types:
|
|
67
|
+
COMM_DATA_FIRST = 0x00
|
|
68
|
+
COMM_DATA_NONE = 0x01
|
|
69
|
+
COMM_DATA_SINGLE_VALUE = 0x02
|
|
70
|
+
COMM_DATA_MULTIPLE_VALUE = 0x03
|
|
71
|
+
COMM_DATA_KEY_VALUE_PAIR = 0x04
|
|
72
|
+
COMM_DATA_MULTIPLE_KEY_VALUE = 0x04
|
|
73
|
+
COMM_DATA_STATUS_CODE = 0x05
|
|
74
|
+
COMM_DATA_LAST = None
|
|
75
|
+
|
|
76
|
+
class hub_status_codes:
|
|
77
|
+
GAUGE_STATUS_OK = 0x0000
|
|
78
|
+
GAUGE_STATUS_FAIL = 0x0001
|
|
79
|
+
GAUGE_STATUS_BUSY = 0x0002
|
|
80
|
+
GAUGE_STATUS_TIMEOUT = 0x0003
|
|
81
|
+
GAUGE_STATUS_BAD_DATA = 0x0004
|
|
82
|
+
GAUGE_STATUS_PROTOCOL_ERROR = 0x0005
|
|
83
|
+
GAUGE_STATUS_NO_MEMORY = 0x0006
|
|
84
|
+
GAUGE_STATUS_INVALID_ARGUMENT = 0x0007
|
|
85
|
+
GAUGE_STATUS_BAD_ADDRESS = 0x0008
|
|
86
|
+
GAUGE_STATUS_FORBIDDEN = 0x0009
|
|
87
|
+
GAUGE_STATUS_ALREADY_EXISTS = 0x000B
|
|
88
|
+
GAUGE_STATUS_UNSUPPORTED = 0x000C
|
|
89
|
+
GAUGE_STATUS_NOT_IMPLEMENTED = 0x000D
|
|
90
|
+
GAUGE_STATUS_MALFORMED_PACKAGE = 0x000E
|
|
91
|
+
GAUGE_STATUS_RECURSIVE_CALL = 0x0010
|
|
92
|
+
GAUGE_STATUS_DATA_MISMATCH = 0x0011
|
|
93
|
+
GAUGE_STATUS_DEVICE_OFFLINE = 0x0012
|
|
94
|
+
GAUGE_STATUS_MODULE_NOT_INIT = 0x0013
|
|
95
|
+
GAUGE_STATUS_I2C_ERROR = 0x0014
|
|
96
|
+
GAUGE_STATUS_USART_ERROR = 0x0015
|
|
97
|
+
GAUGE_STATUS_SPI_ERROR = 0x0016
|
|
98
|
+
GAUGE_STATUS_BTL_NO_DEVICE = 0xE001
|
|
99
|
+
GAUGE_STATUS_BTL_INVALID_STATE = 0xE002
|
|
100
|
+
GAUGE_STATUS_BTL_INVALID_REQUEST = 0xE003
|
|
File without changes
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import getpass
|
|
3
|
+
import sys
|
|
4
|
+
import logging
|
|
5
|
+
from logging.handlers import RotatingFileHandler
|
|
6
|
+
from functools import partial, partialmethod
|
|
7
|
+
|
|
8
|
+
def colorize(data, color):
|
|
9
|
+
colors = {'none': "0",
|
|
10
|
+
'black': "0;30",
|
|
11
|
+
'red': "0;31",
|
|
12
|
+
'green': "0;32",
|
|
13
|
+
'brown': "0;33",
|
|
14
|
+
'blue': "0;34",
|
|
15
|
+
'purple': "0;35",
|
|
16
|
+
'cyan': "0;36",
|
|
17
|
+
'light-gray': "0;37",
|
|
18
|
+
'dark-gray': "1:30",
|
|
19
|
+
'light-red': "1;31",
|
|
20
|
+
'light-green': "1;32",
|
|
21
|
+
'yellow': "1;33",
|
|
22
|
+
'light-blue': "1;34",
|
|
23
|
+
'light-purple': "1;35",
|
|
24
|
+
'light-cyan': "1;36",
|
|
25
|
+
'white': "1;37"}
|
|
26
|
+
|
|
27
|
+
if color not in colors:
|
|
28
|
+
raise Exception("No such color: {}".format(color))
|
|
29
|
+
|
|
30
|
+
start = '\033[{}m'.format(colors[color])
|
|
31
|
+
end = '\033[{}m'.format(colors['none'])
|
|
32
|
+
|
|
33
|
+
return start + data + end
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def default_formatter():
|
|
37
|
+
pid = os.getpid()
|
|
38
|
+
|
|
39
|
+
pieces = [('%(asctime)s.%(msecs)03d', 'cyan'),
|
|
40
|
+
('pid:{}'.format(pid), 'light-red'),
|
|
41
|
+
('%(filename)-22s %(lineno)5d', 'blue'),
|
|
42
|
+
# ('%(funcName)s', 'blue'),
|
|
43
|
+
('%(levelname)-5s', 'yellow'),
|
|
44
|
+
('%(message)s', 'green')]
|
|
45
|
+
|
|
46
|
+
# platform_system() is 'Windows' on the powershell
|
|
47
|
+
try:
|
|
48
|
+
if sys.stderr.isatty():
|
|
49
|
+
# If running in a TTY, show colored output
|
|
50
|
+
fmt = ' '.join([colorize(x[0], x[1]) for x in pieces])
|
|
51
|
+
else:
|
|
52
|
+
# If being directed or piped, show plaintext
|
|
53
|
+
fmt = ' '.join([x[0] for x in pieces])
|
|
54
|
+
except AttributeError:
|
|
55
|
+
fmt = ' '.join([x[0] for x in pieces])
|
|
56
|
+
|
|
57
|
+
return logging.Formatter(fmt, "%b %d %Y %H:%M:%S")
|
|
58
|
+
|
|
59
|
+
def set_logger_level(level='info'):
|
|
60
|
+
if level.lower() == 'info':
|
|
61
|
+
logging.getLogger('kr_gauge_root').setLevel("INFO")
|
|
62
|
+
logger.info("Logging level: INFO")
|
|
63
|
+
elif level.lower() == 'debug':
|
|
64
|
+
logging.getLogger('kr_gauge_root').setLevel("DEBUG")
|
|
65
|
+
logger.info("Logging level: DEBUG")
|
|
66
|
+
else:
|
|
67
|
+
logger.setLevel(logging.INFO)
|
|
68
|
+
logger.info("Logging level: INFO")
|
|
69
|
+
|
|
70
|
+
'''
|
|
71
|
+
Shared stdout logger and logging to file
|
|
72
|
+
'''
|
|
73
|
+
# Basic logger setup
|
|
74
|
+
log_formatter = logging.Formatter('%(asctime)s %(levelname)s %(funcName)s(%(lineno)d) %(message)s')
|
|
75
|
+
# Linux
|
|
76
|
+
if sys.platform in ["linux", "linux2"]:
|
|
77
|
+
logFile = f'/home/{getpass.getuser()}/KaranovicResearch/vudials/server.log'
|
|
78
|
+
|
|
79
|
+
# MacOS
|
|
80
|
+
elif sys.platform == "darwin":
|
|
81
|
+
logFile = f'~/Library/Logs/KaranovicResearch/vudials/server.log'
|
|
82
|
+
|
|
83
|
+
# Windows
|
|
84
|
+
elif sys.platform == "win32":
|
|
85
|
+
logFile = os.path.join(os.path.expanduser(os.getenv('USERPROFILE')), 'KaranovicResearch', 'vudials', 'server.log')
|
|
86
|
+
|
|
87
|
+
os.makedirs(os.path.dirname(logFile), exist_ok=True)
|
|
88
|
+
log_file_handler = RotatingFileHandler(logFile, mode='a', maxBytes=1*1024*1024, backupCount=2, encoding=None, delay=0)
|
|
89
|
+
log_file_handler.setLevel(logging.DEBUG)
|
|
90
|
+
log_file_handler.setFormatter(log_formatter)
|
|
91
|
+
|
|
92
|
+
# Shared stdout logger
|
|
93
|
+
logger = logging.getLogger('kr_gauge_root')
|
|
94
|
+
logger.setLevel(logging.INFO)
|
|
95
|
+
logger.addHandler(log_file_handler)
|
|
96
|
+
logger.setLevel(logging.INFO)
|
|
97
|
+
logger.propagate = False
|
|
98
|
+
handler = logging.StreamHandler(stream=sys.stderr)
|
|
99
|
+
handler.setFormatter(default_formatter())
|
|
100
|
+
logger.addHandler(handler)
|
|
Binary file
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
; INSTALLEROUTPUT -> Output filepath
|
|
2
|
+
; DIRDIST -> `/dist` directory path
|
|
3
|
+
; DIRSOURCE -> Repository path
|
|
4
|
+
; makensis \DINSTALLEROUTPUT="${{ github.workspace }}/Artifacts/VU1-Installer.exe" \DDIRDIST="${{ github.workspace }}\dist" \DDIRSOURCE="${{ github.workspace }}" installer\install.nsi
|
|
5
|
+
|
|
6
|
+
# If you change the names "app.exe", "logo.ico", or "license.rtf" you should do a search and replace - they
|
|
7
|
+
# show up in a few places.
|
|
8
|
+
# All the other settings can be tweaked by editing the !defines at the top of this script
|
|
9
|
+
!define APPNAME "VUDials Server"
|
|
10
|
+
!define COMPANYNAME "KaranovicResearch"
|
|
11
|
+
!define DESCRIPTION "Server application required for VU Dials operation"
|
|
12
|
+
# These three must be integers
|
|
13
|
+
!define VERSIONMAJOR {{VU_VERSION_MAJOR}}
|
|
14
|
+
!define VERSIONMINOR {{VU_VERSION_MINOR}}
|
|
15
|
+
!define VERSIONBUILD {{VU_VERSION_BUILD}}
|
|
16
|
+
# These will be displayed by the "Click here for support information" link in "Add/Remove Programs"
|
|
17
|
+
# It is possible to use "mailto:" links in here to open the email client
|
|
18
|
+
!define HELPURL "http://forum.vudials.com" # "Support Information" link
|
|
19
|
+
!define UPDATEURL "http://forum.vudials.com" # "Product Updates" link
|
|
20
|
+
!define ABOUTURL "http://forum.vudials.com" # "Publisher" link
|
|
21
|
+
# This is the size (in kB) of all the files copied into "Program Files"
|
|
22
|
+
!define INSTALLSIZE 74209
|
|
23
|
+
|
|
24
|
+
# Executable
|
|
25
|
+
!define MAINEXE VUServer.exe
|
|
26
|
+
|
|
27
|
+
;--------------------------------
|
|
28
|
+
;Include Modern UI
|
|
29
|
+
|
|
30
|
+
!include "MUI2.nsh"
|
|
31
|
+
|
|
32
|
+
;--------------------------------
|
|
33
|
+
;General
|
|
34
|
+
|
|
35
|
+
;Name and file
|
|
36
|
+
Name "VUDials"
|
|
37
|
+
Icon "inc\icon.ico"
|
|
38
|
+
OutFile "${INSTALLEROUTPUT}"
|
|
39
|
+
Unicode True
|
|
40
|
+
|
|
41
|
+
;Default installation folder
|
|
42
|
+
InstallDir "$PROGRAMFILES\KaranovicResearch\VUDials"
|
|
43
|
+
|
|
44
|
+
;Get installation folder from registry if available
|
|
45
|
+
InstallDirRegKey HKCU "Software\VUDials" ""
|
|
46
|
+
|
|
47
|
+
;Request application privileges for Windows Vista
|
|
48
|
+
RequestExecutionLevel admin
|
|
49
|
+
|
|
50
|
+
;--------------------------------
|
|
51
|
+
;Interface Settings
|
|
52
|
+
|
|
53
|
+
!define MUI_ABORTWARNING
|
|
54
|
+
|
|
55
|
+
;--------------------------------
|
|
56
|
+
;Pages
|
|
57
|
+
|
|
58
|
+
!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
|
|
59
|
+
!insertmacro MUI_PAGE_COMPONENTS
|
|
60
|
+
!insertmacro MUI_PAGE_DIRECTORY
|
|
61
|
+
!insertmacro MUI_PAGE_INSTFILES
|
|
62
|
+
|
|
63
|
+
!insertmacro MUI_UNPAGE_CONFIRM
|
|
64
|
+
!insertmacro MUI_UNPAGE_INSTFILES
|
|
65
|
+
!insertmacro MUI_PAGE_FINISH
|
|
66
|
+
|
|
67
|
+
;--------------------------------
|
|
68
|
+
;Languages
|
|
69
|
+
|
|
70
|
+
!insertmacro MUI_LANGUAGE "English"
|
|
71
|
+
|
|
72
|
+
;--------------------------------
|
|
73
|
+
;Installer Sections
|
|
74
|
+
|
|
75
|
+
Section "VUDials Server" VUDSERVER
|
|
76
|
+
|
|
77
|
+
SetOutPath "$INSTDIR"
|
|
78
|
+
|
|
79
|
+
;ADD YOUR OWN FILES HERE...
|
|
80
|
+
File /r "${DIRDIST}\*"
|
|
81
|
+
File "${DIRSOURCE}\installer\inc\icon.ico"
|
|
82
|
+
|
|
83
|
+
# Start Menu
|
|
84
|
+
createDirectory "$SMPROGRAMS\${COMPANYNAME}"
|
|
85
|
+
createShortCut "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}.lnk" "$INSTDIR\${MAINEXE}" "" "$INSTDIR\icon.ico"
|
|
86
|
+
|
|
87
|
+
; Run server on Windows start
|
|
88
|
+
;WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "${APPNAME}" "$INSTDIR\${MAINEXE}"
|
|
89
|
+
|
|
90
|
+
;Store installation folder
|
|
91
|
+
;WriteRegStr HKCU "Software\VUDials\install_path" "" $INSTDIR
|
|
92
|
+
|
|
93
|
+
# Registry information for add/remove programs
|
|
94
|
+
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayName" "${COMPANYNAME} - ${APPNAME} - ${DESCRIPTION}"
|
|
95
|
+
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
|
|
96
|
+
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
|
|
97
|
+
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "InstallLocation" "$\"$INSTDIR$\""
|
|
98
|
+
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayIcon" "$\"$INSTDIR\icon.ico$\""
|
|
99
|
+
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "Publisher" "$\"${COMPANYNAME}$\""
|
|
100
|
+
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "HelpLink" "$\"${HELPURL}$\""
|
|
101
|
+
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "URLUpdateInfo" "$\"${UPDATEURL}$\""
|
|
102
|
+
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "URLInfoAbout" "$\"${ABOUTURL}$\""
|
|
103
|
+
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayVersion" "$\"${VERSIONMAJOR}.${VERSIONMINOR}.${VERSIONBUILD}$\""
|
|
104
|
+
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "VersionMajor" ${VERSIONMAJOR}
|
|
105
|
+
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "VersionMinor" ${VERSIONMINOR}
|
|
106
|
+
# There is no option for modifying or repairing the install
|
|
107
|
+
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoModify" 1
|
|
108
|
+
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoRepair" 1
|
|
109
|
+
# Set the INSTALLSIZE constant (!defined at the top of this script) so Add/Remove Programs can accurately report the size
|
|
110
|
+
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "EstimatedSize" ${INSTALLSIZE}
|
|
111
|
+
|
|
112
|
+
;Create uninstaller
|
|
113
|
+
WriteUninstaller "$INSTDIR\Uninstall.exe"
|
|
114
|
+
|
|
115
|
+
; Add VU1 to Windows start
|
|
116
|
+
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "VUServer" '"$InstDir\VUServer.exe"'
|
|
117
|
+
|
|
118
|
+
; Run the VU server
|
|
119
|
+
ExecShell "" "$InstDir\VUServer.exe"
|
|
120
|
+
|
|
121
|
+
SectionEnd
|
|
122
|
+
|
|
123
|
+
;--------------------------------
|
|
124
|
+
;Descriptions
|
|
125
|
+
|
|
126
|
+
;Language strings
|
|
127
|
+
LangString DESC_VUServer ${LANG_ENGLISH} "VU Dials API server."
|
|
128
|
+
|
|
129
|
+
;Assign language strings to sections
|
|
130
|
+
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
|
131
|
+
!insertmacro MUI_DESCRIPTION_TEXT ${VUDSERVER} $(DESC_VUServer)
|
|
132
|
+
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
|
133
|
+
|
|
134
|
+
;--------------------------------
|
|
135
|
+
;Uninstaller Section
|
|
136
|
+
|
|
137
|
+
Section "Uninstall"
|
|
138
|
+
|
|
139
|
+
; Install dir
|
|
140
|
+
Delete "$INSTDIR\*.*"
|
|
141
|
+
Delete "$INSTDIR\Uninstall.exe"
|
|
142
|
+
Delete "$smprograms\VUDials\"
|
|
143
|
+
RMDir /r "$INSTDIR"
|
|
144
|
+
|
|
145
|
+
; Remove windows start
|
|
146
|
+
DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "VUServer"
|
|
147
|
+
|
|
148
|
+
SectionEnd
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'''
|
|
2
|
+
Simple python script to dynamically add version tag to HTML files
|
|
3
|
+
'''
|
|
4
|
+
|
|
5
|
+
import os.path
|
|
6
|
+
from datetime import datetime
|
|
7
|
+
|
|
8
|
+
def apply_version_tag(filepath, tag_placeholder, tag_value):
|
|
9
|
+
if not os.path.isfile(filepath):
|
|
10
|
+
print(f'Not a file! {filepath}')
|
|
11
|
+
return False
|
|
12
|
+
|
|
13
|
+
with open(filepath, 'r', encoding='utf-8') as template:
|
|
14
|
+
content = template.read()
|
|
15
|
+
|
|
16
|
+
if tag_placeholder in content:
|
|
17
|
+
print(f"Patching `{filepath}` with tag `{tag_value}`")
|
|
18
|
+
content = content.replace(tag_placeholder, tag_value)
|
|
19
|
+
|
|
20
|
+
with open(filepath, 'w', encoding='utf-8') as stamped:
|
|
21
|
+
stamped.write(content)
|
|
22
|
+
|
|
23
|
+
return True
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
if __name__ == '__main__':
|
|
27
|
+
# Add version tag to HTML template
|
|
28
|
+
dt = datetime.now()
|
|
29
|
+
version_tag = dt.strftime('%Y%m%d')
|
|
30
|
+
footer_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'www', 'views', 'footer.html')
|
|
31
|
+
apply_version_tag(footer_path, '{{VU_VERSION}}', version_tag)
|
|
32
|
+
|
|
33
|
+
# Update installer version
|
|
34
|
+
version_major = dt.strftime('%Y')
|
|
35
|
+
version_minor = dt.strftime('%m')
|
|
36
|
+
version_build = dt.strftime('%d')
|
|
37
|
+
installer_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'installer', 'install.nsi')
|
|
38
|
+
apply_version_tag(installer_path, '{{VU_VERSION_MAJOR}}', version_major)
|
|
39
|
+
apply_version_tag(installer_path, '{{VU_VERSION_MINOR}}', version_minor)
|
|
40
|
+
apply_version_tag(installer_path, '{{VU_VERSION_BUILD}}', version_build)
|