ominfra 0.0.0.dev136__py3-none-any.whl → 0.0.0.dev137__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.
@@ -1534,6 +1534,9 @@ def _recv_obj(f: ta.IO, ty: type) -> ta.Any:
1534
1534
  return unmarshal_obj(j, ty)
1535
1535
 
1536
1536
 
1537
+ ##
1538
+
1539
+
1537
1540
  def _remote_main() -> None:
1538
1541
  rt = pyremote_bootstrap_finalize() # noqa
1539
1542
 
@@ -1547,6 +1550,41 @@ def _remote_main() -> None:
1547
1550
  _send_obj(rt.output, o)
1548
1551
 
1549
1552
 
1553
+ ##
1554
+
1555
+
1556
+ @cached_nullary
1557
+ def _get_self_src() -> str:
1558
+ return inspect.getsource(sys.modules[__name__])
1559
+
1560
+
1561
+ def _is_src_amalg(src: str) -> bool:
1562
+ for l in src.splitlines(): # noqa
1563
+ if l.startswith('# @omlish-amalg-output '):
1564
+ return True
1565
+ return False
1566
+
1567
+
1568
+ @cached_nullary
1569
+ def _is_self_amalg() -> bool:
1570
+ return _is_src_amalg(_get_self_src())
1571
+
1572
+
1573
+ def _get_amalg_src(*, amalg_file: ta.Optional[str]) -> str:
1574
+ if amalg_file is not None:
1575
+ with open(amalg_file) as f:
1576
+ return f.read()
1577
+
1578
+ if _is_self_amalg():
1579
+ return _get_self_src()
1580
+
1581
+ import importlib.resources
1582
+ return importlib.resources.read_text(__package__, '_manage.py')
1583
+
1584
+
1585
+ ##
1586
+
1587
+
1550
1588
  def _main() -> None:
1551
1589
  import argparse
1552
1590
 
@@ -1561,23 +1599,7 @@ def _main() -> None:
1561
1599
 
1562
1600
  #
1563
1601
 
1564
- self_src = inspect.getsource(sys.modules[__name__])
1565
- self_src_lines = self_src.splitlines()
1566
- for l in self_src_lines:
1567
- if l.startswith('# @omlish-amalg-output '):
1568
- is_self_amalg = True
1569
- break
1570
- else:
1571
- is_self_amalg = False
1572
-
1573
- if is_self_amalg:
1574
- amalg_src = self_src
1575
- else:
1576
- amalg_file = args._amalg_file # noqa
1577
- if amalg_file is None:
1578
- amalg_file = os.path.join(os.path.dirname(__file__), '_manage.py')
1579
- with open(amalg_file) as f:
1580
- amalg_src = f.read()
1602
+ amalg_src = _get_amalg_src(amalg_file=args._amalg_file) # noqa
1581
1603
 
1582
1604
  #
1583
1605
 
@@ -3,13 +3,13 @@
3
3
  # ruff: noqa: UP006 UP007
4
4
  import inspect
5
5
  import json
6
- import os
7
6
  import shlex
8
7
  import struct
9
8
  import subprocess
10
9
  import sys
11
10
  import typing as ta
12
11
 
12
+ from omlish.lite.cached import cached_nullary
13
13
  from omlish.lite.check import check_not_none
14
14
  from omlish.lite.json import json_dumps_compact
15
15
  from omlish.lite.marshal import marshal_obj
@@ -50,6 +50,9 @@ def _recv_obj(f: ta.IO, ty: type) -> ta.Any:
50
50
  return unmarshal_obj(j, ty)
51
51
 
52
52
 
53
+ ##
54
+
55
+
53
56
  def _remote_main() -> None:
54
57
  rt = pyremote_bootstrap_finalize() # noqa
55
58
 
@@ -63,6 +66,41 @@ def _remote_main() -> None:
63
66
  _send_obj(rt.output, o)
64
67
 
65
68
 
69
+ ##
70
+
71
+
72
+ @cached_nullary
73
+ def _get_self_src() -> str:
74
+ return inspect.getsource(sys.modules[__name__])
75
+
76
+
77
+ def _is_src_amalg(src: str) -> bool:
78
+ for l in src.splitlines(): # noqa
79
+ if l.startswith('# @omlish-amalg-output '):
80
+ return True
81
+ return False
82
+
83
+
84
+ @cached_nullary
85
+ def _is_self_amalg() -> bool:
86
+ return _is_src_amalg(_get_self_src())
87
+
88
+
89
+ def _get_amalg_src(*, amalg_file: ta.Optional[str]) -> str:
90
+ if amalg_file is not None:
91
+ with open(amalg_file) as f:
92
+ return f.read()
93
+
94
+ if _is_self_amalg():
95
+ return _get_self_src()
96
+
97
+ import importlib.resources
98
+ return importlib.resources.read_text(__package__, '_manage.py')
99
+
100
+
101
+ ##
102
+
103
+
66
104
  def _main() -> None:
67
105
  import argparse
68
106
 
@@ -77,23 +115,7 @@ def _main() -> None:
77
115
 
78
116
  #
79
117
 
