mmrelay 1.1.4__py3-none-any.whl → 1.2.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.

Potentially problematic release.


This version of mmrelay might be problematic. Click here for more details.

mmrelay/config_checker.py DELETED
@@ -1,162 +0,0 @@
1
- #!/usr/bin/env python3
2
- # -*- coding: utf-8 -*-
3
-
4
- """
5
- Configuration checker module for MMRelay.
6
-
7
- Note: This module contains similar functionality to the check_config function
8
- in mmrelay.cli. The CLI version is more complete and uses centralized constants.
9
- Future refactoring should consider consolidating these implementations to reduce
10
- code duplication while maintaining backward compatibility and test coverage.
11
- """
12
-
13
- import os
14
-
15
- import yaml
16
- from yaml.loader import SafeLoader
17
-
18
- from mmrelay.constants.network import (
19
- CONFIG_KEY_BLE_ADDRESS,
20
- CONFIG_KEY_CONNECTION_TYPE,
21
- CONFIG_KEY_HOST,
22
- CONFIG_KEY_SERIAL_PORT,
23
- CONNECTION_TYPE_BLE,
24
- CONNECTION_TYPE_SERIAL,
25
- CONNECTION_TYPE_TCP,
26
- )
27
-
28
-
29
- def get_config_paths():
30
- """
31
- Return a list of possible file paths where the mmrelay configuration file may be located.
32
-
33
- Returns:
34
- list: Paths to potential configuration files.
35
- """
36
- from mmrelay.config import get_config_paths as get_paths
37
-
38
- return get_paths()
39
-
40
-
41
- def check_config():
42
- """
43
- Validates the mmrelay configuration file by checking for required sections and fields.
44
-
45
- Returns:
46
- bool: True if a valid configuration file is found and passes all checks; False otherwise.
47
- """
48
- config_paths = get_config_paths()
49
- config_path = None
50
-
51
- # Try each config path in order until we find one that exists
52
- for path in config_paths:
53
- if os.path.isfile(path):
54
- config_path = path
55
- print(f"Found configuration file at: {config_path}")
56
- try:
57
- with open(config_path, "r") as f:
58
- config = yaml.load(f, Loader=SafeLoader)
59
-
60
- # Check if config is empty
61
- if not config:
62
- print("Error: Configuration file is empty or invalid")
63
- return False
64
-
65
- # Check matrix section
66
- if "matrix" not in config:
67
- print("Error: Missing 'matrix' section in config")
68
- return False
69
-
70
- matrix_section = config["matrix"]
71
- required_matrix_fields = ["homeserver", "access_token", "bot_user_id"]
72
- missing_matrix_fields = [
73
- field
74
- for field in required_matrix_fields
75
- if field not in matrix_section
76
- ]
77
-
78
- if missing_matrix_fields:
79
- print(
80
- f"Error: Missing required fields in 'matrix' section: {', '.join(missing_matrix_fields)}"
81
- )
82
- return False
83
-
84
- # Check matrix_rooms section
85
- if "matrix_rooms" not in config or not config["matrix_rooms"]:
86
- print("Error: Missing or empty 'matrix_rooms' section in config")
87
- return False
88
-
89
- if not isinstance(config["matrix_rooms"], list):
90
- print("Error: 'matrix_rooms' must be a list")
91
- return False
92
-
93
- for i, room in enumerate(config["matrix_rooms"]):
94
- if not isinstance(room, dict):
95
- print(
96
- f"Error: Room {i+1} in 'matrix_rooms' must be a dictionary"
97
- )
98
- return False
99
-
100
- if "id" not in room:
101
- print(
102
- f"Error: Room {i+1} in 'matrix_rooms' is missing the 'id' field"
103
- )
104
- return False
105
-
106
- # Check meshtastic section
107
- if "meshtastic" not in config:
108
- print("Error: Missing 'meshtastic' section in config")
109
- return False
110
-
111
- meshtastic_section = config["meshtastic"]
112
- if CONFIG_KEY_CONNECTION_TYPE not in meshtastic_section:
113
- print("Error: Missing 'connection_type' in 'meshtastic' section")
114
- return False
115
-
116
- connection_type = meshtastic_section[CONFIG_KEY_CONNECTION_TYPE]
117
- if connection_type not in [
118
- CONNECTION_TYPE_TCP,
119
- CONNECTION_TYPE_SERIAL,
120
- CONNECTION_TYPE_BLE,
121
- ]:
122
- print(
123
- f"Error: Invalid 'connection_type': {connection_type}. Must be '{CONNECTION_TYPE_TCP}', '{CONNECTION_TYPE_SERIAL}', or '{CONNECTION_TYPE_BLE}'"
124
- )
125
- return False
126
-
127
- # Check connection-specific fields
128
- if (
129
- connection_type == CONNECTION_TYPE_SERIAL
130
- and CONFIG_KEY_SERIAL_PORT not in meshtastic_section
131
- ):
132
- print("Error: Missing 'serial_port' for 'serial' connection type")
133
- return False
134
-
135
- if (
136
- connection_type == CONNECTION_TYPE_TCP
137
- and CONFIG_KEY_HOST not in meshtastic_section
138
- ):
139
- print("Error: Missing 'host' for 'tcp' connection type")
140
- return False
141
-
142
- if (
143
- connection_type == CONNECTION_TYPE_BLE
144
- and CONFIG_KEY_BLE_ADDRESS not in meshtastic_section
145
- ):
146
- print("Error: Missing 'ble_address' for 'ble' connection type")
147
- return False
148
-
149
- print("Configuration file is valid!")
150
- return True
151
- except yaml.YAMLError as e:
152
- print(f"Error parsing YAML in {config_path}: {e}")
153
- return False
154
- except Exception as e:
155
- print(f"Error checking configuration: {e}")
156
- return False
157
-
158
- print("Error: No configuration file found in any of the following locations:")
159
- for path in config_paths:
160
- print(f" - {path}")
161
- print("\nRun 'mmrelay --generate-config' to generate a sample configuration file.")
162
- return False
@@ -1,43 +0,0 @@
1
- mmrelay/__init__.py,sha256=HEhksEbBrRIg-V44f45Ik9ZoN8cgAZPX5hVtq4c5a5o,120
2
- mmrelay/cli.py,sha256=IduTq-Uyf99LEJD8jTSJBgLdrCOlYA_b69ClhsvqXMA,17116
3
- mmrelay/config.py,sha256=cOLpVx51Rd2RhUFOc-rxPVsVVPZhWJ2A07y3Mf9e_rg,9672
4
- mmrelay/config_checker.py,sha256=CW89TwNmGB03LYXUmKbygjAthJw_8KSq7csBbTTCRV0,6003
5
- mmrelay/db_utils.py,sha256=b_cuw4zOwGlvk4CljFh3SguqOi-TRCHW_s9RCt9gUsU,19920
6
- mmrelay/log_utils.py,sha256=DKkFKkpOLbSTvvbzYzvQXzGGxSQP5vVRtmbC6l-d2WY,7380
7
- mmrelay/main.py,sha256=n4Qn4KdlXxWv6QcDrkX5rnJFEbNoC2s7c2kOf3dUOx4,13225
8
- mmrelay/matrix_utils.py,sha256=iyQw3mU49fHP7n9yieQLxX8AEwIzhcktnrMAzlX7Wm0,55776
9
- mmrelay/meshtastic_utils.py,sha256=I9jZOXWsKbrIVEKTD_ie9Qm_gY4twzg6iMOXlMVoX2w,35939
10
- mmrelay/message_queue.py,sha256=tHKziIPwQ9Xm7qpITyR1r2e-ftdn4ZivdZhek9SmMcQ,18703
11
- mmrelay/plugin_loader.py,sha256=Yyu8M399BSF8OVsCkETdhdn7xo673leiardl-lO9JXQ,40139
12
- mmrelay/setup_utils.py,sha256=EAVPmKHQmlXnxMcrkhlU27fBPjJCiwTVSLZdbEFsWLQ,22095
13
- mmrelay/constants/__init__.py,sha256=M8AXeIcS1JuS8OwmfTmhcCOkAz5XmWlNQ53GBxYOx94,1494
14
- mmrelay/constants/app.py,sha256=T7qud8aJAMIV55KuT0LakIoS1y9AdteHMU-SUaF4Eqw,419
15
- mmrelay/constants/config.py,sha256=ZhEQBP6TZS89XkHzZdmPCIZNGSjI2-tTzK5v0l7ilIQ,2350
16
- mmrelay/constants/database.py,sha256=4cHfYfBePDUUtVSflrWyStcxKSQv7VE-jSrb1IzAjls,646
17
- mmrelay/constants/formats.py,sha256=cjbrfNNFCKoGSFsFHR1QQDEQudiGquA9MUapfm0_ZNI,494
18
- mmrelay/constants/messages.py,sha256=xr77IfurBJCrM4Qp53nbDr-Bo82Di7xZcICBOinjGq4,987
19
- mmrelay/constants/network.py,sha256=8zpQemeVAflSjtZJgg7cQ4IMzeQzCah38PJbLNHmjvY,933
20
- mmrelay/constants/queue.py,sha256=yyWSrtq06b5GWzZwdl6IFtrMvxEuF9PdKSNPh8DdL2M,565
21
- mmrelay/plugins/__init__.py,sha256=KVMQIXRhe0wlGj4O3IZ0vOIQRKFkfPYejHXhJL17qrc,51
22
- mmrelay/plugins/base_plugin.py,sha256=p0ojzdiXTm9VpZYbZ-GPysCEhlsNQ04oUWefIfvfsjU,20181
23
- mmrelay/plugins/debug_plugin.py,sha256=adX0cRJHUEDLldajybPfiRDDlvytkZe5aN_dSgNKP2Y,870
24
- mmrelay/plugins/drop_plugin.py,sha256=x4S-e0Muun2Dy1H2qwRMTBB1ptLmy7ZZJhgPu-KefGs,5394
25
- mmrelay/plugins/health_plugin.py,sha256=svV_GfpAVL0QhiVzi3PVZ1mNpsOL1NHSmkRF-Mn_ExE,2250
26
- mmrelay/plugins/help_plugin.py,sha256=S7nBhsANK46Zv9wPHOVegPGcuYGMErBsxAnrRlSSCwg,2149
27
- mmrelay/plugins/map_plugin.py,sha256=eHV_t3TFcypBD4xT_OQx0hD6_iGkLJOADjwYVny0PvE,11292
28
- mmrelay/plugins/mesh_relay_plugin.py,sha256=gpQkO8S-LqDNwqJpqq5ewGXVEST-JZgOsJmrE-qRzuw,7631
29
- mmrelay/plugins/nodes_plugin.py,sha256=RDabzyG5hKG5aYWecsRUcLSjMCCv6Pngmq2Qpld1A1U,2903
30
- mmrelay/plugins/ping_plugin.py,sha256=8uFnT3qfO3RBaTUOx348voIfKpzXB3zTfcT6Gtfc8kM,4070
31
- mmrelay/plugins/telemetry_plugin.py,sha256=8SxWv4BLXMUTbiVaD3MjlMMdQyS7S_1OfLlVNAUMSO0,6306
32
- mmrelay/plugins/weather_plugin.py,sha256=RkiDeZpTWAb0VjsDC3qkGUrYY4NmzJgNa-iwBCwg8OM,9186
33
- mmrelay/tools/__init__.py,sha256=WFjDQjdevgg19_zT6iEoL29rvb1JPqYSd8708Jn5D7A,838
34
- mmrelay/tools/mmrelay.service,sha256=3vqK1VbfXvVftkTrTEOan77aTHeOT36hIAL7HqJsmTg,567
35
- mmrelay/tools/sample-docker-compose.yaml,sha256=vVgJrh-6l48hkj5F-52JA5tpDWPBjiPQ36CE9Pkqn44,1251
36
- mmrelay/tools/sample.env,sha256=RP-o3rX3jnEIrVG2rqCZq31O1yRXou4HcGrXWLVbKKw,311
37
- mmrelay/tools/sample_config.yaml,sha256=grS70MKHFd9e_lZ3GkmzPi4RRW-PdahMOMPCAg07MWs,4718
38
- mmrelay-1.1.4.dist-info/licenses/LICENSE,sha256=aB_07MhnK-bL5WLI1ucXLUSdW_yBVoepPRYB0kaAOl8,35204
39
- mmrelay-1.1.4.dist-info/METADATA,sha256=icpHKviPELzrsfvnNuXx0KIIEbXyAzAFLcte4pfQ6U8,6481
40
- mmrelay-1.1.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
41
- mmrelay-1.1.4.dist-info/entry_points.txt,sha256=SJZwGUOEpQ-qx4H8UL4xKFnKeInGUaZNW1I0ddjK7Ws,45
42
- mmrelay-1.1.4.dist-info/top_level.txt,sha256=B_ZLCRm7NYAmI3PipRUyHGymP-C-q16LSeMGzmqJfo4,8
43
- mmrelay-1.1.4.dist-info/RECORD,,