prim-ctrl 0.7.3__tar.gz → 0.7.5__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: prim-ctrl
3
- Version: 0.7.3
3
+ Version: 0.7.5
4
4
  Summary: Primitive Ctrl - Remote control of your phone's Primitive FTPd Android SFTP server and optionally Tailscale VPN.
5
5
  Home-page: https://github.com/lmagyar/prim-ctrl
6
6
  License: Apache-2.0
@@ -69,8 +69,8 @@ class Logger(logging.Logger):
69
69
  if self.level == logging.NOTSET:
70
70
  self.setLevel(logging.WARNING if silent else logging.INFO)
71
71
 
72
- def exception_or_error(self, e: Exception, args):
73
- if not args or args.debug:
72
+ def exception_or_error(self, e: Exception):
73
+ if self.level == logging.NOTSET or self.level == logging.DEBUG:
74
74
  logger.exception(e)
75
75
  else:
76
76
  if hasattr(e, '__notes__'):
@@ -143,7 +143,11 @@ class Subprocess:
143
143
  command = ['tailscale']
144
144
  command.extend(args)
145
145
  creationflags = subprocess.CREATE_NO_WINDOW if platform.system().lower() == 'windows' else 0
146
- proc = await asyncio.create_subprocess_exec(*command, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, creationflags=creationflags)
146
+ try:
147
+ proc = await asyncio.create_subprocess_exec(*command, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, creationflags=creationflags)
148
+ except FileNotFoundError as e:
149
+ e.add_note(f"Please check that Tailscale is installed properly")
150
+ raise
147
151
  stdout, _stderr = await proc.communicate()
148
152
  return proc.returncode == 0, stdout
149
153
 
@@ -986,24 +990,24 @@ class Control:
986
990
  try:
987
991
  await phone.remote_sftp.stop(10, 30)
988
992
  except Exception as e:
989
- logger.exception_or_error(e, args)
993
+ logger.exception_or_error(e)
990
994
  if restore_state is None or not restore_state.get(Control.PHONE_VPN, stop_only_started):
991
995
  try:
992
996
  await phone.vpn.stop(10, 60)
993
997
  except Exception as e:
994
- logger.exception_or_error(e, args)
998
+ logger.exception_or_error(e)
995
999
  else:
996
1000
  if (restore_state is None or not restore_state.get(Control.PHONE_SFTP, stop_only_started)):
997
1001
  try:
998
1002
  await phone.zeroconf_sftp.stop(10, 30)
999
1003
  except Exception as e:
1000
- logger.exception_or_error(e, args)
1004
+ logger.exception_or_error(e)
1001
1005
  if local.vpn:
1002
1006
  if restore_state is None or not restore_state.get(Control.LOCAL_VPN, stop_only_started):
1003
1007
  try:
1004
1008
  await local.vpn.stop(10, 30)
1005
1009
  except Exception as e:
1006
- logger.exception_or_error(e, args)
1010
+ logger.exception_or_error(e)
1007
1011
  match args.intent:
1008
1012
  case 'test':
1009
1013
  if local.vpn and phone.vpn and phone.remote_sftp and phone.state:
@@ -1089,7 +1093,7 @@ class Control:
1089
1093
  try:
1090
1094
  await _stop(state, stop_only_started = True)
1091
1095
  except Exception as e:
1092
- logger.exception_or_error(e, args)
1096
+ logger.exception_or_error(e)
1093
1097
  raise
1094
1098
  else:
1095
1099
  try:
@@ -1213,7 +1217,7 @@ async def main():
1213
1217
  await args.ctor().run(args)
1214
1218
 
1215
1219
  except Exception as e:
1216
- logger.exception_or_error(e, args)
1220
+ logger.exception_or_error(e)
1217
1221
 
1218
1222
  return logger.exitcode
1219
1223
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "prim-ctrl"
3
- version = "0.7.3"
3
+ version = "0.7.5"
4
4
  description = "Primitive Ctrl - Remote control of your phone's Primitive FTPd Android SFTP server and optionally Tailscale VPN."
5
5
  license = "Apache-2.0"
6
6
  authors = ["Laszlo Magyar <lmagyar1973@gmail.com>"]
File without changes
File without changes