omdev 0.0.0.dev240__py3-none-any.whl → 0.0.0.dev242__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.
- omdev/.manifests.json +1 -1
- omdev/ci/cache.py +1 -1
- omdev/ci/ci.py +62 -12
- omdev/ci/cli.py +12 -0
- omdev/ci/consts.py +1 -1
- omdev/ci/docker/buildcaching.py +4 -3
- omdev/ci/docker/cache.py +28 -6
- omdev/ci/docker/cacheserved/__init__.py +0 -0
- omdev/ci/docker/cacheserved/cache.py +209 -0
- omdev/ci/docker/cacheserved/manifests.py +122 -0
- omdev/ci/docker/cmds.py +18 -0
- omdev/ci/docker/dataserver.py +9 -1
- omdev/ci/docker/imagepulling.py +4 -4
- omdev/ci/docker/inject.py +36 -7
- omdev/ci/github/client.py +2 -2
- omdev/ci/github/inject.py +2 -0
- omdev/ci/inject.py +16 -1
- omdev/dataserver/http.py +1 -0
- omdev/precheck/lite.py +3 -0
- omdev/scripts/bumpversion.py +4 -0
- omdev/scripts/ci.py +7276 -1321
- omdev/scripts/interp.py +21 -12
- omdev/scripts/pyproject.py +21 -12
- omdev/tools/docker.py +11 -27
- omdev/tools/git/cli.py +1 -0
- {omdev-0.0.0.dev240.dist-info → omdev-0.0.0.dev242.dist-info}/METADATA +2 -2
- {omdev-0.0.0.dev240.dist-info → omdev-0.0.0.dev242.dist-info}/RECORD +31 -29
- omdev/ci/docker/cacheserved.py +0 -262
- {omdev-0.0.0.dev240.dist-info → omdev-0.0.0.dev242.dist-info}/LICENSE +0 -0
- {omdev-0.0.0.dev240.dist-info → omdev-0.0.0.dev242.dist-info}/WHEEL +0 -0
- {omdev-0.0.0.dev240.dist-info → omdev-0.0.0.dev242.dist-info}/entry_points.txt +0 -0
- {omdev-0.0.0.dev240.dist-info → omdev-0.0.0.dev242.dist-info}/top_level.txt +0 -0
omdev/scripts/interp.py
CHANGED
@@ -2920,14 +2920,6 @@ _INJECTION_INSPECTION_CACHE: ta.MutableMapping[ta.Any, _InjectionInspection] = w
|
|
2920
2920
|
|
2921
2921
|
def _do_injection_inspect(obj: ta.Any) -> _InjectionInspection:
|
2922
2922
|
tgt = obj
|
2923
|
-
if isinstance(tgt, type) and tgt.__init__ is not object.__init__: # type: ignore[misc]
|
2924
|
-
# Python 3.8's inspect.signature can't handle subclasses overriding __new__, always generating *args/**kwargs.
|
2925
|
-
# - https://bugs.python.org/issue40897
|
2926
|
-
# - https://github.com/python/cpython/commit/df7c62980d15acd3125dfbd81546dad359f7add7
|
2927
|
-
tgt = tgt.__init__ # type: ignore[misc]
|
2928
|
-
has_generic_base = True
|
2929
|
-
else:
|
2930
|
-
has_generic_base = False
|
2931
2923
|
|
2932
2924
|
# inspect.signature(eval_str=True) was added in 3.10 and we have to support 3.8, so we have to get_type_hints to
|
2933
2925
|
# eval str annotations *in addition to* getting the signature for parameter information.
|
@@ -2935,23 +2927,40 @@ def _do_injection_inspect(obj: ta.Any) -> _InjectionInspection:
|
|
2935
2927
|
has_partial = False
|
2936
2928
|
while True:
|
2937
2929
|
if isinstance(uw, functools.partial):
|
2938
|
-
has_partial = True
|
2939
2930
|
uw = uw.func
|
2931
|
+
has_partial = True
|
2940
2932
|
else:
|
2941
2933
|
if (uw2 := inspect.unwrap(uw)) is uw:
|
2942
2934
|
break
|
2943
2935
|
uw = uw2
|
2944
2936
|
|
2945
|
-
|
2937
|
+
has_args_offset = False
|
2938
|
+
|
2939
|
+
if isinstance(tgt, type) and tgt.__new__ is not object.__new__:
|
2940
|
+
# Python 3.8's inspect.signature can't handle subclasses overriding __new__, always generating *args/**kwargs.
|
2941
|
+
# - https://bugs.python.org/issue40897
|
2942
|
+
# - https://github.com/python/cpython/commit/df7c62980d15acd3125dfbd81546dad359f7add7
|
2943
|
+
tgt = tgt.__init__ # type: ignore[misc]
|
2944
|
+
has_args_offset = True
|
2945
|
+
|
2946
|
+
if tgt in (object.__init__, object.__new__):
|
2947
|
+
# inspect strips self for types but not the underlying methods.
|
2948
|
+
def dummy(self):
|
2949
|
+
pass
|
2950
|
+
tgt = dummy
|
2951
|
+
has_args_offset = True
|
2952
|
+
|
2953
|
+
if has_partial and has_args_offset:
|
2954
|
+
# TODO: unwrap partials masking parameters like modern python
|
2946
2955
|
raise InjectorError(
|
2947
|
-
'Injector inspection does not currently support both
|
2956
|
+
'Injector inspection does not currently support both an args offset and a functools.partial: '
|
2948
2957
|
f'{obj}',
|
2949
2958
|
)
|
2950
2959
|
|
2951
2960
|
return _InjectionInspection(
|
2952
2961
|
inspect.signature(tgt),
|
2953
2962
|
ta.get_type_hints(uw),
|
2954
|
-
1 if
|
2963
|
+
1 if has_args_offset else 0,
|
2955
2964
|
)
|
2956
2965
|
|
2957
2966
|
|
omdev/scripts/pyproject.py
CHANGED
@@ -4584,14 +4584,6 @@ _INJECTION_INSPECTION_CACHE: ta.MutableMapping[ta.Any, _InjectionInspection] = w
|
|
4584
4584
|
|
4585
4585
|
def _do_injection_inspect(obj: ta.Any) -> _InjectionInspection:
|
4586
4586
|
tgt = obj
|
4587
|
-
if isinstance(tgt, type) and tgt.__init__ is not object.__init__: # type: ignore[misc]
|
4588
|
-
# Python 3.8's inspect.signature can't handle subclasses overriding __new__, always generating *args/**kwargs.
|
4589
|
-
# - https://bugs.python.org/issue40897
|
4590
|
-
# - https://github.com/python/cpython/commit/df7c62980d15acd3125dfbd81546dad359f7add7
|
4591
|
-
tgt = tgt.__init__ # type: ignore[misc]
|
4592
|
-
has_generic_base = True
|
4593
|
-
else:
|
4594
|
-
has_generic_base = False
|
4595
4587
|
|
4596
4588
|
# inspect.signature(eval_str=True) was added in 3.10 and we have to support 3.8, so we have to get_type_hints to
|
4597
4589
|
# eval str annotations *in addition to* getting the signature for parameter information.
|
@@ -4599,23 +4591,40 @@ def _do_injection_inspect(obj: ta.Any) -> _InjectionInspection:
|
|
4599
4591
|
has_partial = False
|
4600
4592
|
while True:
|
4601
4593
|
if isinstance(uw, functools.partial):
|
4602
|
-
has_partial = True
|
4603
4594
|
uw = uw.func
|
4595
|
+
has_partial = True
|
4604
4596
|
else:
|
4605
4597
|
if (uw2 := inspect.unwrap(uw)) is uw:
|
4606
4598
|
break
|
4607
4599
|
uw = uw2
|
4608
4600
|
|
4609
|
-
|
4601
|
+
has_args_offset = False
|
4602
|
+
|
4603
|
+
if isinstance(tgt, type) and tgt.__new__ is not object.__new__:
|
4604
|
+
# Python 3.8's inspect.signature can't handle subclasses overriding __new__, always generating *args/**kwargs.
|
4605
|
+
# - https://bugs.python.org/issue40897
|
4606
|
+
# - https://github.com/python/cpython/commit/df7c62980d15acd3125dfbd81546dad359f7add7
|
4607
|
+
tgt = tgt.__init__ # type: ignore[misc]
|
4608
|
+
has_args_offset = True
|
4609
|
+
|
4610
|
+
if tgt in (object.__init__, object.__new__):
|
4611
|
+
# inspect strips self for types but not the underlying methods.
|
4612
|
+
def dummy(self):
|
4613
|
+
pass
|
4614
|
+
tgt = dummy
|
4615
|
+
has_args_offset = True
|
4616
|
+
|
4617
|
+
if has_partial and has_args_offset:
|
4618
|
+
# TODO: unwrap partials masking parameters like modern python
|
4610
4619
|
raise InjectorError(
|
4611
|
-
'Injector inspection does not currently support both
|
4620
|
+
'Injector inspection does not currently support both an args offset and a functools.partial: '
|
4612
4621
|
f'{obj}',
|
4613
4622
|
)
|
4614
4623
|
|
4615
4624
|
return _InjectionInspection(
|
4616
4625
|
inspect.signature(tgt),
|
4617
4626
|
ta.get_type_hints(uw),
|
4618
|
-
1 if
|
4627
|
+
1 if has_args_offset else 0,
|
4619
4628
|
)
|
4620
4629
|
|
4621
4630
|
|
omdev/tools/docker.py
CHANGED
@@ -19,6 +19,7 @@ from omlish import lang
|
|
19
19
|
from omlish import marshal as msh
|
20
20
|
from omlish.argparse import all as ap
|
21
21
|
from omlish.docker import all as dck
|
22
|
+
from omlish.docker.ns1 import build_docker_ns1_run_cmd
|
22
23
|
from omlish.formats import json
|
23
24
|
from omlish.formats import yaml
|
24
25
|
from omlish.logs import all as logs
|
@@ -44,37 +45,20 @@ def get_local_platform() -> str:
|
|
44
45
|
|
45
46
|
class Cli(ap.Cli):
|
46
47
|
@ap.cmd(
|
47
|
-
ap.arg('
|
48
|
+
ap.arg('cmd', nargs='*'),
|
48
49
|
)
|
49
50
|
def ns1(self) -> None:
|
50
|
-
|
51
|
-
- https://gist.github.com/BretFisher/5e1a0c7bcca4c735e716abf62afad389
|
52
|
-
- https://github.com/justincormack/nsenter1/blob/8d3ba504b2c14d73c70cf34f1ec6943c093f1b02/nsenter1.c
|
53
|
-
|
54
|
-
alt:
|
55
|
-
- nc -U ~/Library/Containers/com.docker.docker/Data/debug-shell.sock
|
56
|
-
"""
|
57
|
-
|
51
|
+
exe = docker_exe()
|
58
52
|
os.execl(
|
59
|
-
exe := docker_exe(),
|
60
53
|
exe,
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
'-m', # mount
|
70
|
-
'-u', # uts
|
71
|
-
'-i', # ipc
|
72
|
-
'-n', # net
|
73
|
-
'-p', # pid
|
74
|
-
'-C', # cgroup
|
75
|
-
# '-U', # user
|
76
|
-
'-T', # time
|
77
|
-
*self.args.args,
|
54
|
+
*build_docker_ns1_run_cmd(
|
55
|
+
*self.args.cmd,
|
56
|
+
exe=exe,
|
57
|
+
run_args=[
|
58
|
+
'--platform', get_local_platform(),
|
59
|
+
'-t',
|
60
|
+
],
|
61
|
+
),
|
78
62
|
)
|
79
63
|
|
80
64
|
@ap.cmd(
|
omdev/tools/git/cli.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: omdev
|
3
|
-
Version: 0.0.0.
|
3
|
+
Version: 0.0.0.dev242
|
4
4
|
Summary: omdev
|
5
5
|
Author: wrmsr
|
6
6
|
License: BSD-3-Clause
|
@@ -12,7 +12,7 @@ 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: omlish==0.0.0.
|
15
|
+
Requires-Dist: omlish==0.0.0.dev242
|
16
16
|
Provides-Extra: all
|
17
17
|
Requires-Dist: black~=25.1; extra == "all"
|
18
18
|
Requires-Dist: pycparser~=2.22; extra == "all"
|
@@ -1,4 +1,4 @@
|
|
1
|
-
omdev/.manifests.json,sha256=
|
1
|
+
omdev/.manifests.json,sha256=OicEZKfOPtIFxcCoF1boOCh1cLRoOFPwnyJEEieFEzQ,9798
|
2
2
|
omdev/__about__.py,sha256=Iect_SBD2EXgx7QcFGiOqTHkOWD-bWOyvzgReDOY4Es,1214
|
3
3
|
omdev/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
4
|
omdev/bracepy.py,sha256=I8EdqtDvxzAi3I8TuMEW-RBfwXfqKbwp06CfOdj3L1o,2743
|
@@ -68,34 +68,36 @@ omdev/cexts/_distutils/compilers/options.py,sha256=H7r5IcLvga5Fs3jjXWIT-6ap3JBdu
|
|
68
68
|
omdev/cexts/_distutils/compilers/unixccompiler.py,sha256=o1h8QuyupLntv4F21_XjzAZmCiwwxJuTmOirvBSL-Qw,15419
|
69
69
|
omdev/ci/__init__.py,sha256=Y3l4WY4JRi2uLG6kgbGp93fuGfkxkKwZDvhsa0Rwgtk,15
|
70
70
|
omdev/ci/__main__.py,sha256=Jsrv3P7LX2Cg08W7ByZfZ1JQT4lgLDPW1qNAmShFuMk,75
|
71
|
-
omdev/ci/cache.py,sha256=
|
72
|
-
omdev/ci/ci.py,sha256=
|
73
|
-
omdev/ci/cli.py,sha256=
|
71
|
+
omdev/ci/cache.py,sha256=MMPx3BMKVGnF2yASEjikvao8H2lRrUdik4eYU8xcFnQ,8352
|
72
|
+
omdev/ci/ci.py,sha256=N5l6imhqrjQw5h5mujWhXMOtZ6V5Qh8dmi16qzCMw5o,7919
|
73
|
+
omdev/ci/cli.py,sha256=jpgdmZS8qLrY9YGC29sizyo6ue3uR5yXf0lSzNFuRiw,7183
|
74
74
|
omdev/ci/compose.py,sha256=vHLuXO5e2paafBC0Kf-OUGoamtIJmQ19r2U3_oikk_g,4541
|
75
|
-
omdev/ci/consts.py,sha256=
|
76
|
-
omdev/ci/inject.py,sha256
|
75
|
+
omdev/ci/consts.py,sha256=HkSYz-_hHilcHPBvRs-SwcUxW7vMNlHXZ8OyIKnVQbQ,21
|
76
|
+
omdev/ci/inject.py,sha256=-rEXOxGNZQLz-CUEen3w8p21xMVkbrcKi8FRNOP_p9k,1924
|
77
77
|
omdev/ci/requirements.py,sha256=UKN6avU5V96YmmJL8XYvMPxzzOagrKpGTYadaxI2z9U,2105
|
78
78
|
omdev/ci/shell.py,sha256=cBPLMKiAJuNpPGj3ou6hpl88Xw7r99xpL91KJBQ0rqw,835
|
79
79
|
omdev/ci/utils.py,sha256=YxOT4S-YLDOAv27K0Q0SKzxncZrWFA_wNXlFOaJmQuI,304
|
80
80
|
omdev/ci/docker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
81
|
-
omdev/ci/docker/buildcaching.py,sha256=
|
82
|
-
omdev/ci/docker/cache.py,sha256=
|
83
|
-
omdev/ci/docker/
|
84
|
-
omdev/ci/docker/
|
85
|
-
omdev/ci/docker/
|
86
|
-
omdev/ci/docker/
|
87
|
-
omdev/ci/docker/inject.py,sha256=LzzmbOidzVHoZbFUGZep1udElkmgHm0AU0LdmPFUK5M,1174
|
81
|
+
omdev/ci/docker/buildcaching.py,sha256=8bPNaY9u35RqLQLCo4F3Mn3fbctQQnxmXSPZ9rE5DEg,1833
|
82
|
+
omdev/ci/docker/cache.py,sha256=wTRsuc8ZAOfMMchwTWhXydp0vciaJygSLuPPmT4uGjE,2114
|
83
|
+
omdev/ci/docker/cmds.py,sha256=d2kf1bTIptg6M-j8d3h0CQz3ADCY4WQ0OwM6V7A-2_w,3061
|
84
|
+
omdev/ci/docker/dataserver.py,sha256=2TRe3pLA_7gDHO3RnF5T0vxjqv35NSdj4CAEMhdA1gg,5861
|
85
|
+
omdev/ci/docker/imagepulling.py,sha256=V-AiIhFde7E4WbA_Ctj0Uzeuezp4e0Jdfy41VSuwzf4,1826
|
86
|
+
omdev/ci/docker/inject.py,sha256=XNSnC1WYLKJARbv0YoX2nEieYdGChKyTcqibwwgOiSQ,2000
|
88
87
|
omdev/ci/docker/packing.py,sha256=Bl0aBkkdwES5ePGE3nmyg1CAQzmMDCVP2KTdZUITpQE,2016
|
89
88
|
omdev/ci/docker/repositories.py,sha256=ZWfObYdZXPn4BBeg8TsYeNVmH1EVEBadfRuxehAhxMM,1223
|
90
89
|
omdev/ci/docker/utils.py,sha256=URioGRzqyqdJBZyOfzsrUwv5hSJ3WM23_sLHES9vamc,1129
|
90
|
+
omdev/ci/docker/cacheserved/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
91
|
+
omdev/ci/docker/cacheserved/cache.py,sha256=hQdeRMRO0N3l-B0-2Ykua7CGDJiQ40HzZYnzPmFje9Q,7191
|
92
|
+
omdev/ci/docker/cacheserved/manifests.py,sha256=C8VPMJoXEEOoTdzWTZLRBtb-bNxJrT5gcaq_ucsvc0I,3584
|
91
93
|
omdev/ci/github/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
92
94
|
omdev/ci/github/api.py,sha256=Vqza7Hm1OCSfZYgdXF4exkjneqNjFcdO1pl8qmODskU,5198
|
93
95
|
omdev/ci/github/bootstrap.py,sha256=9OuftAz7CUd7uf2Or3sJFVozQQiwu0RGAlTOQNpLQIY,430
|
94
96
|
omdev/ci/github/cache.py,sha256=n0nuEaGidvXBfB1ZU1G2Khp5Wuztoh_uNjPkny8KDdQ,2553
|
95
97
|
omdev/ci/github/cli.py,sha256=6mG0CllwrOoC7MDzKfKDqBHAjfF0gEI6aT5UAGMmuss,1114
|
96
|
-
omdev/ci/github/client.py,sha256=
|
98
|
+
omdev/ci/github/client.py,sha256=hjVW20yNCWYt-2p__3nc6NcABRv_pI9kutK97uDWjsw,14622
|
97
99
|
omdev/ci/github/env.py,sha256=FQFjP_m7JWM7es9I51U-6UgJTwAt_UCVHFIYKTd9NKM,394
|
98
|
-
omdev/ci/github/inject.py,sha256=
|
100
|
+
omdev/ci/github/inject.py,sha256=Bfu6L6omd80ei1BbmhkCzmgK1GDWPFG1sCSDzwNNrQw,558
|
99
101
|
omdev/cli/__init__.py,sha256=V_l6VP1SZMlJbO-8CJwSuO9TThOy2S_oaPepNYgIrbE,37
|
100
102
|
omdev/cli/__main__.py,sha256=mOJpgc07o0r5luQ1DlX4tk2PqZkgmbwPbdzJ3KmtjgQ,138
|
101
103
|
omdev/cli/_pathhack.py,sha256=kxqb2kHap68Lkh8b211rDbcgj06hidBiAKA3f9posyc,2119
|
@@ -110,7 +112,7 @@ omdev/clipboard/darwin_cf.py,sha256=SDUMfQtT_IJeDEwmsnxe6YyrZS5tPh_7ujkk1dg65Hg,
|
|
110
112
|
omdev/clipboard/linux_x11.py,sha256=oa-mxMRNaZJOdBAZ8Nki-CAGIb63X8OFUTXKjmiwfSo,6718
|
111
113
|
omdev/dataserver/__init__.py,sha256=Y3l4WY4JRi2uLG6kgbGp93fuGfkxkKwZDvhsa0Rwgtk,15
|
112
114
|
omdev/dataserver/handlers.py,sha256=rCptrmV2RnutmGE5MAgjLDYW1QncqsSHhyRBL4H5bsg,5440
|
113
|
-
omdev/dataserver/http.py,sha256=
|
115
|
+
omdev/dataserver/http.py,sha256=SozI4233RP40m2EX45HtBvdIj-CBFlhHH7ekIbMir-Q,1724
|
114
116
|
omdev/dataserver/routes.py,sha256=7Jai21x5z1t1zbS4mC-Sv2g0uogMJnCAX47WR81QVfI,996
|
115
117
|
omdev/dataserver/server.py,sha256=ySEITCOxOmCXutsfYaFP46gENsg5w9jMeCySUSNUKmE,2333
|
116
118
|
omdev/dataserver/targets.py,sha256=oKINlau7-Dk0XFP81ujU43YxvM_VTT5OnEZYIhHv4Os,3299
|
@@ -186,7 +188,7 @@ omdev/precheck/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
186
188
|
omdev/precheck/__main__.py,sha256=UEuS4z5-heIrwTtB-ONe1KeXJdqj8tYXMqWMpuO10so,165
|
187
189
|
omdev/precheck/base.py,sha256=a_lGoFM-QhL8u8XDUYFhb-feEyfPbP4j8lcmNO51sHY,732
|
188
190
|
omdev/precheck/git.py,sha256=APC5Ln7x0zDrQiGPRWPsBcVJK3vWhbU-brqR5M63JQA,849
|
189
|
-
omdev/precheck/lite.py,sha256=
|
191
|
+
omdev/precheck/lite.py,sha256=WFi7Ox2XD_L-jx8rdjXucoGMi5AiEFkDGYWhCW8ZH6g,4692
|
190
192
|
omdev/precheck/main.py,sha256=XkwQnC_4YH-0P9YYkVxKUHAAj0o6iXiCu6S-oU_WaQk,2948
|
191
193
|
omdev/precheck/manifests.py,sha256=ulwuYeZ0vnRsj8uTUbQGifoBNwI82MAsJuffs3rVIak,760
|
192
194
|
omdev/precheck/scripts.py,sha256=Xw9kkQzlDd_2V9av9qlaNpNZG9jZdy3TTo7x60MeR2I,1273
|
@@ -209,13 +211,13 @@ omdev/pyproject/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJW
|
|
209
211
|
omdev/pyproject/resources/docker-dev.sh,sha256=DHkz5D18jok_oDolfg2mqrvGRWFoCe9GQo04dR1czcc,838
|
210
212
|
omdev/pyproject/resources/python.sh,sha256=rFaN4SiJ9hdLDXXsDTwugI6zsw6EPkgYMmtacZeTbvw,749
|
211
213
|
omdev/scripts/__init__.py,sha256=MKCvUAEQwsIvwLixwtPlpBqmkMXLCnjjXyAXvVpDwVk,91
|
212
|
-
omdev/scripts/bumpversion.py,sha256=
|
213
|
-
omdev/scripts/ci.py,sha256=
|
214
|
+
omdev/scripts/bumpversion.py,sha256=2NnfRsJiZNTg-LubIwXCm2vklG7-kIR8_xFUEZNxtiY,1119
|
215
|
+
omdev/scripts/ci.py,sha256=qn0oXxQyXG6TpG8yBeTBkmiKCTkhhoHAN6XboExIR4c,328230
|
214
216
|
omdev/scripts/execrss.py,sha256=mR0G0wERBYtQmVIn63lCIIFb5zkCM6X_XOENDFYDBKc,651
|
215
217
|
omdev/scripts/exectime.py,sha256=S2O4MgtzTsFOY2IUJxsrnOIame9tEFc6aOlKP-F1JSg,1541
|
216
218
|
omdev/scripts/importtrace.py,sha256=oa7CtcWJVMNDbyIEiRHej6ICfABfErMeo4_haIqe18Q,14041
|
217
|
-
omdev/scripts/interp.py,sha256=
|
218
|
-
omdev/scripts/pyproject.py,sha256=
|
219
|
+
omdev/scripts/interp.py,sha256=OevpqhxklOGFp9X5HTMYLsRUdu0E8MA0x31hOexrHCQ,150775
|
220
|
+
omdev/scripts/pyproject.py,sha256=Ns2_cKtOqU9Sx0T8i5DsO1oYwEV-EzJ67k7xLbaTdeo,258648
|
219
221
|
omdev/scripts/slowcat.py,sha256=lssv4yrgJHiWfOiHkUut2p8E8Tq32zB-ujXESQxFFHY,2728
|
220
222
|
omdev/scripts/tmpexec.py,sha256=WTYcf56Tj2qjYV14AWmV8SfT0u6Y8eIU6cKgQRvEK3c,1442
|
221
223
|
omdev/tokens/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -225,7 +227,7 @@ omdev/tokens/utils.py,sha256=DJA2jsDzrtQxnO0bdkUk1-GmenX4ECugdhl1xOBe7QI,1448
|
|
225
227
|
omdev/tools/__init__.py,sha256=iVJAOQ0viGTQOm0DLX4uZLro-9jOioYJGLg9s0kDx1A,78
|
226
228
|
omdev/tools/cloc.py,sha256=jYlMHBae9oGKN4VKeBGuqjiQNcM2be7KIoTF0oNwx_I,5205
|
227
229
|
omdev/tools/doc.py,sha256=wvgGhv6aFaV-Zl-Qivejx37i-lKQ207rZ-4K2fPf-Ss,2547
|
228
|
-
omdev/tools/docker.py,sha256=
|
230
|
+
omdev/tools/docker.py,sha256=Ekn8q0vo5KZPnz5Fz2P_NDeZkN3c2bdnMvh0SOLWNps,7184
|
229
231
|
omdev/tools/importscan.py,sha256=nhJIhtjDY6eFVlReP7fegvv6L5ZjN-Z2VeyhsBonev4,4639
|
230
232
|
omdev/tools/linehisto.py,sha256=0ZNm34EuiZBE9Q2YC6KNLNNydNT8QPSOwvYzXiU9S2Q,8881
|
231
233
|
omdev/tools/mkenv.py,sha256=G2tu5bmiyKFyZuqtUoM7Z-6AI6CI86F2LwoIozoWOvo,2300
|
@@ -238,7 +240,7 @@ omdev/tools/shadow.py,sha256=e0-R3Ss9CaZbGSUzSSr29OVj9mUQ-Oelh-66Dfkx5nk,1600
|
|
238
240
|
omdev/tools/sqlrepl.py,sha256=wAjrfXNrRV63-NJCC2HlGQnFh7lUH0bHMnOjYotQqFs,5753
|
239
241
|
omdev/tools/git/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
240
242
|
omdev/tools/git/__main__.py,sha256=gI87SBUgTkKUcUM-RtZWnei-UUDDqzbr5aPztb-gvbE,168
|
241
|
-
omdev/tools/git/cli.py,sha256=
|
243
|
+
omdev/tools/git/cli.py,sha256=c2kHbSrvw0Yb95httkTT9VeeOg8HeZD1Nrc-qkCi4nA,11891
|
242
244
|
omdev/tools/git/consts.py,sha256=JuXivUNDkNhM4pe97icjRVAKM8cNRbrODquHINNKqOE,40
|
243
245
|
omdev/tools/git/messages.py,sha256=NWztIK0nAKJIOVzuVQcR_5LHZUgqyVkrOlpl7dFLMdU,2424
|
244
246
|
omdev/tools/json/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -252,9 +254,9 @@ omdev/tools/json/rendering.py,sha256=tMcjOW5edfozcMSTxxvF7WVTsbYLoe9bCKFh50qyaGw
|
|
252
254
|
omdev/tools/pawk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
253
255
|
omdev/tools/pawk/__main__.py,sha256=VCqeRVnqT1RPEoIrqHFSu4PXVMg4YEgF4qCQm90-eRI,66
|
254
256
|
omdev/tools/pawk/pawk.py,sha256=zsEkfQX0jF5bn712uqPAyBSdJt2dno1LH2oeSMNfXQI,11424
|
255
|
-
omdev-0.0.0.
|
256
|
-
omdev-0.0.0.
|
257
|
-
omdev-0.0.0.
|
258
|
-
omdev-0.0.0.
|
259
|
-
omdev-0.0.0.
|
260
|
-
omdev-0.0.0.
|
257
|
+
omdev-0.0.0.dev242.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
|
258
|
+
omdev-0.0.0.dev242.dist-info/METADATA,sha256=-Au1sV0H8LhgFIXx279Cq3wL3EOg6QkIh6MgeNBZR3I,1636
|
259
|
+
omdev-0.0.0.dev242.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
|
260
|
+
omdev-0.0.0.dev242.dist-info/entry_points.txt,sha256=dHLXFmq5D9B8qUyhRtFqTGWGxlbx3t5ejedjrnXNYLU,33
|
261
|
+
omdev-0.0.0.dev242.dist-info/top_level.txt,sha256=1nr7j30fEWgLYHW3lGR9pkdHkb7knv1U1ES1XRNVQ6k,6
|
262
|
+
omdev-0.0.0.dev242.dist-info/RECORD,,
|
omdev/ci/docker/cacheserved.py
DELETED
@@ -1,262 +0,0 @@
|
|
1
|
-
# ruff: noqa: UP006 UP007
|
2
|
-
import abc
|
3
|
-
import asyncio
|
4
|
-
import contextlib
|
5
|
-
import dataclasses as dc
|
6
|
-
import json
|
7
|
-
import os.path
|
8
|
-
import typing as ta
|
9
|
-
|
10
|
-
from omlish.asyncs.asyncio.subprocesses import asyncio_subprocesses
|
11
|
-
from omlish.lite.check import check
|
12
|
-
from omlish.lite.json import json_dumps_compact
|
13
|
-
from omlish.lite.logs import log
|
14
|
-
from omlish.lite.marshal import marshal_obj
|
15
|
-
from omlish.lite.marshal import unmarshal_obj
|
16
|
-
|
17
|
-
from ...dataserver.routes import DataServerRoute
|
18
|
-
from ...dataserver.server import DataServer
|
19
|
-
from ...dataserver.targets import BytesDataServerTarget
|
20
|
-
from ...dataserver.targets import DataServerTarget
|
21
|
-
from ...dataserver.targets import FileDataServerTarget
|
22
|
-
from ...oci.building import build_oci_index_repository
|
23
|
-
from ...oci.data import get_single_leaf_oci_image_index
|
24
|
-
from ...oci.dataserver import build_oci_repository_data_server_routes
|
25
|
-
from ...oci.loading import read_oci_repository_root_index
|
26
|
-
from ...oci.pack.repositories import OciPackedRepositoryBuilder
|
27
|
-
from ...oci.repositories import OciRepository
|
28
|
-
from ..cache import DataCache
|
29
|
-
from ..cache import read_data_cache_data
|
30
|
-
from .cache import DockerCache
|
31
|
-
from .dataserver import DockerDataServer
|
32
|
-
from .repositories import DockerImageRepositoryOpener
|
33
|
-
|
34
|
-
|
35
|
-
##
|
36
|
-
|
37
|
-
|
38
|
-
@dc.dataclass(frozen=True)
|
39
|
-
class CacheServedDockerImageManifest:
|
40
|
-
@dc.dataclass(frozen=True)
|
41
|
-
class Route:
|
42
|
-
paths: ta.Sequence[str]
|
43
|
-
|
44
|
-
content_type: str
|
45
|
-
content_length: int
|
46
|
-
|
47
|
-
@dc.dataclass(frozen=True)
|
48
|
-
class Target(abc.ABC): # noqa
|
49
|
-
pass
|
50
|
-
|
51
|
-
@dc.dataclass(frozen=True)
|
52
|
-
class BytesTarget(Target):
|
53
|
-
data: bytes
|
54
|
-
|
55
|
-
@dc.dataclass(frozen=True)
|
56
|
-
class CacheKeyTarget(Target):
|
57
|
-
key: str
|
58
|
-
|
59
|
-
target: Target
|
60
|
-
|
61
|
-
def __post_init__(self) -> None:
|
62
|
-
check.not_isinstance(self.paths, str)
|
63
|
-
|
64
|
-
routes: ta.Sequence[Route]
|
65
|
-
|
66
|
-
|
67
|
-
#
|
68
|
-
|
69
|
-
|
70
|
-
async def build_cache_served_docker_image_manifest(
|
71
|
-
data_server_routes: ta.Iterable[DataServerRoute],
|
72
|
-
make_file_cache_key: ta.Callable[[str], ta.Awaitable[str]],
|
73
|
-
) -> CacheServedDockerImageManifest:
|
74
|
-
routes: ta.List[CacheServedDockerImageManifest.Route] = []
|
75
|
-
|
76
|
-
for data_server_route in data_server_routes:
|
77
|
-
content_length: int
|
78
|
-
|
79
|
-
data_server_target = data_server_route.target
|
80
|
-
target: CacheServedDockerImageManifest.Route.Target
|
81
|
-
if isinstance(data_server_target, BytesDataServerTarget):
|
82
|
-
bytes_data = check.isinstance(data_server_target.data, bytes)
|
83
|
-
content_length = len(bytes_data)
|
84
|
-
target = CacheServedDockerImageManifest.Route.BytesTarget(bytes_data)
|
85
|
-
|
86
|
-
elif isinstance(data_server_target, FileDataServerTarget):
|
87
|
-
file_path = check.non_empty_str(data_server_target.file_path)
|
88
|
-
content_length = os.path.getsize(file_path)
|
89
|
-
cache_key = await make_file_cache_key(file_path)
|
90
|
-
target = CacheServedDockerImageManifest.Route.CacheKeyTarget(cache_key)
|
91
|
-
|
92
|
-
else:
|
93
|
-
raise TypeError(data_server_target)
|
94
|
-
|
95
|
-
routes.append(CacheServedDockerImageManifest.Route(
|
96
|
-
paths=data_server_route.paths,
|
97
|
-
|
98
|
-
content_type=check.non_empty_str(data_server_target.content_type),
|
99
|
-
content_length=content_length,
|
100
|
-
|
101
|
-
target=target,
|
102
|
-
))
|
103
|
-
|
104
|
-
return CacheServedDockerImageManifest(
|
105
|
-
routes=routes,
|
106
|
-
)
|
107
|
-
|
108
|
-
|
109
|
-
#
|
110
|
-
|
111
|
-
|
112
|
-
async def build_cache_served_docker_image_data_server_routes(
|
113
|
-
manifest: CacheServedDockerImageManifest,
|
114
|
-
make_cache_key_target: ta.Callable[..., ta.Awaitable[DataServerTarget]],
|
115
|
-
) -> ta.List[DataServerRoute]:
|
116
|
-
routes: ta.List[DataServerRoute] = []
|
117
|
-
|
118
|
-
for manifest_route in manifest.routes:
|
119
|
-
manifest_target = manifest_route.target
|
120
|
-
|
121
|
-
target_kwargs: dict = dict(
|
122
|
-
content_type=manifest_route.content_type,
|
123
|
-
content_length=manifest_route.content_length,
|
124
|
-
)
|
125
|
-
|
126
|
-
target: DataServerTarget
|
127
|
-
|
128
|
-
if isinstance(manifest_target, CacheServedDockerImageManifest.Route.BytesTarget):
|
129
|
-
target = DataServerTarget.of(manifest_target.data, **target_kwargs)
|
130
|
-
|
131
|
-
elif isinstance(manifest_target, CacheServedDockerImageManifest.Route.CacheKeyTarget):
|
132
|
-
target = await make_cache_key_target(manifest_target.key, **target_kwargs)
|
133
|
-
|
134
|
-
else:
|
135
|
-
raise TypeError(manifest_target)
|
136
|
-
|
137
|
-
routes.append(DataServerRoute(
|
138
|
-
paths=manifest_route.paths,
|
139
|
-
target=target,
|
140
|
-
))
|
141
|
-
|
142
|
-
return routes
|
143
|
-
|
144
|
-
|
145
|
-
##
|
146
|
-
|
147
|
-
|
148
|
-
class CacheServedDockerCache(DockerCache):
|
149
|
-
@dc.dataclass(frozen=True)
|
150
|
-
class Config:
|
151
|
-
port: int = 5021
|
152
|
-
|
153
|
-
repack: bool = True
|
154
|
-
|
155
|
-
def __init__(
|
156
|
-
self,
|
157
|
-
*,
|
158
|
-
config: Config = Config(),
|
159
|
-
|
160
|
-
image_repo_opener: DockerImageRepositoryOpener,
|
161
|
-
data_cache: DataCache,
|
162
|
-
) -> None:
|
163
|
-
super().__init__()
|
164
|
-
|
165
|
-
self._config = config
|
166
|
-
|
167
|
-
self._image_repo_opener = image_repo_opener
|
168
|
-
self._data_cache = data_cache
|
169
|
-
|
170
|
-
async def load_cache_docker_image(self, key: str) -> ta.Optional[str]:
|
171
|
-
if (manifest_data := await self._data_cache.get_data(key)) is None:
|
172
|
-
return None
|
173
|
-
|
174
|
-
manifest_bytes = await read_data_cache_data(manifest_data)
|
175
|
-
|
176
|
-
manifest: CacheServedDockerImageManifest = unmarshal_obj(
|
177
|
-
json.loads(manifest_bytes.decode('utf-8')),
|
178
|
-
CacheServedDockerImageManifest,
|
179
|
-
)
|
180
|
-
|
181
|
-
async def make_cache_key_target(target_cache_key: str, **target_kwargs: ta.Any) -> DataServerTarget: # noqa
|
182
|
-
# FIXME: url
|
183
|
-
cache_data = check.not_none(await self._data_cache.get_data(target_cache_key))
|
184
|
-
file_path = check.isinstance(cache_data, DataCache.FileData).file_path
|
185
|
-
return DataServerTarget.of(
|
186
|
-
file_path=file_path,
|
187
|
-
**target_kwargs,
|
188
|
-
)
|
189
|
-
|
190
|
-
data_server_routes = await build_cache_served_docker_image_data_server_routes(
|
191
|
-
manifest,
|
192
|
-
make_cache_key_target,
|
193
|
-
)
|
194
|
-
|
195
|
-
data_server = DataServer(DataServer.HandlerRoute.of_(*data_server_routes))
|
196
|
-
|
197
|
-
image_url = f'localhost:{self._config.port}/{key}'
|
198
|
-
|
199
|
-
async with DockerDataServer(
|
200
|
-
self._config.port,
|
201
|
-
data_server,
|
202
|
-
handler_log=log,
|
203
|
-
) as dds:
|
204
|
-
dds_run_task = asyncio.create_task(dds.run())
|
205
|
-
try:
|
206
|
-
# FIXME: lol
|
207
|
-
await asyncio.sleep(3.)
|
208
|
-
|
209
|
-
await asyncio_subprocesses.check_call(
|
210
|
-
'docker',
|
211
|
-
'pull',
|
212
|
-
image_url,
|
213
|
-
)
|
214
|
-
|
215
|
-
finally:
|
216
|
-
dds.stop_event.set()
|
217
|
-
await dds_run_task
|
218
|
-
|
219
|
-
return image_url
|
220
|
-
|
221
|
-
async def save_cache_docker_image(self, key: str, image: str) -> None:
|
222
|
-
async with contextlib.AsyncExitStack() as es:
|
223
|
-
image_repo: OciRepository = await es.enter_async_context(
|
224
|
-
self._image_repo_opener.open_docker_image_repository(image),
|
225
|
-
)
|
226
|
-
|
227
|
-
root_image_index = read_oci_repository_root_index(image_repo)
|
228
|
-
image_index = get_single_leaf_oci_image_index(root_image_index)
|
229
|
-
|
230
|
-
if self._config.repack:
|
231
|
-
prb: OciPackedRepositoryBuilder = es.enter_context(OciPackedRepositoryBuilder(
|
232
|
-
image_repo,
|
233
|
-
))
|
234
|
-
built_repo = await asyncio.get_running_loop().run_in_executor(None, prb.build)
|
235
|
-
|
236
|
-
else:
|
237
|
-
built_repo = build_oci_index_repository(image_index)
|
238
|
-
|
239
|
-
data_server_routes = build_oci_repository_data_server_routes(
|
240
|
-
key,
|
241
|
-
built_repo,
|
242
|
-
)
|
243
|
-
|
244
|
-
async def make_file_cache_key(file_path: str) -> str:
|
245
|
-
target_cache_key = f'{key}--{os.path.basename(file_path).split(".")[0]}'
|
246
|
-
await self._data_cache.put_data(
|
247
|
-
target_cache_key,
|
248
|
-
DataCache.FileData(file_path),
|
249
|
-
)
|
250
|
-
return target_cache_key
|
251
|
-
|
252
|
-
cache_served_manifest = await build_cache_served_docker_image_manifest(
|
253
|
-
data_server_routes,
|
254
|
-
make_file_cache_key,
|
255
|
-
)
|
256
|
-
|
257
|
-
manifest_data = json_dumps_compact(marshal_obj(cache_served_manifest)).encode('utf-8')
|
258
|
-
|
259
|
-
await self._data_cache.put_data(
|
260
|
-
key,
|
261
|
-
DataCache.BytesData(manifest_data),
|
262
|
-
)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|