mmrelay 1.0.5__py3-none-any.whl → 1.0.6__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/setup_utils.py CHANGED
@@ -91,42 +91,82 @@ def get_template_service_path():
91
91
  str: The path to the template service file, or None if not found.
92
92
  """
93
93
  # Try to find the service template file
94
- # First, check in the package directory (where it should be after installation)
95
94
  package_dir = os.path.dirname(__file__)
96
- template_path = os.path.join(
97
- os.path.dirname(os.path.dirname(package_dir)), "tools", "mmrelay.service"
98
- )
99
-
100
- # If not found, try the repository root (for development)
101
- if not os.path.exists(template_path):
102
- repo_root = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
103
- template_path = os.path.join(repo_root, "tools", "mmrelay.service")
104
-
105
- # If still not found, try the current directory (fallback)
106
- if not os.path.exists(template_path):
107
- template_path = os.path.join(os.getcwd(), "tools", "mmrelay.service")
108
95
 
109
- if not os.path.exists(template_path):
110
- return None
111
-
112
- return template_path
96
+ # Try to find the service template file in various locations
97
+ template_paths = [
98
+ # Check in the package directory (where it should be after installation)
99
+ os.path.join(package_dir, "mmrelay.service"),
100
+ # Check in a tools subdirectory of the package
101
+ os.path.join(package_dir, "tools", "mmrelay.service"),
102
+ # Check in the data files location (where it should be after installation)
103
+ os.path.join(sys.prefix, "share", "mmrelay", "mmrelay.service"),
104
+ os.path.join(sys.prefix, "share", "mmrelay", "tools", "mmrelay.service"),
105
+ # Check in the user site-packages location
106
+ os.path.join(os.path.expanduser("~"), ".local", "share", "mmrelay", "mmrelay.service"),
107
+ os.path.join(os.path.expanduser("~"), ".local", "share", "mmrelay", "tools", "mmrelay.service"),
108
+ # Check one level up from the package directory
109
+ os.path.join(os.path.dirname(package_dir), "tools", "mmrelay.service"),
110
+ # Check two levels up from the package directory (for development)
111
+ os.path.join(os.path.dirname(os.path.dirname(package_dir)), "tools", "mmrelay.service"),
112
+ # Check in the repository root (for development)
113
+ os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), "tools", "mmrelay.service"),
114
+ # Check in the current directory (fallback)
115
+ os.path.join(os.getcwd(), "tools", "mmrelay.service")
116
+ ]
117
+
118
+ # Try each path until we find one that exists
119
+ for path in template_paths:
120
+ if os.path.exists(path):
121
+ return path
122
+
123
+ # If we get here, we couldn't find the template
124
+ # Debug output to help diagnose issues
125
+ print("Debug: Could not find mmrelay.service in any of these locations:")
126
+ for path in template_paths:
127
+ print(f" - {path}")
128
+
129
+ # If we get here, we couldn't find the template
130
+ return None
113
131
 
114
132
 
115
133
  def get_template_service_content():
116
134
  """Get the content of the template service file.
117
135
 
118
136
  Returns:
119
- str: The content of the template service file, or None if not found.
137
+ str: The content of the template service file, or a default template if not found.
120
138
  """
121
139
  template_path = get_template_service_path()
122
- if not template_path:
123
- return None
124
-
125
- # Read the template
126
- with open(template_path, "r") as f:
127
- service_template = f.read()
128
-
129
- return service_template
140
+ if template_path:
141
+ # Read the template from file
142
+ try:
143
+ with open(template_path, "r") as f:
144
+ service_template = f.read()
145
+ return service_template
146
+ except Exception as e:
147
+ print(f"Error reading service template file: {e}")
148
+
149
+ # If we couldn't find or read the template file, use a default template
150
+ print("Using default service template")
151
+ return """[Unit]
152
+ Description=A Meshtastic <=> Matrix Relay
153
+ After=network-online.target
154
+ Wants=network-online.target
155
+
156
+ [Service]
157
+ Type=idle
158
+ # The mmrelay binary can be installed via pipx or pip
159
+ ExecStart=%h/.local/bin/mmrelay --config %h/.mmrelay/config.yaml --logfile %h/.mmrelay/logs/mmrelay.log
160
+ WorkingDirectory=%h/.mmrelay
161
+ Restart=on-failure
162
+ RestartSec=10
163
+ Environment=PYTHONUNBUFFERED=1
164
+ # Ensure both pipx and pip environments are properly loaded
165
+ Environment=PATH=%h/.local/bin:%h/.local/pipx/venvs/mmrelay/bin:/usr/local/bin:/usr/bin:/bin
166
+
167
+ [Install]
168
+ WantedBy=default.target
169
+ """
130
170
 
131
171
 
132
172
  def is_service_enabled():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mmrelay
3
- Version: 1.0.5
3
+ Version: 1.0.6
4
4
  Summary: Bridge between Meshtastic mesh networks and Matrix chat rooms
5
5
  Home-page: https://github.com/geoffwhittington/meshtastic-matrix-relay
6
6
  Author: Geoff Whittington, Jeremiah K., and contributors
@@ -25,6 +25,7 @@ Requires-Dist: schedule==1.2.2
25
25
  Requires-Dist: platformdirs==4.3.7
26
26
  Requires-Dist: py-staticmaps>=0.4.0
27
27
  Requires-Dist: rich==14.0.0
28
+ Requires-Dist: setuptools==80.3.1
28
29
  Dynamic: license-file
29
30
 
30
31
  # M<>M Relay
@@ -8,7 +8,7 @@ mmrelay/main.py,sha256=acgBF-DnL0Rs8MmYAfbNHZ9xjqM3Qc0_oKtATN4iOEE,11085
8
8
  mmrelay/matrix_utils.py,sha256=GkIVj2bbPHtx1emFMwhEhc1SWHcv4UvkuyZYdb-Wnwo,30511
9
9
  mmrelay/meshtastic_utils.py,sha256=Pd0j7mz008ncBDIjRGyHOIb0U3vKq06uXWoJP-csHcQ,23381
10
10
  mmrelay/plugin_loader.py,sha256=Gg8E_TKqndMQHiVJwtmlIC-jCgcty-5EsX_5JJ6Onvo,36590
11
- mmrelay/setup_utils.py,sha256=GHttNLoqPwOpjSly0osaCnotPxCq0hfyopsZ2qq313A,14091
11
+ mmrelay/setup_utils.py,sha256=UZLX944GyiUQPUGNGNDwLocgShA8SzOJtvfntEu821A,16060
12
12
  mmrelay/plugins/__init__.py,sha256=KVMQIXRhe0wlGj4O3IZ0vOIQRKFkfPYejHXhJL17qrc,51
13
13
  mmrelay/plugins/base_plugin.py,sha256=hv21tSEYG-AB36aLAFdW9DDKm0NOTRNPpGIO5F3i1ts,8633
14
14
  mmrelay/plugins/debug_plugin.py,sha256=Jziht9Nj_bRO6Rmy7TjfBXaYo5eM3XsenbWFxPpyUs4,443
@@ -21,9 +21,9 @@ mmrelay/plugins/nodes_plugin.py,sha256=RDabzyG5hKG5aYWecsRUcLSjMCCv6Pngmq2Qpld1A
21
21
  mmrelay/plugins/ping_plugin.py,sha256=RTRdgDQUSO33lreDTmWsTlI0L1C3FJrXE0KYqfEWYO0,4017
22
22
  mmrelay/plugins/telemetry_plugin.py,sha256=8SxWv4BLXMUTbiVaD3MjlMMdQyS7S_1OfLlVNAUMSO0,6306
23
23
  mmrelay/plugins/weather_plugin.py,sha256=yoKA_HdFqFEhgYdXqLhvXatLphCyLJFuGUKCR7fILv0,8546
24
- mmrelay-1.0.5.dist-info/licenses/LICENSE,sha256=yceWauM1c0-FHxVplsD7W1-AbSeRaUNlmqT4UO1msBU,1073
25
- mmrelay-1.0.5.dist-info/METADATA,sha256=IrC7LB07B_2BqV3oTs-Epo3veb7XYlXE8H1aeD1WMQw,6953
26
- mmrelay-1.0.5.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
27
- mmrelay-1.0.5.dist-info/entry_points.txt,sha256=SJZwGUOEpQ-qx4H8UL4xKFnKeInGUaZNW1I0ddjK7Ws,45
28
- mmrelay-1.0.5.dist-info/top_level.txt,sha256=B_ZLCRm7NYAmI3PipRUyHGymP-C-q16LSeMGzmqJfo4,8
29
- mmrelay-1.0.5.dist-info/RECORD,,
24
+ mmrelay-1.0.6.dist-info/licenses/LICENSE,sha256=yceWauM1c0-FHxVplsD7W1-AbSeRaUNlmqT4UO1msBU,1073
25
+ mmrelay-1.0.6.dist-info/METADATA,sha256=V_JcF794O_pNB39Bm3K1TxVpB3C5f1lWYGQu4s3j3Dc,6987
26
+ mmrelay-1.0.6.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
27
+ mmrelay-1.0.6.dist-info/entry_points.txt,sha256=SJZwGUOEpQ-qx4H8UL4xKFnKeInGUaZNW1I0ddjK7Ws,45
28
+ mmrelay-1.0.6.dist-info/top_level.txt,sha256=B_ZLCRm7NYAmI3PipRUyHGymP-C-q16LSeMGzmqJfo4,8
29
+ mmrelay-1.0.6.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (79.0.1)
2
+ Generator: setuptools (80.3.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5