MainShortcuts2 2.10.1__tar.gz → 2.10.2__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.
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/PKG-INFO +1 -1
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/pyproject.toml +2 -1
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/_module_info.py +1 -1
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/java_launch/__init__.py +9 -10
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/java_launch/infofile.py +71 -7
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/ms2hash.py +13 -2
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/README.md +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/__init__.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/__main__.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/_any2json_regs.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/_ms2app_regs.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/_ms2dat_auto.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/advanced.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/any2json.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/api/base.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/api/gigachat.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/api/github.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/api/russian_trusted_root_ca_pem.crt +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/api/russian_trusted_sub_ca_pem.crt +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/api/webdav.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/cfg.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/core.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/core_config.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/dict.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/dir.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/ex/__init__.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/ex/aiohttp_ex/web/__init__.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/ex/aiohttp_ex/web/__main__.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/ex/datetime_ex.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/ex/pathlib_ex.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/ex/pil_ex.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/ex/psutil_ex.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/ex/sqlite_ex.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/ex/urlparse_ex.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/file.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/gui_scripts/__init__.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/gui_scripts/ms2_hash_gen.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/gui_scripts/utils.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/java_ext/__init__.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/java_ext/ms2ext.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/java_launch/__main__.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/java_launch/util.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/json.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/linux.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/list.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/ms2app.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/ms2dat1.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/ms2dat1crypto.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/path.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/proc.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/regex.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/special_chars.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/sql/_sql_base.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/sql/mysql.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/sql/postgresql.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/sql/sqlite.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/str.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/term.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/types.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/utils.py +0 -0
- {mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/win.py +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
|
-
version = "2.10.
|
|
2
|
+
version = "2.10.2"
|
|
3
3
|
name = "MainShortcuts2"
|
|
4
4
|
description = "Сокращение и улучшение функций + консольные утилиты"
|
|
5
5
|
authors = ["MainPlay TG <xbox.roman6666666666@gmail.com>"]
|
|
@@ -15,6 +15,7 @@ ms2-app = "MainShortcuts2.ms2app:main"
|
|
|
15
15
|
ms2-hash_check = "MainShortcuts2.ms2hash:hash_check"
|
|
16
16
|
ms2-hash_gen = "MainShortcuts2.ms2hash:hash_gen"
|
|
17
17
|
ms2-hash_java = "MainShortcuts2.ms2hash:run_java_ext"
|
|
18
|
+
ms2sign = "MainShortcuts2.ms2hash:run_ms2sign"
|
|
18
19
|
ms2-import_example = "MainShortcuts2.__main__:import_example"
|
|
19
20
|
ms2-ln = "MainShortcuts2.__main__:ln"
|
|
20
21
|
ms2-which_real = "MainShortcuts2.__main__:which_real"
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
name = 'mainshortcuts2'
|
|
2
|
-
version = '2.10.
|
|
2
|
+
version = '2.10.2'
|
|
@@ -40,20 +40,19 @@ class JavaLaunchManager:
|
|
|
40
40
|
|
|
41
41
|
def download_depends(self, clazz: _ClassInfo, download_optional=False):
|
|
42
42
|
"""Скачать зависимости класса"""
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
depends = clazz.required_depends.copy()
|
|
44
|
+
if download_optional:
|
|
45
|
+
depends.update(clazz.optional_depends)
|
|
46
|
+
for i in list(depends):
|
|
47
|
+
depends.update(i.recursive_dependencies)
|
|
48
|
+
queue: dict[str, Path] = {}
|
|
49
|
+
for i in depends:
|
|
45
50
|
file = self.cache_root / i.file_name
|
|
46
51
|
if not file.exists():
|
|
47
52
|
file.parent.any_mkdir()
|
|
48
|
-
queue
|
|
49
|
-
if download_optional:
|
|
50
|
-
for i in clazz.optional_depends:
|
|
51
|
-
file = self.cache_root / i.file_name
|
|
52
|
-
if not file.exists():
|
|
53
|
-
file.parent.any_mkdir()
|
|
54
|
-
queue.add((i.file_url, file))
|
|
53
|
+
queue[i.file_url] = file
|
|
55
54
|
with ThreadPoolExecutor() as pool:
|
|
56
|
-
futures = [pool.submit(self.downloader.download2file,
|
|
55
|
+
futures = [pool.submit(self.downloader.download2file, url, path) for url, path in queue.items()]
|
|
57
56
|
[i.result() for i in futures]
|
|
58
57
|
|
|
59
58
|
def launch_file(self, file: Path, args: list[str] = [], *,
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import hashlib
|
|
2
2
|
import os
|
|
3
|
+
import sys
|
|
3
4
|
from functools import cached_property
|
|
4
5
|
from MainShortcuts2.ex.pathlib_ex import Path
|
|
5
6
|
from MainShortcuts2.utils import short_urlsafe_b64encode
|
|
7
|
+
from xml.etree import ElementTree
|
|
6
8
|
_rand = os.urandom(8)
|
|
7
9
|
|
|
8
10
|
|
|
@@ -20,26 +22,35 @@ class _ClassInfo(dict):
|
|
|
20
22
|
"""Необязательные зависимости"""
|
|
21
23
|
self.required_names: set[str] = set(self.get("required") or [])
|
|
22
24
|
"""Обязательные зависимости"""
|
|
25
|
+
|
|
23
26
|
@property
|
|
24
27
|
def optional_depends(self):
|
|
25
|
-
|
|
28
|
+
deps = {self._root.dependencies[i] for i in self.optional_names}
|
|
29
|
+
return {i for i in deps if i.need_to_install}
|
|
26
30
|
|
|
27
31
|
@property
|
|
28
32
|
def required_depends(self):
|
|
29
|
-
|
|
33
|
+
deps = {*self._root.required_dependencies, *[self._root.dependencies[i] for i in self.required_names]}
|
|
34
|
+
return {i for i in deps if i.need_to_install}
|
|
35
|
+
|
|
36
|
+
def _get_files(self, cache_root: Path, dep: "set[_Dependency]"):
|
|
37
|
+
files: set[Path] = set()
|
|
38
|
+
for i in dep:
|
|
39
|
+
files.add(cache_root / i.file_name)
|
|
40
|
+
for i2 in i.recursive_dependencies:
|
|
41
|
+
files.add(cache_root / i2.file_name)
|
|
42
|
+
return files
|
|
30
43
|
|
|
31
44
|
def build_args(self, cache_root: Path, file: Path):
|
|
32
45
|
"""Собрать список аргументов. Без пути к Java и пользовательских аргументов"""
|
|
33
46
|
cp = {str(file), }
|
|
34
47
|
# Собрать обязательные зависимости
|
|
35
|
-
for
|
|
36
|
-
file = cache_root / i.file_name
|
|
48
|
+
for file in self._get_files(cache_root, self.required_depends):
|
|
37
49
|
if not file.exists():
|
|
38
50
|
raise FileNotFoundError(file)
|
|
39
51
|
cp.add(str(file))
|
|
40
52
|
# Собрать необязательные зависимости
|
|
41
|
-
for
|
|
42
|
-
file = cache_root / i.file_name
|
|
53
|
+
for file in self._get_files(cache_root, self.optional_depends):
|
|
43
54
|
if file.exists():
|
|
44
55
|
cp.add(str(file))
|
|
45
56
|
return [*self.java_args, "-cp", os.path.pathsep.join(cp), self.name]
|
|
@@ -61,6 +72,15 @@ class _Dependency(dict):
|
|
|
61
72
|
"""Требуется ли для всего JAR"""
|
|
62
73
|
self.size: int | None = self.get("size")
|
|
63
74
|
self.version: str = self["version"]
|
|
75
|
+
self.platforms: set[str] = set(self.get("platforms") or [])
|
|
76
|
+
|
|
77
|
+
@property
|
|
78
|
+
def need_to_install(self):
|
|
79
|
+
# Если список пуст - всегда требуется
|
|
80
|
+
if self.platforms:
|
|
81
|
+
if sys.platform not in self.platforms:
|
|
82
|
+
return False
|
|
83
|
+
return True
|
|
64
84
|
|
|
65
85
|
def __hash__(self):
|
|
66
86
|
return hash(f"{_rand}_{self.file_url}")
|
|
@@ -83,15 +103,51 @@ class _Dependency(dict):
|
|
|
83
103
|
"""URL для скачивания файла"""
|
|
84
104
|
return f"{self.repository_url}/{self.group.replace(".", "/")}/{self.artifact}/{self.version}/{self.artifact}-{self.version}{self.classifier}.{self.ext}"
|
|
85
105
|
|
|
106
|
+
@cached_property
|
|
107
|
+
def dependencies(self) -> "set[_Dependency]":
|
|
108
|
+
from . import manager
|
|
109
|
+
pom_file = (manager.cache_root / self.file_name).with_name(f"{self.artifact}-{self.version}.pom")
|
|
110
|
+
if not pom_file.exists():
|
|
111
|
+
pom_file.parent.any_mkdir()
|
|
112
|
+
pom_url = f"{self.repository_url}/{self.group.replace(".", "/")}/{self.artifact}/{self.version}/{self.artifact}-{self.version}.pom"
|
|
113
|
+
manager.downloader.download2file(pom_url, pom_file)
|
|
114
|
+
et = ElementTree.parse(pom_file).getroot()
|
|
115
|
+
result = set()
|
|
116
|
+
for rootItem in et:
|
|
117
|
+
if rootItem.tag.endswith("dependencies"):
|
|
118
|
+
for depItem in rootItem:
|
|
119
|
+
if depItem.tag.endswith("dependency"):
|
|
120
|
+
data = {"scope": "compile"}
|
|
121
|
+
for metaItem in depItem:
|
|
122
|
+
if metaItem.text:
|
|
123
|
+
if metaItem.tag.endswith("artifactId"):
|
|
124
|
+
data["artifact"] = metaItem.text
|
|
125
|
+
if metaItem.tag.endswith("groupId"):
|
|
126
|
+
data["group"] = metaItem.text
|
|
127
|
+
for k in ("classifier", "scope", "version"):
|
|
128
|
+
if metaItem.tag.endswith(k):
|
|
129
|
+
data[k] = metaItem.text
|
|
130
|
+
if all(data.get(i) for i in ("group", "artifact", "version")) and data["scope"] in ("compile", "runtime"):
|
|
131
|
+
result.add(self._root._get_depend(data))
|
|
132
|
+
return result
|
|
133
|
+
|
|
134
|
+
@cached_property
|
|
135
|
+
def recursive_dependencies(self) -> "set[_Dependency]":
|
|
136
|
+
result = self.dependencies.copy()
|
|
137
|
+
for i in list(result):
|
|
138
|
+
result.update(i.recursive_dependencies)
|
|
139
|
+
return result
|
|
140
|
+
|
|
86
141
|
|
|
87
142
|
class InfoFile(dict):
|
|
88
143
|
"""Информация для запуска JAR"""
|
|
89
144
|
|
|
90
145
|
def __init__(self, map):
|
|
91
146
|
super().__init__(map)
|
|
147
|
+
self._depend_cache: dict[str, _Dependency] = {}
|
|
92
148
|
self.classes: dict[str, _ClassInfo] = {k: _ClassInfo(self, v) for k, v in self["classes"].items()}
|
|
93
149
|
"""Все доступные для запуска классы"""
|
|
94
|
-
self.dependencies: dict[str, _Dependency] = {k:
|
|
150
|
+
self.dependencies: dict[str, _Dependency] = {k: self._get_depend(v) for k, v in (self.get("dependencies") or {}).items()}
|
|
95
151
|
"""Список зависимостей (`alias:info`)"""
|
|
96
152
|
self.format: int = self["format"]
|
|
97
153
|
"""Формат файла"""
|
|
@@ -101,6 +157,14 @@ class InfoFile(dict):
|
|
|
101
157
|
"""Название основного класса"""
|
|
102
158
|
self.repositories: dict[str, str] = {k: v.rstrip("/") for k, v in (self.get("repositories") or {})}
|
|
103
159
|
"""Список дополнительных репозиториев (`name:url`)"""
|
|
160
|
+
|
|
161
|
+
def _get_depend(self, map):
|
|
162
|
+
"""Кэширование зависимостей чтобы избежать повторного скачивания POM файлов"""
|
|
163
|
+
depend = _Dependency(self, map)
|
|
164
|
+
if depend.file_url not in self._depend_cache:
|
|
165
|
+
self._depend_cache[depend.file_url] = depend
|
|
166
|
+
return self._depend_cache[depend.file_url]
|
|
167
|
+
|
|
104
168
|
@property
|
|
105
169
|
def main_class(self):
|
|
106
170
|
"""Основной класс"""
|
|
@@ -144,7 +144,7 @@ def hash_check(args=None):
|
|
|
144
144
|
completed.append(file)
|
|
145
145
|
|
|
146
146
|
|
|
147
|
-
def run_java_ext(argv: list[str] = None):
|
|
147
|
+
def run_java_ext(argv: list[str] = None, **kw):
|
|
148
148
|
if argv is None:
|
|
149
149
|
argv = sys.argv[1:]
|
|
150
150
|
from MainShortcuts2 import java_ext
|
|
@@ -153,11 +153,22 @@ def run_java_ext(argv: list[str] = None):
|
|
|
153
153
|
if ver is None:
|
|
154
154
|
ms.utils.mini_log("Ошибка: не удалось найти версию MS2Hash. Проверьте соединение с GitHub")
|
|
155
155
|
sys.exit(1)
|
|
156
|
+
if ver.version_name in ("1.0.0", "1.0.1"):
|
|
157
|
+
try:
|
|
158
|
+
ver = mgr.latest_online_version()
|
|
159
|
+
except Exception as exc:
|
|
160
|
+
ms.utils.mini_log("Не удалось обновить MS2Hash: %r", exc)
|
|
156
161
|
if ver.version_name in ("1.0.0", "1.0.1"):
|
|
157
162
|
# Старые версии не совместимы с новым лаунчером
|
|
158
163
|
p = ver.run(argv, check=False)
|
|
159
164
|
else:
|
|
160
165
|
# Использовать новый лаунчер
|
|
161
166
|
from MainShortcuts2 import java_launch
|
|
162
|
-
|
|
167
|
+
if ("-b" in argv) or ("--bar" in argv):
|
|
168
|
+
kw["download_optional"] = True
|
|
169
|
+
p = java_launch.manager.launch_file(ver.jar_path, argv, **kw)
|
|
163
170
|
sys.exit(p.returncode)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
def run_ms2sign(argv: list[str] = None):
|
|
174
|
+
run_java_ext(argv, class_name="ms2sign")
|
|
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
|
{mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/ex/aiohttp_ex/web/__init__.py
RENAMED
|
File without changes
|
{mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/ex/aiohttp_ex/web/__main__.py
RENAMED
|
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
|
{mainshortcuts2-2.10.1 → mainshortcuts2-2.10.2}/src/MainShortcuts2/gui_scripts/ms2_hash_gen.py
RENAMED
|
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
|