ominfra 0.0.0.dev176__tar.gz → 0.0.0.dev177__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. {ominfra-0.0.0.dev176/ominfra.egg-info → ominfra-0.0.0.dev177}/PKG-INFO +3 -3
  2. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/deploy/apps.py +7 -8
  3. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/deploy/conf.py +0 -12
  4. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/deploy/config.py +1 -2
  5. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/deploy/deploy.py +13 -0
  6. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/deploy/git.py +24 -9
  7. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/deploy/inject.py +7 -8
  8. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/deploy/paths/manager.py +0 -3
  9. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/deploy/paths/owners.py +4 -10
  10. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/deploy/specs.py +5 -0
  11. ominfra-0.0.0.dev177/ominfra/manage/deploy/tmp.py +27 -0
  12. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/deploy/venvs.py +2 -10
  13. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/main.py +1 -7
  14. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/scripts/manage.py +175 -193
  15. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177/ominfra.egg-info}/PKG-INFO +3 -3
  16. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra.egg-info/requires.txt +2 -2
  17. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/pyproject.toml +3 -3
  18. ominfra-0.0.0.dev176/ominfra/manage/deploy/tmp.py +0 -46
  19. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/LICENSE +0 -0
  20. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/MANIFEST.in +0 -0
  21. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/README.rst +0 -0
  22. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/.manifests.json +0 -0
  23. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/__about__.py +0 -0
  24. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/__init__.py +0 -0
  25. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/clouds/__init__.py +0 -0
  26. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/clouds/aws/__init__.py +0 -0
  27. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/clouds/aws/__main__.py +0 -0
  28. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/clouds/aws/auth.py +0 -0
  29. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/clouds/aws/cli.py +0 -0
  30. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/clouds/aws/dataclasses.py +0 -0
  31. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/clouds/aws/journald2aws/__init__.py +0 -0
  32. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/clouds/aws/journald2aws/__main__.py +0 -0
  33. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/clouds/aws/journald2aws/cursor.py +0 -0
  34. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/clouds/aws/journald2aws/driver.py +0 -0
  35. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/clouds/aws/journald2aws/main.py +0 -0
  36. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/clouds/aws/journald2aws/poster.py +0 -0
  37. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/clouds/aws/logs.py +0 -0
  38. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/clouds/aws/metadata.py +0 -0
  39. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/clouds/gcp/__init__.py +0 -0
  40. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/clouds/gcp/auth.py +0 -0
  41. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/cmds.py +0 -0
  42. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/configs.py +0 -0
  43. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/journald/__init__.py +0 -0
  44. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/journald/fields.py +0 -0
  45. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/journald/genmessages.py +0 -0
  46. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/journald/messages.py +0 -0
  47. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/journald/tailer.py +0 -0
  48. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/__init__.py +0 -0
  49. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/__main__.py +0 -0
  50. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/bootstrap.py +0 -0
  51. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/bootstrap_.py +0 -0
  52. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/commands/__init__.py +0 -0
  53. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/commands/base.py +0 -0
  54. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/commands/inject.py +0 -0
  55. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/commands/local.py +0 -0
  56. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/commands/marshal.py +0 -0
  57. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/commands/ping.py +0 -0
  58. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/commands/subprocess.py +0 -0
  59. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/commands/types.py +0 -0
  60. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/config.py +0 -0
  61. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/deploy/__init__.py +0 -0
  62. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/deploy/commands.py +0 -0
  63. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/deploy/interp.py +0 -0
  64. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/deploy/paths/__init__.py +0 -0
  65. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/deploy/paths/inject.py +0 -0
  66. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/deploy/paths/paths.py +0 -0
  67. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/deploy/paths/types.py +0 -0
  68. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/deploy/tags.py +0 -0
  69. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/deploy/types.py +0 -0
  70. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/inject.py +0 -0
  71. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/marshal.py +0 -0
  72. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/remote/__init__.py +0 -0
  73. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/remote/_main.py +0 -0
  74. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/remote/channel.py +0 -0
  75. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/remote/config.py +0 -0
  76. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/remote/connection.py +0 -0
  77. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/remote/execution.py +0 -0
  78. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/remote/inject.py +0 -0
  79. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/remote/payload.py +0 -0
  80. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/remote/spawning.py +0 -0
  81. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/system/__init__.py +0 -0
  82. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/system/commands.py +0 -0
  83. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/system/config.py +0 -0
  84. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/system/inject.py +0 -0
  85. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/system/packages.py +0 -0
  86. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/system/platforms.py +0 -0
  87. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/targets/__init__.py +0 -0
  88. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/targets/bestpython.py +0 -0
  89. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/targets/bestpython.sh +0 -0
  90. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/targets/connection.py +0 -0
  91. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/targets/inject.py +0 -0
  92. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/manage/targets/targets.py +0 -0
  93. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/pyremote.py +0 -0
  94. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/scripts/__init__.py +0 -0
  95. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/scripts/journald2aws.py +0 -0
  96. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/scripts/supervisor.py +0 -0
  97. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/ssh.py +0 -0
  98. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/supervisor/LICENSE.txt +0 -0
  99. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/supervisor/__init__.py +0 -0
  100. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/supervisor/__main__.py +0 -0
  101. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/supervisor/configs.py +0 -0
  102. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/supervisor/dispatchers.py +0 -0
  103. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/supervisor/dispatchersimpl.py +0 -0
  104. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/supervisor/events.py +0 -0
  105. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/supervisor/exceptions.py +0 -0
  106. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/supervisor/groups.py +0 -0
  107. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/supervisor/groupsimpl.py +0 -0
  108. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/supervisor/http.py +0 -0
  109. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/supervisor/inject.py +0 -0
  110. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/supervisor/io.py +0 -0
  111. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/supervisor/main.py +0 -0
  112. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/supervisor/pipes.py +0 -0
  113. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/supervisor/privileges.py +0 -0
  114. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/supervisor/process.py +0 -0
  115. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/supervisor/processimpl.py +0 -0
  116. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/supervisor/setup.py +0 -0
  117. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/supervisor/setupimpl.py +0 -0
  118. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/supervisor/signals.py +0 -0
  119. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/supervisor/spawning.py +0 -0
  120. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/supervisor/spawningimpl.py +0 -0
  121. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/supervisor/states.py +0 -0
  122. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/supervisor/supervisor.py +0 -0
  123. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/supervisor/types.py +0 -0
  124. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/supervisor/utils/__init__.py +0 -0
  125. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/supervisor/utils/collections.py +0 -0
  126. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/supervisor/utils/diag.py +0 -0
  127. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/supervisor/utils/fds.py +0 -0
  128. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/supervisor/utils/fs.py +0 -0
  129. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/supervisor/utils/os.py +0 -0
  130. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/supervisor/utils/ostypes.py +0 -0
  131. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/supervisor/utils/signals.py +0 -0
  132. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/supervisor/utils/strings.py +0 -0
  133. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/supervisor/utils/users.py +0 -0
  134. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/tailscale/__init__.py +0 -0
  135. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/tailscale/api.py +0 -0
  136. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/tailscale/cli.py +0 -0
  137. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/threadworkers.py +0 -0
  138. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/tools/__init__.py +0 -0
  139. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra/tools/listresources.py +0 -0
  140. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra.egg-info/SOURCES.txt +0 -0
  141. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra.egg-info/dependency_links.txt +0 -0
  142. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra.egg-info/entry_points.txt +0 -0
  143. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/ominfra.egg-info/top_level.txt +0 -0
  144. {ominfra-0.0.0.dev176 → ominfra-0.0.0.dev177}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ominfra
3
- Version: 0.0.0.dev176
3
+ Version: 0.0.0.dev177
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.dev176
16
- Requires-Dist: omlish==0.0.0.dev176
15
+ Requires-Dist: omdev==0.0.0.dev177
16
+ Requires-Dist: omlish==0.0.0.dev177
17
17
  Provides-Extra: all
18
18
  Requires-Dist: paramiko~=3.5; extra == "all"
19
19
  Requires-Dist: asyncssh~=2.18; extra == "all"
@@ -20,16 +20,12 @@ class DeployAppManager(DeployPathOwner):
20
20
  def __init__(
21
21
  self,
22
22
  *,
23
- deploy_home: ta.Optional[DeployHome] = None,
24
-
25
23
  conf: DeployConfManager,
26
24
  git: DeployGitManager,
27
25
  venvs: DeployVenvManager,
28
26
  ) -> None:
29
27
  super().__init__()
30
28
 
31
- self._deploy_home = deploy_home
32
-
33
29
  self._conf = conf
34
30
  self._git = git
35
31
  self._venvs = venvs
@@ -70,12 +66,13 @@ class DeployAppManager(DeployPathOwner):
70
66
  async def prepare_app(
71
67
  self,
72
68
  spec: DeployAppSpec,
69
+ home: DeployHome,
73
70
  tags: DeployTagMap,
74
71
  ) -> None:
75
- deploy_home = check.non_empty_str(self._deploy_home)
72
+ check.non_empty_str(home)
76
73
 
77
74
  def build_path(pth: DeployPath) -> str:
78
- return os.path.join(deploy_home, pth.render(tags))
75
+ return os.path.join(home, pth.render(tags))
79
76
 
80
77
  app_dir = build_path(self._APP_DIR)
81
78
  deploy_dir = build_path(self._DEPLOY_DIR)
@@ -85,7 +82,7 @@ class DeployAppManager(DeployPathOwner):
85
82
 
86
83
  os.makedirs(deploy_dir, exist_ok=True)
87
84
 
88
- deploying_link = os.path.join(deploy_home, 'deploys/deploying')
85
+ deploying_link = os.path.join(home, 'deploys/deploying')
89
86
  if os.path.exists(deploying_link):
90
87
  os.unlink(deploying_link)
91
88
  relative_symlink(
@@ -132,7 +129,7 @@ class DeployAppManager(DeployPathOwner):
132
129
  # else:
133
130
  # os.makedirs(os.path.join(dst, os.path.relpath(dp2, src)))
134
131
 
135
- current_link = os.path.join(deploy_home, 'deploys/current')
132
+ current_link = os.path.join(home, 'deploys/current')
136
133
 
137
134
  # if os.path.exists(current_link):
138
135
  # mirror_symlinks(
@@ -149,6 +146,7 @@ class DeployAppManager(DeployPathOwner):
149
146
  app_git_dir = os.path.join(app_dir, 'git')
150
147
  await self._git.checkout(
151
148
  spec.git,
149
+ home,
152
150
  app_git_dir,
153
151
  )
154
152
 
@@ -158,6 +156,7 @@ class DeployAppManager(DeployPathOwner):
158
156
  app_venv_dir = os.path.join(app_dir, 'venv')
159
157
  await self._venvs.setup_venv(
160
158
  spec.venv,
159
+ home,
161
160
  app_git_dir,
162
161
  app_venv_dir,
163
162
  )
@@ -31,21 +31,9 @@ from .tags import DEPLOY_TAG_SEPARATOR
31
31
  from .tags import DeployApp
32
32
  from .tags import DeployConf
33
33
  from .tags import DeployTagMap
34
- from .types import DeployHome
35
34
 
36
35
 
37
36
  class DeployConfManager:
38
- def __init__(
39
- self,
40
- *,
41
- deploy_home: ta.Optional[DeployHome] = None,
42
- ) -> None:
43
- super().__init__()
44
-
45
- self._deploy_home = deploy_home
46
-
47
- #
48
-
49
37
  async def _write_app_conf_file(
50
38
  self,
51
39
  acf: DeployAppConfFile,
@@ -1,6 +1,5 @@
1
1
  # ruff: noqa: UP006 UP007
2
2
  import dataclasses as dc
3
- import typing as ta
4
3
 
5
4
 
6
5
  ##
@@ -8,4 +7,4 @@ import typing as ta
8
7
 
9
8
  @dc.dataclass(frozen=True)
10
9
  class DeployConfig:
11
- deploy_home: ta.Optional[str] = None
10
+ pass
@@ -1,7 +1,9 @@
1
1
  # ruff: noqa: UP006 UP007
2
2
  import datetime
3
+ import os.path
3
4
  import typing as ta
4
5
 
6
+ from omlish.lite.check import check
5
7
  from omlish.lite.typing import Func0
6
8
 
7
9
  from .apps import DeployAppManager
@@ -10,6 +12,7 @@ from .specs import DeploySpec
10
12
  from .tags import DeployAppRev
11
13
  from .tags import DeployTagMap
12
14
  from .tags import DeployTime
15
+ from .types import DeployHome
13
16
 
14
17
 
15
18
  DEPLOY_TAG_DATETIME_FMT = '%Y%m%dT%H%M%SZ'
@@ -51,6 +54,15 @@ class DeployManager:
51
54
 
52
55
  #
53
56
 
57
+ hs = check.non_empty_str(spec.home)
58
+ hs = os.path.expanduser(hs)
59
+ hs = os.path.realpath(hs)
60
+ hs = os.path.abspath(hs)
61
+
62
+ home = DeployHome(hs)
63
+
64
+ #
65
+
54
66
  deploy_tags = DeployTagMap(
55
67
  self._make_deploy_time(),
56
68
  spec.key(),
@@ -67,5 +79,6 @@ class DeployManager:
67
79
 
68
80
  await self._apps.prepare_app(
69
81
  app,
82
+ home,
70
83
  app_tags,
71
84
  )
@@ -15,11 +15,11 @@ import typing as ta
15
15
  from omlish.asyncs.asyncio.subprocesses import asyncio_subprocesses
16
16
  from omlish.lite.cached import async_cached_nullary
17
17
  from omlish.lite.check import check
18
- from omlish.os.atomics import AtomicPathSwapping
19
18
 
20
19
  from .paths.owners import SingleDirDeployPathOwner
21
20
  from .specs import DeployGitRepo
22
21
  from .specs import DeployGitSpec
22
+ from .tmp import DeployHomeAtomics
23
23
  from .types import DeployHome
24
24
  from .types import DeployRev
25
25
 
@@ -31,12 +31,10 @@ class DeployGitManager(SingleDirDeployPathOwner):
31
31
  def __init__(
32
32
  self,
33
33
  *,
34
- deploy_home: ta.Optional[DeployHome] = None,
35
- atomics: AtomicPathSwapping,
34
+ atomics: DeployHomeAtomics,
36
35
  ) -> None:
37
36
  super().__init__(
38
37
  owned_dir='git',
39
- deploy_home=deploy_home,
40
38
  )
41
39
 
42
40
  self._atomics = atomics
@@ -48,13 +46,15 @@ class DeployGitManager(SingleDirDeployPathOwner):
48
46
  self,
49
47
  git: 'DeployGitManager',
50
48
  repo: DeployGitRepo,
49
+ home: DeployHome,
51
50
  ) -> None:
52
51
  super().__init__()
53
52
 
54
53
  self._git = git
55
54
  self._repo = repo
55
+ self._home = home
56
56
  self._dir = os.path.join(
57
- self._git._make_dir(), # noqa
57
+ self._git._make_dir(home), # noqa
58
58
  check.non_empty_str(repo.host),
59
59
  check.non_empty_str(repo.path),
60
60
  )
@@ -97,7 +97,7 @@ class DeployGitManager(SingleDirDeployPathOwner):
97
97
 
98
98
  async def checkout(self, spec: DeployGitSpec, dst_dir: str) -> None:
99
99
  check.state(not os.path.exists(dst_dir))
100
- with self._git._atomics.begin_atomic_path_swap( # noqa
100
+ with self._git._atomics(self._home).begin_atomic_path_swap( # noqa
101
101
  'dir',
102
102
  dst_dir,
103
103
  auto_commit=True,
@@ -112,16 +112,31 @@ class DeployGitManager(SingleDirDeployPathOwner):
112
112
  await dst_call('git', 'fetch', '--depth=1', 'local', spec.rev)
113
113
  await dst_call('git', 'checkout', spec.rev, *(spec.subtrees or []))
114
114
 
115
- def get_repo_dir(self, repo: DeployGitRepo) -> RepoDir:
115
+ def get_repo_dir(
116
+ self,
117
+ repo: DeployGitRepo,
118
+ home: DeployHome,
119
+ ) -> RepoDir:
116
120
  try:
117
121
  return self._repo_dirs[repo]
118
122
  except KeyError:
119
- repo_dir = self._repo_dirs[repo] = DeployGitManager.RepoDir(self, repo)
123
+ repo_dir = self._repo_dirs[repo] = DeployGitManager.RepoDir(
124
+ self,
125
+ repo,
126
+ home,
127
+ )
120
128
  return repo_dir
121
129
 
122
130
  async def checkout(
123
131
  self,
124
132
  spec: DeployGitSpec,
133
+ home: DeployHome,
125
134
  dst_dir: str,
126
135
  ) -> None:
127
- await self.get_repo_dir(spec.repo).checkout(spec, dst_dir)
136
+ await self.get_repo_dir(
137
+ spec.repo,
138
+ home,
139
+ ).checkout(
140
+ spec,
141
+ dst_dir,
142
+ )
@@ -1,11 +1,9 @@
1
1
  # ruff: noqa: UP006 UP007
2
- import os.path
3
2
  import typing as ta
4
3
 
5
4
  from omlish.lite.inject import InjectorBindingOrBindings
6
5
  from omlish.lite.inject import InjectorBindings
7
6
  from omlish.lite.inject import inj
8
- from omlish.os.atomics import AtomicPathSwapping
9
7
 
10
8
  from ..commands.inject import bind_command
11
9
  from .apps import DeployAppManager
@@ -19,8 +17,8 @@ from .interp import InterpCommand
19
17
  from .interp import InterpCommandExecutor
20
18
  from .paths.inject import bind_deploy_paths
21
19
  from .paths.owners import DeployPathOwner
20
+ from .tmp import DeployHomeAtomics
22
21
  from .tmp import DeployTmpManager
23
- from .types import DeployHome
24
22
  from .venvs import DeployVenvManager
25
23
 
26
24
 
@@ -55,13 +53,18 @@ def bind_deploy(
55
53
  bind_manager(DeployManager),
56
54
 
57
55
  bind_manager(DeployTmpManager),
58
- inj.bind(AtomicPathSwapping, to_key=DeployTmpManager),
59
56
 
60
57
  bind_manager(DeployVenvManager),
61
58
  ])
62
59
 
63
60
  #
64
61
 
62
+ def provide_deploy_home_atomics(tmp: DeployTmpManager) -> DeployHomeAtomics:
63
+ return DeployHomeAtomics(tmp.get_swapping)
64
+ lst.append(inj.bind(provide_deploy_home_atomics, singleton=True))
65
+
66
+ #
67
+
65
68
  lst.extend([
66
69
  bind_command(DeployCommand, DeployCommandExecutor),
67
70
  bind_command(InterpCommand, InterpCommandExecutor),
@@ -69,8 +72,4 @@ def bind_deploy(
69
72
 
70
73
  #
71
74
 
72
- if (dh := deploy_config.deploy_home) is not None:
73
- dh = os.path.abspath(os.path.expanduser(dh))
74
- lst.append(inj.bind(dh, key=DeployHome))
75
-
76
75
  return inj.as_bindings(*lst)
@@ -3,7 +3,6 @@ import typing as ta
3
3
 
4
4
  from omlish.lite.cached import cached_nullary
5
5
 
6
- from ..types import DeployHome
7
6
  from .owners import DeployPathOwner
8
7
  from .owners import DeployPathOwners
9
8
  from .paths import DeployPath
@@ -14,12 +13,10 @@ class DeployPathsManager:
14
13
  def __init__(
15
14
  self,
16
15
  *,
17
- deploy_home: ta.Optional[DeployHome],
18
16
  deploy_path_owners: DeployPathOwners,
19
17
  ) -> None:
20
18
  super().__init__()
21
19
 
22
- self._deploy_home = deploy_home
23
20
  self._deploy_path_owners = deploy_path_owners
24
21
 
25
22
  @cached_nullary
@@ -3,7 +3,6 @@ import abc
3
3
  import os.path
4
4
  import typing as ta
5
5
 
6
- from omlish.lite.cached import cached_nullary
7
6
  from omlish.lite.check import check
8
7
 
9
8
  from ..types import DeployHome
@@ -24,7 +23,6 @@ class SingleDirDeployPathOwner(DeployPathOwner, abc.ABC):
24
23
  self,
25
24
  *args: ta.Any,
26
25
  owned_dir: str,
27
- deploy_home: ta.Optional[DeployHome],
28
26
  **kwargs: ta.Any,
29
27
  ) -> None:
30
28
  super().__init__(*args, **kwargs)
@@ -32,17 +30,13 @@ class SingleDirDeployPathOwner(DeployPathOwner, abc.ABC):
32
30
  check.not_in('/', owned_dir)
33
31
  self._owned_dir: str = check.non_empty_str(owned_dir)
34
32
 
35
- self._deploy_home = deploy_home
36
-
37
33
  self._owned_deploy_paths = frozenset([DeployPath.parse(self._owned_dir + '/')])
38
34
 
39
- @cached_nullary
40
- def _dir(self) -> str:
41
- return os.path.join(check.non_empty_str(self._deploy_home), self._owned_dir)
35
+ def _dir(self, home: DeployHome) -> str:
36
+ return os.path.join(check.non_empty_str(home), self._owned_dir)
42
37
 
43
- @cached_nullary
44
- def _make_dir(self) -> str:
45
- if not os.path.isdir(d := self._dir()):
38
+ def _make_dir(self, home: DeployHome) -> str:
39
+ if not os.path.isdir(d := self._dir(home)):
46
40
  os.makedirs(d, exist_ok=True)
47
41
  return d
48
42
 
@@ -11,6 +11,7 @@ from .tags import DeployApp
11
11
  from .tags import DeployAppKey
12
12
  from .tags import DeployKey
13
13
  from .tags import KeyDeployTag # noqa
14
+ from .types import DeployHome
14
15
  from .types import DeployRev
15
16
 
16
17
 
@@ -153,9 +154,13 @@ class DeployAppSpec(DeploySpecKeyed[DeployAppKey]):
153
154
 
154
155
  @dc.dataclass(frozen=True)
155
156
  class DeploySpec(DeploySpecKeyed[DeployKey]):
157
+ home: DeployHome
158
+
156
159
  apps: ta.Sequence[DeployAppSpec]
157
160
 
158
161
  def __post_init__(self) -> None:
162
+ check.non_empty_str(self.home)
163
+
159
164
  seen: ta.Set[DeployApp] = set()
160
165
  for a in self.apps:
161
166
  if a.app in seen:
@@ -0,0 +1,27 @@
1
+ # ruff: noqa: UP006 UP007
2
+ from omlish.lite.check import check
3
+ from omlish.lite.typing import Func1
4
+ from omlish.os.atomics import AtomicPathSwapping
5
+ from omlish.os.atomics import TempDirAtomicPathSwapping
6
+
7
+ from .paths.owners import SingleDirDeployPathOwner
8
+ from .types import DeployHome
9
+
10
+
11
+ class DeployHomeAtomics(Func1[DeployHome, AtomicPathSwapping]):
12
+ pass
13
+
14
+
15
+ class DeployTmpManager(
16
+ SingleDirDeployPathOwner,
17
+ ):
18
+ def __init__(self) -> None:
19
+ super().__init__(
20
+ owned_dir='tmp',
21
+ )
22
+
23
+ def get_swapping(self, home: DeployHome) -> AtomicPathSwapping:
24
+ return TempDirAtomicPathSwapping(
25
+ temp_dir=self._make_dir(home),
26
+ root_dir=check.non_empty_str(home),
27
+ )
@@ -10,24 +10,16 @@ from omdev.interp.resolvers import DEFAULT_INTERP_RESOLVER
10
10
  from omdev.interp.types import InterpSpecifier
11
11
  from omlish.asyncs.asyncio.subprocesses import asyncio_subprocesses
12
12
  from omlish.lite.check import check
13
- from omlish.os.atomics import AtomicPathSwapping
14
13
 
15
14
  from .specs import DeployVenvSpec
15
+ from .types import DeployHome
16
16
 
17
17
 
18
18
  class DeployVenvManager:
19
- def __init__(
20
- self,
21
- *,
22
- atomics: AtomicPathSwapping,
23
- ) -> None:
24
- super().__init__()
25
-
26
- self._atomics = atomics
27
-
28
19
  async def setup_venv(
29
20
  self,
30
21
  spec: DeployVenvSpec,
22
+ home: DeployHome,
31
23
  git_dir: str,
32
24
  venv_dir: str,
33
25
  ) -> None:
@@ -35,8 +35,6 @@ from .targets.targets import ManageTarget
35
35
 
36
36
  @dc.dataclass(frozen=True)
37
37
  class ManageConfig:
38
- deploy_home: ta.Optional[str] = None
39
-
40
38
  targets: ta.Optional[ta.Mapping[str, ManageTarget]] = None
41
39
 
42
40
 
@@ -68,8 +66,6 @@ class MainCli(ArgparseCli):
68
66
 
69
67
  argparse_arg('--debug', action='store_true'),
70
68
 
71
- argparse_arg('--deploy-home'),
72
-
73
69
  argparse_arg('target'),
74
70
  argparse_arg('-f', '--command-file', action='append'),
75
71
  argparse_arg('command', nargs='*'),
@@ -82,9 +78,7 @@ class MainCli(ArgparseCli):
82
78
  debug=bool(self.args.debug),
83
79
  ),
84
80
 
85
- deploy_config=DeployConfig(
86
- deploy_home=self.args.deploy_home or self.config().deploy_home,
87
- ),
81
+ deploy_config=DeployConfig(),
88
82
 
89
83
  remote_config=RemoteConfig(
90
84
  payload_file=self.args._payload_file, # noqa