ladyrick 0.5.0__tar.gz → 0.5.1__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.
Files changed (32) hide show
  1. {ladyrick-0.5.0 → ladyrick-0.5.1}/PKG-INFO +1 -1
  2. {ladyrick-0.5.0 → ladyrick-0.5.1}/pyproject.toml +1 -1
  3. {ladyrick-0.5.0 → ladyrick-0.5.1}/src/ladyrick/cli/multi_ssh.py +24 -18
  4. {ladyrick-0.5.0 → ladyrick-0.5.1}/src/ladyrick/cli/psf.py +2 -2
  5. {ladyrick-0.5.0 → ladyrick-0.5.1}/src/ladyrick.egg-info/PKG-INFO +1 -1
  6. {ladyrick-0.5.0 → ladyrick-0.5.1}/LICENSE +0 -0
  7. {ladyrick-0.5.0 → ladyrick-0.5.1}/README.md +0 -0
  8. {ladyrick-0.5.0 → ladyrick-0.5.1}/setup.cfg +0 -0
  9. {ladyrick-0.5.0 → ladyrick-0.5.1}/src/ladyrick/__init__.py +0 -0
  10. {ladyrick-0.5.0 → ladyrick-0.5.1}/src/ladyrick/cli/tee.py +0 -0
  11. {ladyrick-0.5.0 → ladyrick-0.5.1}/src/ladyrick/cli/test_args.py +0 -0
  12. {ladyrick-0.5.0 → ladyrick-0.5.1}/src/ladyrick/cli/test_signal.py +0 -0
  13. {ladyrick-0.5.0 → ladyrick-0.5.1}/src/ladyrick/debug.py +0 -0
  14. {ladyrick-0.5.0 → ladyrick-0.5.1}/src/ladyrick/loader.py +0 -0
  15. {ladyrick-0.5.0 → ladyrick-0.5.1}/src/ladyrick/patch/__init__.py +0 -0
  16. {ladyrick-0.5.0 → ladyrick-0.5.1}/src/ladyrick/patch/print.py +0 -0
  17. {ladyrick-0.5.0 → ladyrick-0.5.1}/src/ladyrick/patch/python/__init__.py +0 -0
  18. {ladyrick-0.5.0 → ladyrick-0.5.1}/src/ladyrick/patch/python/__main__.py +0 -0
  19. {ladyrick-0.5.0 → ladyrick-0.5.1}/src/ladyrick/patch/python/usercustomize.py +0 -0
  20. {ladyrick-0.5.0 → ladyrick-0.5.1}/src/ladyrick/patch/rich_print.py +0 -0
  21. {ladyrick-0.5.0 → ladyrick-0.5.1}/src/ladyrick/pickle.py +0 -0
  22. {ladyrick-0.5.0 → ladyrick-0.5.1}/src/ladyrick/pprint.py +0 -0
  23. {ladyrick-0.5.0 → ladyrick-0.5.1}/src/ladyrick/print_utils.py +0 -0
  24. {ladyrick-0.5.0 → ladyrick-0.5.1}/src/ladyrick/torch.py +0 -0
  25. {ladyrick-0.5.0 → ladyrick-0.5.1}/src/ladyrick/typing.py +0 -0
  26. {ladyrick-0.5.0 → ladyrick-0.5.1}/src/ladyrick/utils.py +0 -0
  27. {ladyrick-0.5.0 → ladyrick-0.5.1}/src/ladyrick/vars.py +0 -0
  28. {ladyrick-0.5.0 → ladyrick-0.5.1}/src/ladyrick.egg-info/SOURCES.txt +0 -0
  29. {ladyrick-0.5.0 → ladyrick-0.5.1}/src/ladyrick.egg-info/dependency_links.txt +0 -0
  30. {ladyrick-0.5.0 → ladyrick-0.5.1}/src/ladyrick.egg-info/entry_points.txt +0 -0
  31. {ladyrick-0.5.0 → ladyrick-0.5.1}/src/ladyrick.egg-info/requires.txt +0 -0
  32. {ladyrick-0.5.0 → ladyrick-0.5.1}/src/ladyrick.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ladyrick
3
- Version: 0.5.0
3
+ Version: 0.5.1
4
4
  Summary: ladyrick's tools
5
5
  Author-email: ladyrick <ladyrick@qq.com>
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "ladyrick"
7
- version = "0.5.0"
7
+ version = "0.5.1"
8
8
  authors = [{ name = "ladyrick", email = "ladyrick@qq.com" }]
9
9
  description = "ladyrick's tools"
10
10
  readme = "README.md"
@@ -1,17 +1,9 @@
1
- import argparse
2
- import dataclasses
3
- import itertools
4
1
  import json
5
2
  import os
6
- import pathlib
7
- import random
8
3
  import select
9
- import shlex
10
4
  import signal
