ominfra 0.0.0.dev179__tar.gz → 0.0.0.dev180__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. {ominfra-0.0.0.dev179/ominfra.egg-info → ominfra-0.0.0.dev180}/PKG-INFO +3 -3
  2. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/clouds/aws/cli.py +1 -1
  3. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/main.py +2 -2
  4. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/remote/spawning.py +1 -1
  5. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/scripts/manage.py +29 -29
  6. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/scripts/supervisor.py +80 -74
  7. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/supervisor/http.py +1 -1
  8. ominfra-0.0.0.dev180/ominfra/systemd.py +18 -0
  9. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/tailscale/cli.py +4 -4
  10. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180/ominfra.egg-info}/PKG-INFO +3 -3
  11. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra.egg-info/SOURCES.txt +1 -0
  12. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra.egg-info/requires.txt +2 -2
  13. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/pyproject.toml +3 -3
  14. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/LICENSE +0 -0
  15. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/MANIFEST.in +0 -0
  16. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/README.rst +0 -0
  17. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/.manifests.json +0 -0
  18. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/__about__.py +0 -0
  19. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/__init__.py +0 -0
  20. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/clouds/__init__.py +0 -0
  21. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/clouds/aws/__init__.py +0 -0
  22. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/clouds/aws/__main__.py +0 -0
  23. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/clouds/aws/auth.py +0 -0
  24. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/clouds/aws/dataclasses.py +0 -0
  25. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/clouds/aws/journald2aws/__init__.py +0 -0
  26. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/clouds/aws/journald2aws/__main__.py +0 -0
  27. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/clouds/aws/journald2aws/cursor.py +0 -0
  28. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/clouds/aws/journald2aws/driver.py +0 -0
  29. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/clouds/aws/journald2aws/main.py +0 -0
  30. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/clouds/aws/journald2aws/poster.py +0 -0
  31. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/clouds/aws/logs.py +0 -0
  32. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/clouds/aws/metadata.py +0 -0
  33. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/clouds/gcp/__init__.py +0 -0
  34. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/clouds/gcp/auth.py +0 -0
  35. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/cmds.py +0 -0
  36. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/configs.py +0 -0
  37. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/journald/__init__.py +0 -0
  38. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/journald/fields.py +0 -0
  39. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/journald/genmessages.py +0 -0
  40. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/journald/messages.py +0 -0
  41. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/journald/tailer.py +0 -0
  42. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/__init__.py +0 -0
  43. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/__main__.py +0 -0
  44. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/bootstrap.py +0 -0
  45. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/bootstrap_.py +0 -0
  46. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/commands/__init__.py +0 -0
  47. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/commands/base.py +0 -0
  48. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/commands/inject.py +0 -0
  49. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/commands/local.py +0 -0
  50. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/commands/marshal.py +0 -0
  51. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/commands/ping.py +0 -0
  52. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/commands/subprocess.py +0 -0
  53. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/commands/types.py +0 -0
  54. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/config.py +0 -0
  55. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/deploy/__init__.py +0 -0
  56. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/deploy/apps.py +0 -0
  57. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/deploy/commands.py +0 -0
  58. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/deploy/conf.py +0 -0
  59. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/deploy/config.py +0 -0
  60. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/deploy/deploy.py +0 -0
  61. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/deploy/driver.py +0 -0
  62. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/deploy/git.py +0 -0
  63. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/deploy/inject.py +0 -0
  64. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/deploy/interp.py +0 -0
  65. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/deploy/paths/__init__.py +0 -0
  66. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/deploy/paths/inject.py +0 -0
  67. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/deploy/paths/manager.py +0 -0
  68. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/deploy/paths/owners.py +0 -0
  69. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/deploy/paths/paths.py +0 -0
  70. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/deploy/paths/types.py +0 -0
  71. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/deploy/specs.py +0 -0
  72. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/deploy/tags.py +0 -0
  73. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/deploy/tmp.py +0 -0
  74. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/deploy/types.py +0 -0
  75. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/deploy/venvs.py +0 -0
  76. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/inject.py +0 -0
  77. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/marshal.py +0 -0
  78. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/remote/__init__.py +0 -0
  79. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/remote/_main.py +0 -0
  80. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/remote/channel.py +0 -0
  81. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/remote/config.py +0 -0
  82. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/remote/connection.py +0 -0
  83. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/remote/execution.py +0 -0
  84. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/remote/inject.py +0 -0
  85. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/remote/payload.py +0 -0
  86. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/system/__init__.py +0 -0
  87. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/system/commands.py +0 -0
  88. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/system/config.py +0 -0
  89. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/system/inject.py +0 -0
  90. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/system/packages.py +0 -0
  91. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/system/platforms.py +0 -0
  92. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/targets/__init__.py +0 -0
  93. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/targets/bestpython.py +0 -0
  94. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/targets/bestpython.sh +0 -0
  95. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/targets/connection.py +0 -0
  96. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/targets/inject.py +0 -0
  97. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/manage/targets/targets.py +0 -0
  98. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/pyremote.py +0 -0
  99. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/scripts/__init__.py +0 -0
  100. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/scripts/journald2aws.py +0 -0
  101. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/ssh.py +0 -0
  102. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/supervisor/LICENSE.txt +0 -0
  103. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/supervisor/__init__.py +0 -0
  104. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/supervisor/__main__.py +0 -0
  105. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/supervisor/configs.py +0 -0
  106. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/supervisor/dispatchers.py +0 -0
  107. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/supervisor/dispatchersimpl.py +0 -0
  108. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/supervisor/events.py +0 -0
  109. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/supervisor/exceptions.py +0 -0
  110. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/supervisor/groups.py +0 -0
  111. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/supervisor/groupsimpl.py +0 -0
  112. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/supervisor/inject.py +0 -0
  113. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/supervisor/io.py +0 -0
  114. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/supervisor/main.py +0 -0
  115. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/supervisor/pipes.py +0 -0
  116. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/supervisor/privileges.py +0 -0
  117. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/supervisor/process.py +0 -0
  118. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/supervisor/processimpl.py +0 -0
  119. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/supervisor/setup.py +0 -0
  120. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/supervisor/setupimpl.py +0 -0
  121. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/supervisor/signals.py +0 -0
  122. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/supervisor/spawning.py +0 -0
  123. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/supervisor/spawningimpl.py +0 -0
  124. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/supervisor/states.py +0 -0
  125. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/supervisor/supervisor.py +0 -0
  126. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/supervisor/types.py +0 -0
  127. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/supervisor/utils/__init__.py +0 -0
  128. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/supervisor/utils/collections.py +0 -0
  129. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/supervisor/utils/diag.py +0 -0
  130. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/supervisor/utils/fds.py +0 -0
  131. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/supervisor/utils/fs.py +0 -0
  132. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/supervisor/utils/os.py +0 -0
  133. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/supervisor/utils/ostypes.py +0 -0
  134. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/supervisor/utils/signals.py +0 -0
  135. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/supervisor/utils/strings.py +0 -0
  136. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/supervisor/utils/users.py +0 -0
  137. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/tailscale/__init__.py +0 -0
  138. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/tailscale/api.py +0 -0
  139. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/threadworkers.py +0 -0
  140. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/tools/__init__.py +0 -0
  141. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra/tools/listresources.py +0 -0
  142. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra.egg-info/dependency_links.txt +0 -0
  143. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra.egg-info/entry_points.txt +0 -0
  144. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/ominfra.egg-info/top_level.txt +0 -0
  145. {ominfra-0.0.0.dev179 → ominfra-0.0.0.dev180}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ominfra