80
- self_src = inspect.getsource(sys.modules[__name__])
81
- self_src_lines = self_src.splitlines()
82
- for l in self_src_lines:
83
- if l.startswith('# @omlish-amalg-output '):
84
- is_self_amalg = True
85
- break
86
- else:
87
- is_self_amalg = False
88
-
89
- if is_self_amalg:
90
- amalg_src = self_src
91
- else:
92
- amalg_file = args._amalg_file # noqa
93
- if amalg_file is None:
94
- amalg_file = os.path.join(os.path.dirname(__file__), '_manage.py')
95
- with open(amalg_file) as f:
96
- amalg_src = f.read()
118
+ amalg_src = _get_amalg_src(amalg_file=args._amalg_file) # noqa
97
119
 
98
120
  #
99
121
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ominfra
3
- Version: 0.0.0.dev136
3
+ Version: 0.0.0.dev137
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.dev136
16
- Requires-Dist: omlish==0.0.0.dev136
15
+ Requires-Dist: omdev==0.0.0.dev137
16
+ Requires-Dist: omlish==0.0.0.dev137
17
17
  Provides-Extra: all
18
18
  Requires-Dist: paramiko~=3.5; extra == "all"
19
19
  Requires-Dist: asyncssh~=2.18; extra == "all"
@@ -57,8 +57,8 @@ ominfra/manage/deploy/poly/site.py,sha256=QJwDDJoVm2-kxi4bxIrp-mn4y2qDLuW3CAUax3
57
57
  ominfra/manage/deploy/poly/supervisor.py,sha256=zkl6VQBcAZaMAhyR9DbbbqULcgFCDZoe9S_vP-mMFQ8,2289
58
58
  ominfra/manage/deploy/poly/venv.py,sha256=BoipDEa4NTeodjf3L57KJfq9eGKLagFNKwD8pS4yrzA,1552
59
59
  ominfra/manage/new/__init__.py,sha256=Y3l4WY4JRi2uLG6kgbGp93fuGfkxkKwZDvhsa0Rwgtk,15
60
- ominfra/manage/new/_manage.py,sha256=AA2XtuvrCUmy2lLlU6IvhNqPPPcD7kgDi2ccHJZHX3Y,40562
61
- ominfra/manage/new/main.py,sha256=Qfsr0PyRq8Tqm2_IiPTHgCsNALeLwXSR2af8PGc8WZE,3678
60
+ ominfra/manage/new/_manage.py,sha256=ERsODiUvQUoZQKCPbQUMQDtBLvq3OnFV-jejfLHgmTI,40760
61
+ ominfra/manage/new/main.py,sha256=xIRUXiofpz8Fh3KBw80TdgqGigArC1xooZ1vaIqvxGM,3912
62
62
  ominfra/manage/new/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
63
63
  ominfra/manage/new/commands/base.py,sha256=TTrHL213jf-ClVqToiNHuxQey1Yf6052E8u3E9hAf7Q,574
64
64
  ominfra/manage/new/commands/subprocess.py,sha256=GpbD-cTorgCRg203lCl81HAh-NBYA6ObKa5ZP2ss9rg,1884
@@ -106,9 +106,9 @@ ominfra/tailscale/api.py,sha256=C5-t_b6jZXUWcy5k8bXm7CFnk73pSdrlMOgGDeGVrpw,1370
106
106
  ominfra/tailscale/cli.py,sha256=DSGp4hn5xwOW-l_u_InKlSF6kIobxtUtVssf_73STs0,3567
107
107
  ominfra/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
108
108
  ominfra/tools/listresources.py,sha256=4qVg5txsb10EHhvqXXeM6gJ2jx9LbroEnPydDv1uXs0,6176
109
- ominfra-0.0.0.dev136.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
110
- ominfra-0.0.0.dev136.dist-info/METADATA,sha256=A0w90koztPfCNzby7_wgr6Xog2aIZDmoSLiHtJP2V0A,731
111
- ominfra-0.0.0.dev136.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
112
- ominfra-0.0.0.dev136.dist-info/entry_points.txt,sha256=kgecQ2MgGrM9qK744BoKS3tMesaC3yjLnl9pa5CRczg,37
113
- ominfra-0.0.0.dev136.dist-info/top_level.txt,sha256=E-b2OHkk_AOBLXHYZQ2EOFKl-_6uOGd8EjeG-Zy6h_w,8
114
- ominfra-0.0.0.dev136.dist-info/RECORD,,
109
+ ominfra-0.0.0.dev137.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
110
+ ominfra-0.0.0.dev137.dist-info/METADATA,sha256=8OfILeUYDutFSCpF5j3-yPVNgBa0WHp_CM49WDloxZA,731
111
+ ominfra-0.0.0.dev137.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
112
+ ominfra-0.0.0.dev137.dist-info/entry_points.txt,sha256=kgecQ2MgGrM9qK744BoKS3tMesaC3yjLnl9pa5CRczg,37
113
+ ominfra-0.0.0.dev137.dist-info/top_level.txt,sha256=E-b2OHkk_AOBLXHYZQ2EOFKl-_6uOGd8EjeG-Zy6h_w,8
114
+ ominfra-0.0.0.dev137.dist-info/RECORD,,