omdev 0.0.0.dev209__py3-none-any.whl → 0.0.0.dev211__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/amalg/main.py +10 -1
- omdev/cc/cdeps.py +38 -0
- omdev/cc/cdeps.toml +4 -1
- omdev/cc/cli.py +2 -25
- omdev/ci/__init__.py +0 -0
- omdev/ci/__main__.py +4 -0
- omdev/ci/cache.py +168 -0
- omdev/ci/ci.py +249 -0
- omdev/ci/cli.py +189 -0
- omdev/ci/compose.py +214 -0
- omdev/ci/docker.py +151 -0
- omdev/ci/github/__init__.py +0 -0
- omdev/ci/github/bootstrap.py +11 -0
- omdev/ci/github/cache.py +355 -0
- omdev/ci/github/cacheapi.py +207 -0
- omdev/ci/github/cli.py +39 -0
- omdev/ci/requirements.py +80 -0
- omdev/ci/shell.py +42 -0
- omdev/ci/utils.py +81 -0
- omdev/interp/cli.py +0 -1
- omdev/interp/providers/system.py +2 -1
- omdev/pycharm/cli.py +1 -1
- omdev/pyproject/cli.py +0 -1
- omdev/revisions.py +0 -1
- omdev/scripts/ci.py +3435 -0
- omdev/scripts/interp.py +41 -25
- omdev/scripts/pyproject.py +41 -25
- omdev/tools/pawk/pawk.py +0 -1
- {omdev-0.0.0.dev209.dist-info → omdev-0.0.0.dev211.dist-info}/METADATA +2 -2
- {omdev-0.0.0.dev209.dist-info → omdev-0.0.0.dev211.dist-info}/RECORD +35 -18
- {omdev-0.0.0.dev209.dist-info → omdev-0.0.0.dev211.dist-info}/LICENSE +0 -0
- {omdev-0.0.0.dev209.dist-info → omdev-0.0.0.dev211.dist-info}/WHEEL +0 -0
- {omdev-0.0.0.dev209.dist-info → omdev-0.0.0.dev211.dist-info}/entry_points.txt +0 -0
- {omdev-0.0.0.dev209.dist-info → omdev-0.0.0.dev211.dist-info}/top_level.txt +0 -0
omdev/ci/shell.py
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# ruff: noqa: UP006 UP007
|
2
|
+
# @omlish-lite
|
3
|
+
import dataclasses as dc
|
4
|
+
import os
|
5
|
+
import typing as ta
|
6
|
+
|
7
|
+
|
8
|
+
T = ta.TypeVar('T')
|
9
|
+
|
10
|
+
|
11
|
+
##
|
12
|
+
|
13
|
+
|
14
|
+
@dc.dataclass(frozen=True)
|
15
|
+
class ShellCmd:
|
16
|
+
s: str
|
17
|
+
|
18
|
+
env: ta.Optional[ta.Mapping[str, str]] = None
|
19
|
+
|
20
|
+
def build_run_kwargs(
|
21
|
+
self,
|
22
|
+
*,
|
23
|
+
env: ta.Optional[ta.Mapping[str, str]] = None,
|
24
|
+
**kwargs: ta.Any,
|
25
|
+
) -> ta.Dict[str, ta.Any]:
|
26
|
+
if env is None:
|
27
|
+
env = os.environ
|
28
|
+
if self.env:
|
29
|
+
if (ek := set(env) & set(self.env)):
|
30
|
+
raise KeyError(*ek)
|
31
|
+
env = {**env, **self.env}
|
32
|
+
|
33
|
+
return dict(
|
34
|
+
env=env,
|
35
|
+
**kwargs,
|
36
|
+
)
|
37
|
+
|
38
|
+
def run(self, fn: ta.Callable[..., T], **kwargs) -> T:
|
39
|
+
return fn(
|
40
|
+
'sh', '-c', self.s,
|
41
|
+
**self.build_run_kwargs(**kwargs),
|
42
|
+
)
|
omdev/ci/utils.py
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
# ruff: noqa: UP006 UP007
|
2
|
+
# @omlish-lite
|
3
|
+
import hashlib
|
4
|
+
import logging
|
5
|
+
import os.path
|
6
|
+
import tempfile
|
7
|
+
import time
|
8
|
+
import typing as ta
|
9
|
+
|
10
|
+
from omlish.lite.logs import log
|
11
|
+
|
12
|
+
|
13
|
+
##
|
14
|
+
|
15
|
+
|
16
|
+
def make_temp_file() -> str:
|
17
|
+
file_fd, file = tempfile.mkstemp()
|
18
|
+
os.close(file_fd)
|
19
|
+
return file
|
20
|
+
|
21
|
+
|
22
|
+
##
|
23
|
+
|
24
|
+
|
25
|
+
def read_yaml_file(yaml_file: str) -> ta.Any:
|
26
|
+
yaml = __import__('yaml')
|
27
|
+
|
28
|
+
with open(yaml_file) as f:
|
29
|
+
return yaml.safe_load(f)
|
30
|
+
|
31
|
+
|
32
|
+
##
|
33
|
+
|
34
|
+
|
35
|
+
def sha256_str(s: str) -> str:
|
36
|
+
return hashlib.sha256(s.encode('utf-8')).hexdigest()
|
37
|
+
|
38
|
+
|
39
|
+
##
|
40
|
+
|
41
|
+
|
42
|
+
class LogTimingContext:
|
43
|
+
DEFAULT_LOG: ta.ClassVar[logging.Logger] = log
|
44
|
+
|
45
|
+
def __init__(
|
46
|
+
self,
|
47
|
+
description: str,
|
48
|
+
*,
|
49
|
+
log: ta.Optional[logging.Logger] = None, # noqa
|
50
|
+
level: int = logging.DEBUG,
|
51
|
+
) -> None:
|
52
|
+
super().__init__()
|
53
|
+
|
54
|
+
self._description = description
|
55
|
+
self._log = log if log is not None else self.DEFAULT_LOG
|
56
|
+
self._level = level
|
57
|
+
|
58
|
+
def set_description(self, description: str) -> 'LogTimingContext':
|
59
|
+
self._description = description
|
60
|
+
return self
|
61
|
+
|
62
|
+
_begin_time: float
|
63
|
+
_end_time: float
|
64
|
+
|
65
|
+
def __enter__(self) -> 'LogTimingContext':
|
66
|
+
self._begin_time = time.time()
|
67
|
+
|
68
|
+
self._log.log(self._level, f'Begin {self._description}') # noqa
|
69
|
+
|
70
|
+
return self
|
71
|
+
|
72
|
+
def __exit__(self, exc_type, exc_val, exc_tb):
|
73
|
+
self._end_time = time.time()
|
74
|
+
|
75
|
+
self._log.log(
|
76
|
+
self._level,
|
77
|
+
f'End {self._description} - {self._end_time - self._begin_time:0.2f} s elapsed',
|
78
|
+
)
|
79
|
+
|
80
|
+
|
81
|
+
log_timing_context = LogTimingContext
|
omdev/interp/cli.py
CHANGED
omdev/interp/providers/system.py
CHANGED
@@ -104,7 +104,8 @@ class SystemInterpProvider(InterpProvider):
|
|
104
104
|
async def get_exe_version(self, exe: str) -> ta.Optional[InterpVersion]:
|
105
105
|
if not self._options.inspect:
|
106
106
|
s = os.path.basename(exe)
|
107
|
-
|
107
|
+
if s.startswith('python'): # noqa
|
108
|
+
s = s[len('python'):]
|
108
109
|
if '.' in s:
|
109
110
|
try:
|
110
111
|
return InterpVersion.parse(s)
|
omdev/pycharm/cli.py
CHANGED
omdev/pyproject/cli.py
CHANGED
omdev/revisions.py
CHANGED