omdev 0.0.0.dev26__tar.gz → 0.0.0.dev27__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.
Potentially problematic release.
This version of omdev might be problematic. Click here for more details.
- {omdev-0.0.0.dev26/omdev.egg-info → omdev-0.0.0.dev27}/PKG-INFO +2 -2
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/datacache/__init__.py +1 -1
- omdev-0.0.0.dev27/omdev/datacache/actions.py +36 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/datacache/cache.py +19 -4
- omdev-0.0.0.dev27/omdev/datacache/consts.py +1 -0
- omdev-0.0.0.dev27/omdev/datacache/defaults.py +18 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/datacache/manifests.py +5 -5
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/datacache/specs.py +3 -3
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/git.py +41 -3
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/manifests.py +2 -2
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/pyproject/pkg.py +76 -4
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/revisions.py +3 -26
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/scripts/interp.py +6 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/scripts/pyproject.py +182 -29
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27/omdev.egg-info}/PKG-INFO +2 -2
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev.egg-info/SOURCES.txt +3 -2
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev.egg-info/requires.txt +1 -1
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/pyproject.toml +4 -4
- omdev-0.0.0.dev26/omdev/datacache/consts.py +0 -1
- omdev-0.0.0.dev26/omdev/datacache/default.py +0 -51
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/LICENSE +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/MANIFEST.in +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/README.rst +0 -0
- /omdev-0.0.0.dev26/omdev/_manifests.json → /omdev-0.0.0.dev27/omdev/.manifests.json +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/__about__.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/__init__.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/amalg/__init__.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/amalg/__main__.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/amalg/amalg.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/bracepy.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/cexts/__init__.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/cexts/_boilerplate.cc +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/cexts/_distutils/LICENSE +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/cexts/_distutils/__init__.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/cexts/_distutils/build_ext.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/cexts/_distutils/compilers/__init__.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/cexts/_distutils/compilers/ccompiler.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/cexts/_distutils/compilers/options.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/cexts/_distutils/compilers/unixccompiler.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/cexts/_distutils/dir_util.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/cexts/_distutils/errors.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/cexts/_distutils/extension.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/cexts/_distutils/file_util.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/cexts/_distutils/modified.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/cexts/_distutils/spawn.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/cexts/_distutils/sysconfig.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/cexts/_distutils/util.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/cexts/_distutils/version.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/cexts/build.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/cexts/cmake.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/cexts/importhook.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/cexts/magic.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/cexts/scan.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/classdot.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/cmake.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/findimports.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/findmagic.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/interp/__init__.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/interp/__main__.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/interp/cli.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/interp/inspect.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/interp/providers.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/interp/pyenv.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/interp/resolvers.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/interp/standalone.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/interp/system.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/interp/types.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/mypy/__init__.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/mypy/debug.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/precheck/__init__.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/precheck/__main__.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/precheck/precheck.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/pyproject/__init__.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/pyproject/__main__.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/pyproject/cexts.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/pyproject/cli.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/pyproject/configs.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/pyproject/reqs.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/scripts/__init__.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/scripts/bumpversion.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/scripts/execrss.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/tokens.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/toml/__init__.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/toml/parser.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/toml/writer.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/tools/__init__.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/tools/dockertools.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/tools/gittools.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/tools/importscan.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/tools/importtrace.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/tools/rst.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/tools/sqlrepl.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/versioning/__init__.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/versioning/specifiers.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/versioning/versions.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev/wheelfile.py +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev.egg-info/dependency_links.txt +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/omdev.egg-info/top_level.txt +0 -0
- {omdev-0.0.0.dev26 → omdev-0.0.0.dev27}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: omdev
|
|
3
|
-
Version: 0.0.0.
|
|
3
|
+
Version: 0.0.0.dev27
|
|
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.dev27
|
|
16
16
|
Provides-Extra: all
|
|
17
17
|
Requires-Dist: pycparser~=2.22; extra == "all"
|
|
18
18
|
Requires-Dist: cffi~=1.17; extra == "all"
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import typing as ta
|
|
2
|
+
|
|
3
|
+
from omlish import dataclasses as dc
|
|
4
|
+
from omlish import lang
|
|
5
|
+
from omlish import marshal as msh
|
|
6
|
+
|
|
7
|
+
from .consts import SERIALIZATION_VERSION
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
##
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@dc.dataclass(frozen=True)
|
|
14
|
+
class Action(lang.Abstract, lang.Sealed):
|
|
15
|
+
serialization_version: int = dc.field(default=SERIALIZATION_VERSION, kw_only=True)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
##
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@dc.dataclass(frozen=True)
|
|
22
|
+
class ExtractAction(Action, lang.Final):
|
|
23
|
+
files: ta.Sequence[str]
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
##
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@lang.cached_function
|
|
30
|
+
def _install_standard_marshalling() -> None:
|
|
31
|
+
actions_poly = msh.polymorphism_from_subclasses(Action)
|
|
32
|
+
msh.STANDARD_MARSHALER_FACTORIES[0:0] = [msh.PolymorphismMarshalerFactory(actions_poly)]
|
|
33
|
+
msh.STANDARD_UNMARSHALER_FACTORIES[0:0] = [msh.PolymorphismUnmarshalerFactory(actions_poly)]
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
_install_standard_marshalling()
|
|
@@ -46,7 +46,7 @@ class DataCache:
|
|
|
46
46
|
urllib.request.urlretrieve(url, out_file) # noqa
|
|
47
47
|
|
|
48
48
|
def _fetch_into(self, spec: CacheDataSpec, data_dir: str) -> None:
|
|
49
|
-
log.info('Fetching spec: %s %r', spec.digest, spec)
|
|
49
|
+
log.info('Fetching spec: %s %r -> %s', spec.digest, spec, data_dir)
|
|
50
50
|
|
|
51
51
|
if isinstance(spec, HttpCacheDataSpec):
|
|
52
52
|
self._fetch_url(spec.url, os.path.join(data_dir, spec.file_name_or_default))
|
|
@@ -69,7 +69,7 @@ class DataCache:
|
|
|
69
69
|
|
|
70
70
|
log.info('Cloning git repo: %s -> %s', spec.url, tmp_dir)
|
|
71
71
|
|
|
72
|
-
git.
|
|
72
|
+
git.git_clone_subtree(
|
|
73
73
|
base_dir=tmp_dir,
|
|
74
74
|
repo_url=spec.url,
|
|
75
75
|
repo_dir='data',
|
|
@@ -102,6 +102,14 @@ class DataCache:
|
|
|
102
102
|
raise RuntimeError(data_file) # noqa
|
|
103
103
|
return data_file
|
|
104
104
|
|
|
105
|
+
elif isinstance(spec, GithubContentCacheDataSpec):
|
|
106
|
+
if len(spec.files) != 1:
|
|
107
|
+
return data_dir
|
|
108
|
+
data_file = os.path.join(data_dir, check.single(spec.files))
|
|
109
|
+
if not os.path.isfile(data_file):
|
|
110
|
+
raise RuntimeError(data_file) # noqa
|
|
111
|
+
return data_file
|
|
112
|
+
|
|
105
113
|
else:
|
|
106
114
|
return data_dir
|
|
107
115
|
|
|
@@ -141,9 +149,16 @@ class DataCache:
|
|
|
141
149
|
with open(manifest_file, 'w') as f:
|
|
142
150
|
f.write(manifest_json)
|
|
143
151
|
|
|
144
|
-
|
|
152
|
+
#
|
|
153
|
+
|
|
154
|
+
# for p, ds, fs in os.walk(tmp_dir):
|
|
155
|
+
# for n in [*ds, *fs]:
|
|
156
|
+
# np = os.path.join(p, n)
|
|
157
|
+
# os.chmod(np, os.stat(np).st_mode & ~0o222)
|
|
158
|
+
|
|
159
|
+
#
|
|
145
160
|
|
|
146
|
-
|
|
161
|
+
shutil.move(tmp_dir, item_dir)
|
|
147
162
|
|
|
148
163
|
data_dir = os.path.join(item_dir, 'data')
|
|
149
164
|
return self._return_val(spec, data_dir)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
SERIALIZATION_VERSION = 0
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import os.path
|
|
2
|
+
|
|
3
|
+
from omlish import lang
|
|
4
|
+
|
|
5
|
+
from .cache import DataCache
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
##
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@lang.cached_function(lock=True)
|
|
12
|
+
def default_dir() -> str:
|
|
13
|
+
return os.path.expanduser('~/.cache/omlish/data')
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@lang.cached_function(lock=True)
|
|
17
|
+
def default() -> DataCache:
|
|
18
|
+
return DataCache(default_dir())
|
|
@@ -4,8 +4,8 @@ from omlish import __about__ as about
|
|
|
4
4
|
from omlish import cached
|
|
5
5
|
from omlish import dataclasses as dc
|
|
6
6
|
|
|
7
|
-
from ..
|
|
8
|
-
from .consts import
|
|
7
|
+
from ..git import get_git_revision
|
|
8
|
+
from .consts import SERIALIZATION_VERSION
|
|
9
9
|
from .specs import CacheDataSpec
|
|
10
10
|
|
|
11
11
|
|
|
@@ -33,8 +33,8 @@ class CacheDataManifest:
|
|
|
33
33
|
lib_version: str = dc.field(default_factory=lambda: about.__version__, kw_only=True)
|
|
34
34
|
lib_revision: str = dc.field(default_factory=_lib_revision, kw_only=True)
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
serialization_version: int = dc.field(default=SERIALIZATION_VERSION, kw_only=True)
|
|
37
37
|
|
|
38
38
|
@dc.validate
|
|
39
|
-
def
|
|
40
|
-
return self.
|
|
39
|
+
def _validate_serialization_versions(self) -> bool:
|
|
40
|
+
return self.serialization_version == self.spec.serialization_version
|
|
@@ -10,7 +10,7 @@ from omlish import lang
|
|
|
10
10
|
from omlish import marshal as msh
|
|
11
11
|
from omlish.formats import json
|
|
12
12
|
|
|
13
|
-
from .consts import
|
|
13
|
+
from .consts import SERIALIZATION_VERSION
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
##
|
|
@@ -18,11 +18,11 @@ from .consts import MARSHAL_VERSION
|
|
|
18
18
|
|
|
19
19
|
@dc.dataclass(frozen=True)
|
|
20
20
|
class CacheDataSpec(lang.Abstract, lang.Sealed):
|
|
21
|
-
|
|
21
|
+
serialization_version: int = dc.field(default=SERIALIZATION_VERSION, kw_only=True)
|
|
22
22
|
|
|
23
23
|
@cached.property
|
|
24
24
|
def json(self) -> str:
|
|
25
|
-
return json.dumps_compact(msh.marshal(self, CacheDataSpec))
|
|
25
|
+
return json.dumps_compact(msh.marshal(self, CacheDataSpec), sort_keys=True)
|
|
26
26
|
|
|
27
27
|
@cached.property
|
|
28
28
|
def digest(self) -> str:
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
+
# ruff: noqa: UP007
|
|
2
|
+
# @omlish-lite
|
|
1
3
|
import os.path
|
|
2
4
|
import subprocess
|
|
3
5
|
import typing as ta
|
|
4
6
|
|
|
5
7
|
|
|
6
|
-
def
|
|
8
|
+
def git_clone_subtree(
|
|
7
9
|
*,
|
|
8
10
|
base_dir: str,
|
|
9
11
|
repo_url: str,
|
|
10
12
|
repo_dir: str,
|
|
11
|
-
branch: str
|
|
12
|
-
rev: str
|
|
13
|
+
branch: ta.Optional[str] = None,
|
|
14
|
+
rev: ta.Optional[str] = None,
|
|
13
15
|
repo_subtrees: ta.Sequence[str],
|
|
14
16
|
) -> None:
|
|
15
17
|
if not bool(branch) ^ bool(rev):
|
|
@@ -60,3 +62,39 @@ def clone_subtree(
|
|
|
60
62
|
],
|
|
61
63
|
cwd=rd,
|
|
62
64
|
)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def get_git_revision(
|
|
68
|
+
*,
|
|
69
|
+
cwd: ta.Optional[str] = None,
|
|
70
|
+
) -> ta.Optional[str]:
|
|
71
|
+
subprocess.check_output(['git', '--version'])
|
|
72
|
+
|
|
73
|
+
if cwd is None:
|
|
74
|
+
cwd = os.getcwd()
|
|
75
|
+
|
|
76
|
+
if subprocess.run([ # noqa
|
|
77
|
+
'git',
|
|
78
|
+
'rev-parse',
|
|
79
|
+
'--is-inside-work-tree',
|
|
80
|
+
], stderr=subprocess.PIPE).returncode:
|
|
81
|
+
return None
|
|
82
|
+
|
|
83
|
+
has_untracked = bool(subprocess.check_output([
|
|
84
|
+
'git',
|
|
85
|
+
'ls-files',
|
|
86
|
+
'.',
|
|
87
|
+
'--exclude-standard',
|
|
88
|
+
'--others',
|
|
89
|
+
], cwd=cwd).decode().strip())
|
|
90
|
+
|
|
91
|
+
dirty_rev = subprocess.check_output([
|
|
92
|
+
'git',
|
|
93
|
+
'describe',
|
|
94
|
+
'--match=NeVeRmAtCh',
|
|
95
|
+
'--always',
|
|
96
|
+
'--abbrev=40',
|
|
97
|
+
'--dirty',
|
|
98
|
+
], cwd=cwd).decode().strip()
|
|
99
|
+
|
|
100
|
+
return dirty_rev + ('-untracked' if has_untracked else '')
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"""
|
|
2
|
-
!!! manifests! get-manifest,
|
|
2
|
+
!!! manifests! get-manifest, .manifest.json
|
|
3
3
|
- dumb dicts, root keys are 'types'
|
|
4
4
|
- get put in _manifest.py, root level dict or smth
|
|
5
5
|
- IMPORT files w comment
|
|
@@ -195,7 +195,7 @@ def build_package_manifests(
|
|
|
195
195
|
manifests.extend(build_module_manifests(os.path.relpath(file, base), base))
|
|
196
196
|
|
|
197
197
|
if write:
|
|
198
|
-
with open(os.path.join(pkg_dir, '
|
|
198
|
+
with open(os.path.join(pkg_dir, '.manifests.json'), 'w') as f:
|
|
199
199
|
f.write(json_dumps_pretty([dc.asdict(m) for m in manifests]))
|
|
200
200
|
f.write('\n')
|
|
201
201
|
|
|
@@ -139,6 +139,35 @@ class BasePyprojectPackageGenerator(abc.ABC):
|
|
|
139
139
|
|
|
140
140
|
#
|
|
141
141
|
|
|
142
|
+
class _PkgData(ta.NamedTuple):
|
|
143
|
+
inc: ta.List[str]
|
|
144
|
+
exc: ta.List[str]
|
|
145
|
+
|
|
146
|
+
@cached_nullary
|
|
147
|
+
def _collect_pkg_data(self) -> _PkgData:
|
|
148
|
+
inc: ta.List[str] = []
|
|
149
|
+
exc: ta.List[str] = []
|
|
150
|
+
|
|
151
|
+
for p, ds, fs in os.walk(self._dir_name): # noqa
|
|
152
|
+
for f in fs:
|
|
153
|
+
if f != '.pkgdata':
|
|
154
|
+
continue
|
|
155
|
+
rp = os.path.relpath(p, self._dir_name)
|
|
156
|
+
log.info('Found pkgdata %s for pkg %s', rp, self._dir_name)
|
|
157
|
+
with open(os.path.join(p, f)) as fo:
|
|
158
|
+
src = fo.read()
|
|
159
|
+
for l in src.splitlines():
|
|
160
|
+
if not (l := l.strip()):
|
|
161
|
+
continue
|
|
162
|
+
if l.startswith('!'):
|
|
163
|
+
exc.append(os.path.join(rp, l[1:]))
|
|
164
|
+
else:
|
|
165
|
+
inc.append(os.path.join(rp, l))
|
|
166
|
+
|
|
167
|
+
return self._PkgData(inc, exc)
|
|
168
|
+
|
|
169
|
+
#
|
|
170
|
+
|
|
142
171
|
@abc.abstractmethod
|
|
143
172
|
def _write_file_contents(self) -> None:
|
|
144
173
|
raise NotImplementedError
|
|
@@ -268,13 +297,56 @@ class PyprojectPackageGenerator(BasePyprojectPackageGenerator):
|
|
|
268
297
|
|
|
269
298
|
#
|
|
270
299
|
|
|
271
|
-
st = specs.setuptools
|
|
300
|
+
st = dict(specs.setuptools)
|
|
272
301
|
pyp_dct['tool.setuptools'] = st
|
|
273
302
|
|
|
274
303
|
st.pop('cexts', None)
|
|
275
304
|
|
|
276
|
-
|
|
277
|
-
|
|
305
|
+
#
|
|
306
|
+
|
|
307
|
+
# TODO: default
|
|
308
|
+
# find_packages = {
|
|
309
|
+
# 'include': [Project.name, f'{Project.name}.*'],
|
|
310
|
+
# 'exclude': [*SetuptoolsBase.find_packages['exclude']],
|
|
311
|
+
# }
|
|
312
|
+
|
|
313
|
+
fp = dict(st.pop('find_packages', {}))
|
|
314
|
+
|
|
315
|
+
pyp_dct['tool.setuptools.packages.find'] = fp
|
|
316
|
+
|
|
317
|
+
#
|
|
318
|
+
|
|
319
|
+
# TODO: default
|
|
320
|
+
# package_data = {
|
|
321
|
+
# '*': [
|
|
322
|
+
# '*.c',
|
|
323
|
+
# '*.cc',
|
|
324
|
+
# '*.h',
|
|
325
|
+
# '.manifests.json',
|
|
326
|
+
# 'LICENSE',
|
|
327
|
+
# ],
|
|
328
|
+
# }
|
|
329
|
+
|
|
330
|
+
pd = dict(st.pop('package_data', {}))
|
|
331
|
+
epd = dict(st.pop('exclude_package_data', {}))
|
|
332
|
+
|
|
333
|
+
cpd = self._collect_pkg_data()
|
|
334
|
+
if cpd.inc:
|
|
335
|
+
pd['*'] = [*pd.get('*', []), *sorted(set(cpd.inc))]
|
|
336
|
+
if cpd.exc:
|
|
337
|
+
epd['*'] = [*epd.get('*', []), *sorted(set(cpd.exc))]
|
|
338
|
+
|
|
339
|
+
if pd:
|
|
340
|
+
pyp_dct['tool.setuptools.package-data'] = pd
|
|
341
|
+
if epd:
|
|
342
|
+
pyp_dct['tool.setuptools.exclude-package-data'] = epd
|
|
343
|
+
|
|
344
|
+
#
|
|
345
|
+
|
|
346
|
+
# TODO: default
|
|
347
|
+
# manifest_in = [
|
|
348
|
+
# 'global-exclude **/conftest.py',
|
|
349
|
+
# ]
|
|
278
350
|
|
|
279
351
|
mani_in = st.pop('manifest_in', None)
|
|
280
352
|
|
|
@@ -354,7 +426,7 @@ class _PyprojectCextPackageGenerator(BasePyprojectPackageGenerator):
|
|
|
354
426
|
|
|
355
427
|
#
|
|
356
428
|
|
|
357
|
-
st = specs.setuptools
|
|
429
|
+
st = dict(specs.setuptools)
|
|
358
430
|
pyp_dct['tool.setuptools'] = st
|
|
359
431
|
|
|
360
432
|
for k in [
|
|
@@ -9,45 +9,22 @@ TODO:
|
|
|
9
9
|
import argparse
|
|
10
10
|
import io
|
|
11
11
|
import os.path
|
|
12
|
-
import subprocess
|
|
13
12
|
import tarfile
|
|
14
13
|
import typing as ta
|
|
15
14
|
import zipfile
|
|
16
15
|
|
|
17
16
|
from omlish.lite.cached import cached_nullary
|
|
17
|
+
from omlish.lite.check import check_non_empty_str
|
|
18
18
|
from omlish.lite.logs import configure_standard_logging
|
|
19
19
|
from omlish.lite.logs import log
|
|
20
20
|
|
|
21
|
+
from .git import get_git_revision
|
|
21
22
|
from .wheelfile import WheelFile
|
|
22
23
|
|
|
23
24
|
|
|
24
25
|
##
|
|
25
26
|
|
|
26
27
|
|
|
27
|
-
def get_git_revision() -> str:
|
|
28
|
-
has_untracked = bool(subprocess.check_output([
|
|
29
|
-
'git',
|
|
30
|
-
'ls-files',
|
|
31
|
-
'.',
|
|
32
|
-
'--exclude-standard',
|
|
33
|
-
'--others',
|
|
34
|
-
]).decode().strip())
|
|
35
|
-
|
|
36
|
-
dirty_rev = subprocess.check_output([
|
|
37
|
-
'git',
|
|
38
|
-
'describe',
|
|
39
|
-
'--match=NeVeRmAtCh',
|
|
40
|
-
'--always',
|
|
41
|
-
'--abbrev=40',
|
|
42
|
-
'--dirty',
|
|
43
|
-
]).decode().strip()
|
|
44
|
-
|
|
45
|
-
return dirty_rev + ('-untracked' if has_untracked else '')
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
##
|
|
49
|
-
|
|
50
|
-
|
|
51
28
|
class GitRevisionAdder:
|
|
52
29
|
def __init__(
|
|
53
30
|
self,
|
|
@@ -62,7 +39,7 @@ class GitRevisionAdder:
|
|
|
62
39
|
def revision(self) -> str:
|
|
63
40
|
if self._given_revision is not None:
|
|
64
41
|
return self._given_revision
|
|
65
|
-
return get_git_revision()
|
|
42
|
+
return check_non_empty_str(get_git_revision())
|
|
66
43
|
|
|
67
44
|
REVISION_ATTR = '__revision__'
|
|
68
45
|
|
|
@@ -515,6 +515,12 @@ def check_not(v: ta.Any) -> None:
|
|
|
515
515
|
return v
|
|
516
516
|
|
|
517
517
|
|
|
518
|
+
def check_non_empty_str(v: ta.Optional[str]) -> str:
|
|
519
|
+
if not v:
|
|
520
|
+
raise ValueError
|
|
521
|
+
return v
|
|
522
|
+
|
|
523
|
+
|
|
518
524
|
########################################
|
|
519
525
|
# ../../../omlish/lite/json.py
|
|
520
526
|
|
|
@@ -170,6 +170,105 @@ def find_magic(
|
|
|
170
170
|
yield out
|
|
171
171
|
|
|
172
172
|
|
|
173
|
+
########################################
|
|
174
|
+
# ../../git.py
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
def git_clone_subtree(
|
|
178
|
+
*,
|
|
179
|
+
base_dir: str,
|
|
180
|
+
repo_url: str,
|
|
181
|
+
repo_dir: str,
|
|
182
|
+
branch: ta.Optional[str] = None,
|
|
183
|
+
rev: ta.Optional[str] = None,
|
|
184
|
+
repo_subtrees: ta.Sequence[str],
|
|
185
|
+
) -> None:
|
|
186
|
+
if not bool(branch) ^ bool(rev):
|
|
187
|
+
raise ValueError('must set branch or rev')
|
|
188
|
+
|
|
189
|
+
if isinstance(repo_subtrees, str):
|
|
190
|
+
raise TypeError(repo_subtrees)
|
|
191
|
+
|
|
192
|
+
git_opts = [
|
|
193
|
+
'-c', 'advice.detachedHead=false',
|
|
194
|
+
]
|
|
195
|
+
|
|
196
|
+
subprocess.check_call(
|
|
197
|
+
[
|
|
198
|
+
'git',
|
|
199
|
+
*git_opts,
|
|
200
|
+
'clone',
|
|
201
|
+
'-n',
|
|
202
|
+
'--depth=1',
|
|
203
|
+
'--filter=tree:0',
|
|
204
|
+
*(['-b', branch] if branch else []),
|
|
205
|
+
'--single-branch',
|
|
206
|
+
repo_url,
|
|
207
|
+
repo_dir,
|
|
208
|
+
],
|
|
209
|
+
cwd=base_dir,
|
|
210
|
+
)
|
|
211
|
+
|
|
212
|
+
rd = os.path.join(base_dir, repo_dir)
|
|
213
|
+
subprocess.check_call(
|
|
214
|
+
[
|
|
215
|
+
'git',
|
|
216
|
+
*git_opts,
|
|
217
|
+
'sparse-checkout',
|
|
218
|
+
'set',
|
|
219
|
+
'--no-cone',
|
|
220
|
+
*repo_subtrees,
|
|
221
|
+
],
|
|
222
|
+
cwd=rd,
|
|
223
|
+
)
|
|
224
|
+
|
|
225
|
+
subprocess.check_call(
|
|
226
|
+
[
|
|
227
|
+
'git',
|
|
228
|
+
*git_opts,
|
|
229
|
+
'checkout',
|
|
230
|
+
*([rev] if rev else []),
|
|
231
|
+
],
|
|
232
|
+
cwd=rd,
|
|
233
|
+
)
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
def get_git_revision(
|
|
237
|
+
*,
|
|
238
|
+
cwd: ta.Optional[str] = None,
|
|
239
|
+
) -> ta.Optional[str]:
|
|
240
|
+
subprocess.check_output(['git', '--version'])
|
|
241
|
+
|
|
242
|
+
if cwd is None:
|
|
243
|
+
cwd = os.getcwd()
|
|
244
|
+
|
|
245
|
+
if subprocess.run([ # noqa
|
|
246
|
+
'git',
|
|
247
|
+
'rev-parse',
|
|
248
|
+
'--is-inside-work-tree',
|
|
249
|
+
], stderr=subprocess.PIPE).returncode:
|
|
250
|
+
return None
|
|
251
|
+
|
|
252
|
+
has_untracked = bool(subprocess.check_output([
|
|
253
|
+
'git',
|
|
254
|
+
'ls-files',
|
|
255
|
+
'.',
|
|
256
|
+
'--exclude-standard',
|
|
257
|
+
'--others',
|
|
258
|
+
], cwd=cwd).decode().strip())
|
|
259
|
+
|
|
260
|
+
dirty_rev = subprocess.check_output([
|
|
261
|
+
'git',
|
|
262
|
+
'describe',
|
|
263
|
+
'--match=NeVeRmAtCh',
|
|
264
|
+
'--always',
|
|
265
|
+
'--abbrev=40',
|
|
266
|
+
'--dirty',
|
|
267
|
+
], cwd=cwd).decode().strip()
|
|
268
|
+
|
|
269
|
+
return dirty_rev + ('-untracked' if has_untracked else '')
|
|
270
|
+
|
|
271
|
+
|
|
173
272
|
########################################
|
|
174
273
|
# ../../toml/parser.py
|
|
175
274
|
# SPDX-License-Identifier: MIT
|
|
@@ -1788,6 +1887,12 @@ def check_not(v: ta.Any) -> None:
|
|
|
1788
1887
|
return v
|
|
1789
1888
|
|
|
1790
1889
|
|
|
1890
|
+
def check_non_empty_str(v: ta.Optional[str]) -> str:
|
|
1891
|
+
if not v:
|
|
1892
|
+
raise ValueError
|
|
1893
|
+
return v
|
|
1894
|
+
|
|
1895
|
+
|
|
1791
1896
|
########################################
|
|
1792
1897
|
# ../../../omlish/lite/json.py
|
|
1793
1898
|
|
|
@@ -3268,30 +3373,6 @@ TODO:
|
|
|
3268
3373
|
##
|
|
3269
3374
|
|
|
3270
3375
|
|
|
3271
|
-
def get_git_revision() -> str:
|
|
3272
|
-
has_untracked = bool(subprocess.check_output([
|
|
3273
|
-
'git',
|
|
3274
|
-
'ls-files',
|
|
3275
|
-
'.',
|
|
3276
|
-
'--exclude-standard',
|
|
3277
|
-
'--others',
|
|
3278
|
-
]).decode().strip())
|
|
3279
|
-
|
|
3280
|
-
dirty_rev = subprocess.check_output([
|
|
3281
|
-
'git',
|
|
3282
|
-
'describe',
|
|
3283
|
-
'--match=NeVeRmAtCh',
|
|
3284
|
-
'--always',
|
|
3285
|
-
'--abbrev=40',
|
|
3286
|
-
'--dirty',
|
|
3287
|
-
]).decode().strip()
|
|
3288
|
-
|
|
3289
|
-
return dirty_rev + ('-untracked' if has_untracked else '')
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
##
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
3376
|
class GitRevisionAdder:
|
|
3296
3377
|
def __init__(
|
|
3297
3378
|
self,
|
|
@@ -3306,7 +3387,7 @@ class GitRevisionAdder:
|
|
|
3306
3387
|
def revision(self) -> str:
|
|
3307
3388
|
if self._given_revision is not None:
|
|
3308
3389
|
return self._given_revision
|
|
3309
|
-
return get_git_revision()
|
|
3390
|
+
return check_non_empty_str(get_git_revision())
|
|
3310
3391
|
|
|
3311
3392
|
REVISION_ATTR = '__revision__'
|
|
3312
3393
|
|
|
@@ -3726,6 +3807,35 @@ class BasePyprojectPackageGenerator(abc.ABC):
|
|
|
3726
3807
|
|
|
3727
3808
|
#
|
|
3728
3809
|
|
|
3810
|
+
class _PkgData(ta.NamedTuple):
|
|
3811
|
+
inc: ta.List[str]
|
|
3812
|
+
exc: ta.List[str]
|
|
3813
|
+
|
|
3814
|
+
@cached_nullary
|
|
3815
|
+
def _collect_pkg_data(self) -> _PkgData:
|
|
3816
|
+
inc: ta.List[str] = []
|
|
3817
|
+
exc: ta.List[str] = []
|
|
3818
|
+
|
|
3819
|
+
for p, ds, fs in os.walk(self._dir_name): # noqa
|
|
3820
|
+
for f in fs:
|
|
3821
|
+
if f != '.pkgdata':
|
|
3822
|
+
continue
|
|
3823
|
+
rp = os.path.relpath(p, self._dir_name)
|
|
3824
|
+
log.info('Found pkgdata %s for pkg %s', rp, self._dir_name)
|
|
3825
|
+
with open(os.path.join(p, f)) as fo:
|
|
3826
|
+
src = fo.read()
|
|
3827
|
+
for l in src.splitlines():
|
|
3828
|
+
if not (l := l.strip()):
|
|
3829
|
+
continue
|
|
3830
|
+
if l.startswith('!'):
|
|
3831
|
+
exc.append(os.path.join(rp, l[1:]))
|
|
3832
|
+
else:
|
|
3833
|
+
inc.append(os.path.join(rp, l))
|
|
3834
|
+
|
|
3835
|
+
return self._PkgData(inc, exc)
|
|
3836
|
+
|
|
3837
|
+
#
|
|
3838
|
+
|
|
3729
3839
|
@abc.abstractmethod
|
|
3730
3840
|
def _write_file_contents(self) -> None:
|
|
3731
3841
|
raise NotImplementedError
|
|
@@ -3855,13 +3965,56 @@ class PyprojectPackageGenerator(BasePyprojectPackageGenerator):
|
|
|
3855
3965
|
|
|
3856
3966
|
#
|
|
3857
3967
|
|
|
3858
|
-
st = specs.setuptools
|
|
3968
|
+
st = dict(specs.setuptools)
|
|
3859
3969
|
pyp_dct['tool.setuptools'] = st
|
|
3860
3970
|
|
|
3861
3971
|
st.pop('cexts', None)
|
|
3862
3972
|
|
|
3863
|
-
|
|
3864
|
-
|
|
3973
|
+
#
|
|
3974
|
+
|
|
3975
|
+
# TODO: default
|
|
3976
|
+
# find_packages = {
|
|
3977
|
+
# 'include': [Project.name, f'{Project.name}.*'],
|
|
3978
|
+
# 'exclude': [*SetuptoolsBase.find_packages['exclude']],
|
|
3979
|
+
# }
|
|
3980
|
+
|
|
3981
|
+
fp = dict(st.pop('find_packages', {}))
|
|
3982
|
+
|
|
3983
|
+
pyp_dct['tool.setuptools.packages.find'] = fp
|
|
3984
|
+
|
|
3985
|
+
#
|
|
3986
|
+
|
|
3987
|
+
# TODO: default
|
|
3988
|
+
# package_data = {
|
|
3989
|
+
# '*': [
|
|
3990
|
+
# '*.c',
|
|
3991
|
+
# '*.cc',
|
|
3992
|
+
# '*.h',
|
|
3993
|
+
# '.manifests.json',
|
|
3994
|
+
# 'LICENSE',
|
|
3995
|
+
# ],
|
|
3996
|
+
# }
|
|
3997
|
+
|
|
3998
|
+
pd = dict(st.pop('package_data', {}))
|
|
3999
|
+
epd = dict(st.pop('exclude_package_data', {}))
|
|
4000
|
+
|
|
4001
|
+
cpd = self._collect_pkg_data()
|
|
4002
|
+
if cpd.inc:
|
|
4003
|
+
pd['*'] = [*pd.get('*', []), *sorted(set(cpd.inc))]
|
|
4004
|
+
if cpd.exc:
|
|
4005
|
+
epd['*'] = [*epd.get('*', []), *sorted(set(cpd.exc))]
|
|
4006
|
+
|
|
4007
|
+
if pd:
|
|
4008
|
+
pyp_dct['tool.setuptools.package-data'] = pd
|
|
4009
|
+
if epd:
|
|
4010
|
+
pyp_dct['tool.setuptools.exclude-package-data'] = epd
|
|
4011
|
+
|
|
4012
|
+
#
|
|
4013
|
+
|
|
4014
|
+
# TODO: default
|
|
4015
|
+
# manifest_in = [
|
|
4016
|
+
# 'global-exclude **/conftest.py',
|
|
4017
|
+
# ]
|
|
3865
4018
|
|
|
3866
4019
|
mani_in = st.pop('manifest_in', None)
|
|
3867
4020
|
|
|
@@ -3941,7 +4094,7 @@ class _PyprojectCextPackageGenerator(BasePyprojectPackageGenerator):
|
|
|
3941
4094
|
|
|
3942
4095
|
#
|
|
3943
4096
|
|
|
3944
|
-
st = specs.setuptools
|
|
4097
|
+
st = dict(specs.setuptools)
|
|
3945
4098
|
pyp_dct['tool.setuptools'] = st
|
|
3946
4099
|
|
|
3947
4100
|
for k in [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: omdev
|
|
3
|
-
Version: 0.0.0.
|
|
3
|
+
Version: 0.0.0.dev27
|
|
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.dev27
|
|
16
16
|
Provides-Extra: all
|
|
17
17
|
Requires-Dist: pycparser~=2.22; extra == "all"
|
|
18
18
|
Requires-Dist: cffi~=1.17; extra == "all"
|
|
@@ -2,9 +2,9 @@ LICENSE
|
|
|
2
2
|
MANIFEST.in
|
|
3
3
|
README.rst
|
|
4
4
|
pyproject.toml
|
|
5
|
+
omdev/.manifests.json
|
|
5
6
|
omdev/__about__.py
|
|
6
7
|
omdev/__init__.py
|
|
7
|
-
omdev/_manifests.json
|
|
8
8
|
omdev/bracepy.py
|
|
9
9
|
omdev/classdot.py
|
|
10
10
|
omdev/cmake.py
|
|
@@ -47,9 +47,10 @@ omdev/cexts/_distutils/compilers/ccompiler.py
|
|
|
47
47
|
omdev/cexts/_distutils/compilers/options.py
|
|
48
48
|
omdev/cexts/_distutils/compilers/unixccompiler.py
|
|
49
49
|
omdev/datacache/__init__.py
|
|
50
|
+
omdev/datacache/actions.py
|
|
50
51
|
omdev/datacache/cache.py
|
|
51
52
|
omdev/datacache/consts.py
|
|
52
|
-
omdev/datacache/
|
|
53
|
+
omdev/datacache/defaults.py
|
|
53
54
|
omdev/datacache/manifests.py
|
|
54
55
|
omdev/datacache/specs.py
|
|
55
56
|
omdev/interp/__init__.py
|
|
@@ -12,7 +12,7 @@ authors = [
|
|
|
12
12
|
urls = {source = 'https://github.com/wrmsr/omlish'}
|
|
13
13
|
license = {text = 'BSD-3-Clause'}
|
|
14
14
|
requires-python = '~=3.12'
|
|
15
|
-
version = '0.0.0.
|
|
15
|
+
version = '0.0.0.dev27'
|
|
16
16
|
classifiers = [
|
|
17
17
|
'License :: OSI Approved :: BSD License',
|
|
18
18
|
'Development Status :: 2 - Pre-Alpha',
|
|
@@ -22,7 +22,7 @@ classifiers = [
|
|
|
22
22
|
]
|
|
23
23
|
description = 'omdev'
|
|
24
24
|
dependencies = [
|
|
25
|
-
'omlish == 0.0.0.
|
|
25
|
+
'omlish == 0.0.0.dev27',
|
|
26
26
|
]
|
|
27
27
|
|
|
28
28
|
[project.optional-dependencies]
|
|
@@ -69,8 +69,8 @@ exclude = [
|
|
|
69
69
|
'*' = [
|
|
70
70
|
'*.c',
|
|
71
71
|
'*.cc',
|
|
72
|
+
'*.cu',
|
|
72
73
|
'*.h',
|
|
73
|
-
'
|
|
74
|
-
'*.sql',
|
|
74
|
+
'.manifests.json',
|
|
75
75
|
'LICENSE',
|
|
76
76
|
]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
MARSHAL_VERSION = 0
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import os.path
|
|
2
|
-
|
|
3
|
-
from omlish import lang
|
|
4
|
-
|
|
5
|
-
from .cache import DataCache
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
##
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
@lang.cached_function(lock=True)
|
|
12
|
-
def default_dir() -> str:
|
|
13
|
-
return os.path.expanduser('~/.cache/omlish/data')
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
@lang.cached_function(lock=True)
|
|
17
|
-
def default() -> DataCache:
|
|
18
|
-
return DataCache(default_dir())
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def _main() -> None:
|
|
22
|
-
from omlish import logs
|
|
23
|
-
|
|
24
|
-
logs.configure_standard_logging('INFO')
|
|
25
|
-
|
|
26
|
-
#
|
|
27
|
-
|
|
28
|
-
from .specs import GitCacheDataSpec
|
|
29
|
-
from .specs import GithubContentCacheDataSpec
|
|
30
|
-
from .specs import HttpCacheDataSpec
|
|
31
|
-
|
|
32
|
-
for spec in [
|
|
33
|
-
GitCacheDataSpec(
|
|
34
|
-
'https://github.com/wrmsr/deep_learning_cookbook',
|
|
35
|
-
rev='138a99b09ffa3a728d261e461440f029e512ac93',
|
|
36
|
-
subtrees=['data/wp_movies_10k.ndjson'],
|
|
37
|
-
),
|
|
38
|
-
GithubContentCacheDataSpec(
|
|
39
|
-
'karpathy/char-rnn',
|
|
40
|
-
'master',
|
|
41
|
-
['data/tinyshakespeare/input.txt'],
|
|
42
|
-
),
|
|
43
|
-
HttpCacheDataSpec('https://github.com/VanushVaswani/keras_mnistm/releases/download/1.0/keras_mnistm.pkl.gz'),
|
|
44
|
-
]:
|
|
45
|
-
print(spec)
|
|
46
|
-
for _ in range(2):
|
|
47
|
-
print(default().get(spec))
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
if __name__ == '__main__':
|
|
51
|
-
_main()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|