3
- Version: 0.0.0.dev179
3
+ Version: 0.0.0.dev180
4
4
  Summary: ominfra
5
5
  Author: wrmsr
6
6
  License: BSD-3-Clause
@@ -12,8 +12,8 @@ Classifier: Operating System :: OS Independent
12
12
  Classifier: Operating System :: POSIX
13
13
  Requires-Python: >=3.12
14
14
  License-File: LICENSE
15
- Requires-Dist: omdev==0.0.0.dev179
16
- Requires-Dist: omlish==0.0.0.dev179
15
+ Requires-Dist: omdev==0.0.0.dev180
16
+ Requires-Dist: omlish==0.0.0.dev180
17
17
  Provides-Extra: all
18
18
  Requires-Dist: paramiko~=3.5; extra == "all"
19
19
  Requires-Dist: asyncssh~=2.18; extra == "all"
@@ -5,7 +5,7 @@ from . import metadata
5
5
 
6
6
 
7
7
  class Cli(ap.Cli):
8
- @ap.command(
8
+ @ap.cmd(
9
9
  ap.arg('key', nargs='*'),
10
10
  ap.arg('--url'),
11
11
  )
@@ -14,7 +14,7 @@ import typing as ta
14
14
 
15
15
  from omlish.argparse.cli import ArgparseCli
16
16
  from omlish.argparse.cli import argparse_arg
17
- from omlish.argparse.cli import argparse_command
17
+ from omlish.argparse.cli import argparse_cmd
18
18
  from omlish.lite.cached import cached_nullary
19
19
  from omlish.lite.check import check
20
20
  from omlish.lite.logs import log # noqa
@@ -55,7 +55,7 @@ class MainCli(ArgparseCli):
55
55
 
56
56
  #
57
57
 
58
- @argparse_command(
58
+ @argparse_cmd(
59
59
  argparse_arg('--_payload-file'),
60
60
 
61
61
  argparse_arg('--pycharm-debug-port', type=int),
@@ -9,7 +9,7 @@ import typing as ta
9
9
 
10
10
  from omlish.asyncs.asyncio.subprocesses import asyncio_subprocesses
11
11
  from omlish.lite.check import check
12
- from omlish.lite.shlex import shlex_maybe_quote
12
+ from omlish.shlex import shlex_maybe_quote
13
13
  from omlish.subprocesses import SUBPROCESS_CHANNEL_OPTION_VALUES
14
14
  from omlish.subprocesses import SubprocessChannelOption
15
15
 
@@ -111,7 +111,7 @@ CommandT = ta.TypeVar('CommandT', bound='Command')
111
111
  CommandOutputT = ta.TypeVar('CommandOutputT', bound='Command.Output')
112
112
 
113
113
  # ../../omlish/argparse/cli.py
114
- ArgparseCommandFn = ta.Callable[[], ta.Optional[int]] # ta.TypeAlias
114
+ ArgparseCmdFn = ta.Callable[[], ta.Optional[int]] # ta.TypeAlias
115
115
 
116
116
  # ../../omlish/lite/contextmanagers.py
117
117
  ExitStackedT = ta.TypeVar('ExitStackedT', bound='ExitStacked')
@@ -2766,21 +2766,6 @@ def read_package_resource_text(package: str, resource: str) -> str:
2766
2766
  return importlib.resources.read_text(package, resource)
2767
2767
 
2768
2768
 
2769
- ########################################
2770
- # ../../../omlish/lite/shlex.py
2771
-
2772
-
2773
- def shlex_needs_quote(s: str) -> bool:
2774
- return bool(s) and len(list(shlex.shlex(s))) > 1
2775
-
2776
-
2777
- def shlex_maybe_quote(s: str) -> str:
2778
- if shlex_needs_quote(s):
2779
- return shlex.quote(s)
2780
- else:
2781
- return s
2782
-
2783
-
2784
2769
  ########################################
2785
2770
  # ../../../omlish/lite/strings.py
2786
2771
 
@@ -3580,6 +3565,21 @@ def relative_symlink(
3580
3565
  )
3581
3566
 
3582
3567
 
3568
+ ########################################
3569
+ # ../../../omlish/shlex.py
3570
+
3571
+
3572
+ def shlex_needs_quote(s: str) -> bool:
3573
+ return bool(s) and len(list(shlex.shlex(s))) > 1
3574
+
3575
+
3576
+ def shlex_maybe_quote(s: str) -> str:
3577
+ if shlex_needs_quote(s):
3578
+ return shlex.quote(s)
3579
+ else:
3580
+ return s
3581
+
3582
+
3583
3583
  ########################################
3584
3584
  # ../../../omdev/packaging/specifiers.py
3585
3585
  # Copyright (c) Donald Stufft and individual contributors.
@@ -4546,15 +4546,15 @@ def argparse_arg(*args, **kwargs) -> ArgparseArg:
4546
4546
 
4547
4547
 
4548
4548
  @dc.dataclass(eq=False)
4549
- class ArgparseCommand:
4549
+ class ArgparseCmd:
4550
4550
  name: str
4551
- fn: ArgparseCommandFn
4551
+ fn: ArgparseCmdFn
4552
4552
  args: ta.Sequence[ArgparseArg] = () # noqa
4553
4553
 
4554
4554
  # _: dc.KW_ONLY
4555
4555
 
4556
4556
  aliases: ta.Optional[ta.Sequence[str]] = None
4557
- parent: ta.Optional['ArgparseCommand'] = None
4557
+ parent: ta.Optional['ArgparseCmd'] = None
4558
4558
  accepts_unknown: bool = False
4559
4559
 
4560
4560
  def __post_init__(self) -> None:
@@ -4569,7 +4569,7 @@ class ArgparseCommand:
4569
4569
 
4570
4570
  check.arg(callable(self.fn))
4571
4571
  check.arg(all(isinstance(a, ArgparseArg) for a in self.args))
4572
- check.isinstance(self.parent, (ArgparseCommand, type(None)))
4572
+ check.isinstance(self.parent, (ArgparseCmd, type(None)))
4573
4573
  check.isinstance(self.accepts_unknown, bool)
4574
4574
 
4575
4575
  functools.update_wrapper(self, self.fn)
@@ -4583,21 +4583,21 @@ class ArgparseCommand:
4583
4583
  return self.fn(*args, **kwargs)
4584
4584
 
4585
4585
 
4586
- def argparse_command(
4586
+ def argparse_cmd(
4587
4587
  *args: ArgparseArg,
4588
4588
  name: ta.Optional[str] = None,
4589
4589
  aliases: ta.Optional[ta.Iterable[str]] = None,
4590
- parent: ta.Optional[ArgparseCommand] = None,
4590
+ parent: ta.Optional[ArgparseCmd] = None,
4591
4591
  accepts_unknown: bool = False,
4592
- ) -> ta.Any: # ta.Callable[[ArgparseCommandFn], ArgparseCommand]: # FIXME
4592
+ ) -> ta.Any: # ta.Callable[[ArgparseCmdFn], ArgparseCmd]: # FIXME
4593
4593
  for arg in args:
4594
4594
  check.isinstance(arg, ArgparseArg)
4595
4595
  check.isinstance(name, (str, type(None)))
4596
- check.isinstance(parent, (ArgparseCommand, type(None)))
4596
+ check.isinstance(parent, (ArgparseCmd, type(None)))
4597
4597
  check.not_isinstance(aliases, str)
4598
4598
 
4599
4599
  def inner(fn):
4600
- return ArgparseCommand(
4600
+ return ArgparseCmd(
4601
4601
  (name if name is not None else fn.__name__).replace('_', '-'),
4602
4602
  fn,
4603
4603
  args,
@@ -4652,7 +4652,7 @@ class ArgparseCli:
4652
4652
  for bns in [bcls.__dict__ for bcls in reversed(mro)] + [ns]:
4653
4653
  bseen = set() # type: ignore
4654
4654
  for k, v in bns.items():
4655
- if isinstance(v, (ArgparseCommand, ArgparseArg)):
4655
+ if isinstance(v, (ArgparseCmd, ArgparseArg)):
4656
4656
  check.not_in(v, bseen)
4657
4657
  bseen.add(v)
4658
4658
  objs[k] = v
@@ -4679,7 +4679,7 @@ class ArgparseCli:
4679
4679
  subparsers = parser.add_subparsers()
4680
4680
 
4681
4681
  for att, obj in objs.items():
4682
- if isinstance(obj, ArgparseCommand):
4682
+ if isinstance(obj, ArgparseCmd):
4683
4683
  if obj.parent is not None:
4684
4684
  raise NotImplementedError
4685
4685
 
@@ -4741,7 +4741,7 @@ class ArgparseCli:
4741
4741
 
4742
4742
  #
4743
4743
 
4744
- def _bind_cli_cmd(self, cmd: ArgparseCommand) -> ta.Callable:
4744
+ def _bind_cli_cmd(self, cmd: ArgparseCmd) -> ta.Callable:
4745
4745
  return cmd.__get__(self, type(self))
4746
4746
 
4747
4747
  def prepare_cli_run(self) -> ta.Optional[ta.Callable]:
@@ -11570,7 +11570,7 @@ class MainCli(ArgparseCli):
11570
11570
 
11571
11571
  #
11572
11572
 
11573
- @argparse_command(
11573
+ @argparse_cmd(
11574
11574
  argparse_arg('--_payload-file'),
11575
11575
 
11576
11576
  argparse_arg('--pycharm-debug-port', type=int),
@@ -113,15 +113,14 @@ CheckOnRaiseFn = ta.Callable[[Exception], None] # ta.TypeAlias
113
113
  CheckExceptionFactory = ta.Callable[..., Exception] # ta.TypeAlias
114
114
  CheckArgsRenderer = ta.Callable[..., ta.Optional[str]] # ta.TypeAlias
115
115
 
116
- # ../../omlish/lite/socket.py
117
- SocketAddress = ta.Any
118
- SocketHandlerFactory = ta.Callable[[SocketAddress, ta.BinaryIO, ta.BinaryIO], 'SocketHandler']
119
-
120
116
  # ../../omlish/lite/typing.py
121
117
  A0 = ta.TypeVar('A0')
122
118
  A1 = ta.TypeVar('A1')
123
119
  A2 = ta.TypeVar('A2')
124
120
 
121
+ # ../../omlish/sockets/addresses.py
122
+ SocketAddress = ta.Any
123
+
125
124
  # events.py
126
125
  EventCallback = ta.Callable[['Event'], None]
127
126
  ProcessOutputChannel = ta.Literal['stdout', 'stderr'] # ta.TypeAlias
@@ -139,6 +138,9 @@ InjectorProviderFn = ta.Callable[['Injector'], ta.Any]
139
138
  InjectorProviderFnMap = ta.Mapping['InjectorKey', 'InjectorProviderFn']
140
139
  InjectorBindingOrBindings = ta.Union['InjectorBinding', 'InjectorBindings']
141
140
 
141
+ # ../../omlish/sockets/handlers.py
142
+ SocketHandlerFactory = ta.Callable[[SocketAddress, ta.BinaryIO, ta.BinaryIO], 'SocketHandler']
143
+
142
144
  # ../configs.py
143
145
  ConfigMapping = ta.Mapping[str, ta.Any]
144
146
 
@@ -2344,76 +2346,6 @@ def deep_subclasses(cls: ta.Type[T]) -> ta.Iterator[ta.Type[T]]:
2344
2346
  todo.extend(reversed(cur.__subclasses__()))
2345
2347
 
2346
2348
 
2347
- ########################################
2348
- # ../../../omlish/lite/socket.py
2349
- """
2350
- TODO:
2351
- - SocketClientAddress family / tuple pairs
2352
- + codification of https://docs.python.org/3/library/socket.html#socket-families
2353
- """
2354
-
2355
-
2356
- ##
2357
-
2358
-
2359
- @dc.dataclass(frozen=True)
2360
- class SocketAddressInfoArgs:
2361
- host: ta.Optional[str]
2362
- port: ta.Union[str, int, None]
2363
- family: socket.AddressFamily = socket.AddressFamily.AF_UNSPEC
2364
- type: int = 0
2365
- proto: int = 0
2366
- flags: socket.AddressInfo = socket.AddressInfo(0)
2367
-
2368
-
2369
- @dc.dataclass(frozen=True)
2370
- class SocketAddressInfo:
2371
- family: socket.AddressFamily
2372
- type: int
2373
- proto: int
2374
- canonname: ta.Optional[str]
2375
- sockaddr: SocketAddress
2376
-
2377
-
2378
- def get_best_socket_family(
2379
- host: ta.Optional[str],
2380
- port: ta.Union[str, int, None],
2381
- family: ta.Union[int, socket.AddressFamily] = socket.AddressFamily.AF_UNSPEC,
2382
- ) -> ta.Tuple[socket.AddressFamily, SocketAddress]:
2383
- """https://github.com/python/cpython/commit/f289084c83190cc72db4a70c58f007ec62e75247"""
2384
-
2385
- infos = socket.getaddrinfo(
2386
- host,
2387
- port,
2388
- family,
2389
- type=socket.SOCK_STREAM,
2390
- flags=socket.AI_PASSIVE,
2391
- )
2392
- ai = SocketAddressInfo(*next(iter(infos)))
2393
- return ai.family, ai.sockaddr
2394
-
2395
-
2396
- ##
2397
-
2398
-
2399
- class SocketHandler(abc.ABC):
2400
- def __init__(
2401
- self,
2402
- client_address: SocketAddress,
2403
- rfile: ta.BinaryIO,
2404
- wfile: ta.BinaryIO,
2405
- ) -> None:
2406
- super().__init__()
2407
-
2408
- self._client_address = client_address
2409
- self._rfile = rfile
2410
- self._wfile = wfile
2411
-
2412
- @abc.abstractmethod
2413
- def handle(self) -> None:
2414
- raise NotImplementedError
2415
-
2416
-
2417
2349
  ########################################
2418
2350
  # ../../../omlish/lite/strings.py
2419
2351
 
@@ -2670,6 +2602,55 @@ class ProxyLogHandler(ProxyLogFilterer, logging.Handler):
2670
2602
  self._underlying.handleError(record)
2671
2603
 
2672
2604
 
2605
+ ########################################
2606
+ # ../../../omlish/sockets/addresses.py
2607
+ """
2608
+ TODO:
2609
+ - SocketClientAddress family / tuple pairs
2610
+ + codification of https://docs.python.org/3/library/socket.html#socket-families
2611
+ """
2612
+
2613
+
2614
+ ##
2615
+
2616
+
2617
+ @dc.dataclass(frozen=True)
2618
+ class SocketAddressInfoArgs:
2619
+ host: ta.Optional[str]
2620
+ port: ta.Union[str, int, None]
2621
+ family: socket.AddressFamily = socket.AddressFamily.AF_UNSPEC
2622
+ type: int = 0
2623
+ proto: int = 0
2624
+ flags: socket.AddressInfo = socket.AddressInfo(0)
2625
+
2626
+
2627
+ @dc.dataclass(frozen=True)
2628
+ class SocketAddressInfo:
2629
+ family: socket.AddressFamily
2630
+ type: int
2631
+ proto: int
2632
+ canonname: ta.Optional[str]
2633
+ sockaddr: SocketAddress
2634
+
2635
+
2636
+ def get_best_socket_family(
2637
+ host: ta.Optional[str],
2638
+ port: ta.Union[str, int, None],
2639
+ family: ta.Union[int, socket.AddressFamily] = socket.AddressFamily.AF_UNSPEC,
2640
+ ) -> ta.Tuple[socket.AddressFamily, SocketAddress]:
2641
+ """https://github.com/python/cpython/commit/f289084c83190cc72db4a70c58f007ec62e75247"""
2642
+
2643
+ infos = socket.getaddrinfo(
2644
+ host,
2645
+ port,
2646
+ family,
2647
+ type=socket.SOCK_STREAM,
2648
+ flags=socket.AI_PASSIVE,
2649
+ )
2650
+ ai = SocketAddressInfo(*next(iter(infos)))
2651
+ return ai.family, ai.sockaddr
2652
+
2653
+
2673
2654
  ########################################
2674
2655
  # ../events.py
2675
2656
 
@@ -5829,6 +5810,31 @@ def journald_log_handler_factory(
5829
5810
  return logging.StreamHandler()
5830
5811
 
5831
5812
 
5813
+ ########################################
5814
+ # ../../../omlish/sockets/handlers.py
5815
+
5816
+
5817
+ ##
5818
+
5819
+
5820
+ class SocketHandler(abc.ABC):
5821
+ def __init__(
5822
+ self,
5823
+ client_address: SocketAddress,
5824
+ rfile: ta.BinaryIO,
5825
+ wfile: ta.BinaryIO,
5826
+ ) -> None:
5827
+ super().__init__()
5828
+
5829
+ self._client_address = client_address
5830
+ self._rfile = rfile
5831
+ self._wfile = wfile
5832
+
5833
+ @abc.abstractmethod
5834
+ def handle(self) -> None:
5835
+ raise NotImplementedError
5836
+
5837
+
5832
5838
  ########################################
5833
5839
  # ../../configs.py
5834
5840
 
@@ -12,7 +12,7 @@ from omlish.io.fdio.handlers import SocketFdioHandler
12
12
  from omlish.lite.check import check
13
13
  from omlish.lite.contextmanagers import defer
14
14
  from omlish.lite.json import JSON_PRETTY_KWARGS
15
- from omlish.lite.socket import SocketAddress
15
+ from omlish.sockets.addresses import SocketAddress
16
16
 
17
17
  from .dispatchers import Dispatchers
18
18
  from .groups import ProcessGroupManager
@@ -0,0 +1,18 @@
1
+ # @omlish-lite
2
+ import io
3
+ import typing as ta
4
+
5
+
6
+ def render_systemd_unit(settings_by_section: ta.Mapping[str, ta.Mapping[str, str]]) -> str:
7
+ out = io.StringIO()
8
+
9
+ for i, (section, settings) in enumerate(settings_by_section.items()):
10
+ if i:
11
+ out.write('\n')
12
+
13
+ out.write(f'[{section}]\n')
14
+
15
+ for k, v in settings.items():
16
+ out.write(f'{k}={v}\n')
17
+
18
+ return out.getvalue()
@@ -72,7 +72,7 @@ class Cli(ap.Cli):
72
72
  else:
73
73
  return 'tailscale'
74
74
 
75
- @ap.command(name='bin')
75
+ @ap.cmd(name='bin')
76
76
  def bin_cmd(self) -> None:
77
77
  print(self.bin())
78
78
 
@@ -84,7 +84,7 @@ class Cli(ap.Cli):
84
84
  ])
85
85
  return msh.unmarshal(json.loads(stdout.decode()), CliStatus)
86
86
 
87
- @ap.command(
87
+ @ap.cmd(
88
88
  ap.arg('name', nargs='?'),
89
89
  name='status',
90
90
  )
@@ -97,14 +97,14 @@ class Cli(ap.Cli):
97
97
  out = status
98
98
  print(json.dumps_pretty(msh.marshal(out)))
99
99
 
100
- @ap.command()
100
+ @ap.cmd()
101
101
  def ips(self) -> None:
102
102
  print(json.dumps_pretty({
103
103
  hn: node.ipv4s
104
104
  for hn, node in self.status().nodes_by_host_name.items()
105
105
  }))
106
106
 
107
- @ap.command(
107
+ @ap.cmd(
108
108
  ap.arg('name', nargs='?'),
109
109
  )
110
110
  def ip(self) -> None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ominfra
3
- Version: 0.0.0.dev179
3
+ Version: 0.0.0.dev180
4
4
  Summary: ominfra
5
5
  Author: wrmsr
6
6
  License: BSD-3-Clause
@@ -12,8 +12,8 @@ Classifier: Operating System :: OS Independent
12
12
  Classifier: Operating System :: POSIX
13
13
  Requires-Python: >=3.12
14
14
  License-File: LICENSE
15
- Requires-Dist: omdev==0.0.0.dev179
16
- Requires-Dist: omlish==0.0.0.dev179
15
+ Requires-Dist: omdev==0.0.0.dev180
16
+ Requires-Dist: omlish==0.0.0.dev180
17
17
  Provides-Extra: all
18
18
  Requires-Dist: paramiko~=3.5; extra == "all"
19
19
  Requires-Dist: asyncssh~=2.18; extra == "all"
@@ -9,6 +9,7 @@ ominfra/cmds.py
9
9
  ominfra/configs.py
10
10
  ominfra/pyremote.py
11
11
  ominfra/ssh.py
12
+ ominfra/systemd.py
12
13
  ominfra/threadworkers.py
13
14
  ominfra.egg-info/PKG-INFO
14
15
  ominfra.egg-info/SOURCES.txt
@@ -1,5 +1,5 @@
1
- omdev==0.0.0.dev179
2
- omlish==0.0.0.dev179
1
+ omdev==0.0.0.dev180
2
+ omlish==0.0.0.dev180
3
3
 
4
4
  [all]
5
5
  paramiko~=3.5
@@ -12,7 +12,7 @@ authors = [
12
12
  urls = {source = 'https://github.com/wrmsr/omlish'}
13
13
  license = {text = 'BSD-3-Clause'}
14
14
  requires-python = '>=3.12'
15
- version = '0.0.0.dev179'
15
+ version = '0.0.0.dev180'
16
16
  classifiers = [
17
17
  'License :: OSI Approved :: BSD License',
18
18
  'Development Status :: 2 - Pre-Alpha',
@@ -22,8 +22,8 @@ classifiers = [
22
22
  ]
23
23
  description = 'ominfra'
24
24
  dependencies = [
25
- 'omdev == 0.0.0.dev179',
26
- 'omlish == 0.0.0.dev179',
25
+ 'omdev == 0.0.0.dev180',
26
+ 'omlish == 0.0.0.dev180',
27
27
  ]
28
28
 
29
29
  [project.optional-dependencies]
File without changes
File without changes