11
5
  import subprocess
12
6
  import sys
13
- import time
14
- import uuid
15
7
 
16
8
 
17
9
  def log(msg):
@@ -37,19 +29,18 @@ def remote_head():
37
29
  extra_envs = json.loads(sys.argv[2])
38
30
  os.environ.update(extra_envs)
39
31
 
40
- parser = argparse.ArgumentParser(prog=REMOTE_HEAD_PROG_NAME)
41
- parser.add_argument("cmd", type=str, nargs="+", help="cmd")
42
- args = parser.parse_args(sys.argv[3:])
32
+ cmd = sys.argv[3:]
43
33
  try:
44
34
  from setproctitle import setproctitle
45
35
 
46
- setproctitle(" ".join([REMOTE_HEAD_PROG_NAME] + args.cmd))
36
+ setproctitle(" ".join([REMOTE_HEAD_PROG_NAME] + cmd))
47
37
  except ImportError:
48
38
  pass
49
39
 
50
40
  # start child process
51
41
  child = subprocess.Popen(
52
- args.cmd,
42
+ cmd,
43
+ stdin=subprocess.PIPE,
53
44
  stdout=sys.stdout,
54
45
  stderr=sys.stderr,
55
46
  start_new_session=True,
@@ -97,6 +88,15 @@ if __name__ == "__main__" and len(sys.argv) > 1 and sys.argv[1] == REMOTE_HEAD_P
97
88
 
98
89
 
99
90
  # ----- remote_head end ----- #
91
+ if True:
92
+ import argparse
93
+ import dataclasses
94
+ import itertools
95
+ import pathlib
96
+ import random
97
+ import shlex
98
+ import time
99
+ import uuid
100
100
 
101
101
 
102
102
  @dataclasses.dataclass
@@ -213,10 +213,6 @@ def signal_repeat_checker(sig_to_check, count, duration):
213
213
  return checker
214
214
 
215
215
 
216
- def get_common_envs():
217
- pass
218
-
219
-
220
216
  def main():
221
217
  parser = argparse.ArgumentParser(prog="multi-ssh", add_help=False)
222
218
  parser.add_argument("-h", type=str, action="append", help="hosts to connect. order is 1")
@@ -225,13 +221,18 @@ def main():
225
221
  parser.add_argument("-l", type=str, help="ssh login User")
226
222
  parser.add_argument("-o", type=str, action="append", help="ssh options")
227
223
  parser.add_argument("-F", type=str, help="ssh config file")
228
- parser.add_argument("cmd", type=str, nargs="+", help="cmd")
229
224
  parser.add_argument("--hosts-config", type=str, action="append", help="hosts config string. order is 2")
230
225
  parser.add_argument("--hosts-config-file", type=str, action="append", help="hosts config file. order is 3")
231
226
  parser.add_argument("--help", action="help", default=argparse.SUPPRESS, help="show this help message and exit")
227
+ parser.add_argument("cmd", type=str, nargs=argparse.REMAINDER, help="cmd")
232
228
 
233
229
  args = parser.parse_args()
234
230
 
231
+ if not args.cmd:
232
+ print("cmd is required\n")
233
+ parser.print_help()
234
+ sys.exit(1)
235
+
235
236
  hosts = [
236
237
  Host(hn, args.F, args.l, args.p, args.i, args.o)
237
238
  for hn in itertools.chain.from_iterable(h.split(",") for h in args.h or [])
@@ -255,6 +256,11 @@ def main():
255
256
  )
256
257
  )
257
258
 
259
+ if not hosts:
260
+ print("hosts is required. specify hosts by -h, --hosts-config or --hosts-config-file\n")
261
+ parser.print_help()
262
+ sys.exit(1)
263
+
258
264
  executors = [RemoteExecutor(host, args.cmd) for host in hosts]
259
265
 
260
266
  RemoteExecutor.set_envs(executors)
@@ -5,7 +5,7 @@ import sys
5
5
 
6
6
  def main():
7
7
  if os.uname().sysname != "Linux":
8
- print("Only support uname Linux")
8
+ print("only support uname Linux")
9
9
  sys.exit(1)
10
10
  verbose = ""
11
11
  root_pid = 0
@@ -15,7 +15,7 @@ def main():
15
15
  elif arg.isdigit():
16
16
  root_pid = int(arg)
17
17
  else:
18
- print(f"Invalid args: {arg}")
18
+ print(f"invalid args: {arg}")
19
19
  sys.exit(1)
20
20
  if root_pid in (0, 1):
21
21
  cmd = ["ps", verbose + "afxopid,user,cmd"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ladyrick
3
- Version: 0.5.0
3
+ Version: 0.5.1
4
4
  Summary: ladyrick's tools
5
5
  Author-email: ladyrick <ladyrick@qq.com>
6
6
  License-Expression: MIT
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes