ruyi 0.45.0__py3-none-any.whl → 0.45.0a20251230__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.
- ruyi/__main__.py +4 -16
- ruyi/cli/cmd.py +5 -6
- ruyi/cli/config_cli.py +11 -14
- ruyi/cli/main.py +4 -14
- ruyi/cli/oobe.py +3 -7
- ruyi/cli/self_cli.py +34 -48
- ruyi/cli/user_input.py +12 -42
- ruyi/cli/version_cli.py +5 -11
- ruyi/config/__init__.py +2 -26
- ruyi/config/errors.py +7 -19
- ruyi/device/provision.py +55 -116
- ruyi/device/provision_cli.py +3 -6
- ruyi/log/__init__.py +5 -6
- ruyi/mux/runtime.py +6 -19
- ruyi/mux/venv/maker.py +35 -93
- ruyi/mux/venv/venv_cli.py +10 -13
- ruyi/pluginhost/plugin_cli.py +3 -4
- ruyi/resource_bundle/__init__.py +8 -22
- ruyi/resource_bundle/__main__.py +5 -6
- ruyi/resource_bundle/data.py +9 -13
- ruyi/ruyipkg/admin_checksum.py +1 -4
- ruyi/ruyipkg/admin_cli.py +6 -9
- ruyi/ruyipkg/augmented_pkg.py +14 -15
- ruyi/ruyipkg/checksum.py +2 -8
- ruyi/ruyipkg/distfile.py +9 -33
- ruyi/ruyipkg/entity.py +2 -12
- ruyi/ruyipkg/entity_cli.py +12 -20
- ruyi/ruyipkg/entity_provider.py +2 -11
- ruyi/ruyipkg/fetcher.py +9 -38
- ruyi/ruyipkg/install.py +42 -143
- ruyi/ruyipkg/install_cli.py +15 -18
- ruyi/ruyipkg/list.py +20 -27
- ruyi/ruyipkg/list_cli.py +7 -12
- ruyi/ruyipkg/news.py +11 -23
- ruyi/ruyipkg/news_cli.py +7 -10
- ruyi/ruyipkg/profile_cli.py +2 -8
- ruyi/ruyipkg/repo.py +8 -22
- ruyi/ruyipkg/unpack.py +8 -42
- ruyi/ruyipkg/unpack_method.py +1 -5
- ruyi/ruyipkg/update_cli.py +3 -8
- ruyi/telemetry/provider.py +29 -74
- ruyi/telemetry/telemetry_cli.py +8 -9
- ruyi/utils/git.py +11 -18
- ruyi/utils/prereqs.py +5 -10
- ruyi/utils/ssl_patch.py +1 -2
- ruyi/version.py +3 -9
- {ruyi-0.45.0.dist-info → ruyi-0.45.0a20251230.dist-info}/METADATA +1 -2
- ruyi-0.45.0a20251230.dist-info/RECORD +102 -0
- {ruyi-0.45.0.dist-info → ruyi-0.45.0a20251230.dist-info}/WHEEL +1 -1
- ruyi/i18n/__init__.py +0 -129
- ruyi-0.45.0.dist-info/RECORD +0 -103
- {ruyi-0.45.0.dist-info → ruyi-0.45.0a20251230.dist-info}/entry_points.txt +0 -0
- {ruyi-0.45.0.dist-info → ruyi-0.45.0a20251230.dist-info}/licenses/LICENSE-Apache.txt +0 -0
ruyi/ruyipkg/list.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
from itertools import chain
|
|
2
2
|
|
|
3
3
|
from ..config import GlobalConfig
|
|
4
|
-
from ..i18n import _
|
|
5
4
|
from ..log import RuyiLogger
|
|
6
5
|
from ..utils.porcelain import PorcelainOutput
|
|
7
6
|
from .augmented_pkg import AugmentedPkg
|
|
@@ -23,11 +22,9 @@ def do_list(
|
|
|
23
22
|
# all packages either
|
|
24
23
|
return 1
|
|
25
24
|
|
|
26
|
-
logger.F(
|
|
25
|
+
logger.F("no filter specified for list operation")
|
|
27
26
|
logger.I(
|
|
28
|
-
|
|
29
|
-
"for the old behavior of listing all packages, try [yellow]ruyi list --name-contains ''[/]"
|
|
30
|
-
)
|
|
27
|
+
"for the old behavior of listing all packages, try [yellow]ruyi list --name-contains ''[/]"
|
|
31
28
|
)
|
|
32
29
|
return 1
|
|
33
30
|
|
|
@@ -52,7 +49,7 @@ def _do_list_non_verbose(
|
|
|
52
49
|
logger: RuyiLogger,
|
|
53
50
|
augmented_pkgs: list[AugmentedPkg],
|
|
54
51
|
) -> int:
|
|
55
|
-
logger.stdout(
|
|
52
|
+
logger.stdout("List of available packages:\n")
|
|
56
53
|
|
|
57
54
|
for ap in augmented_pkgs:
|
|
58
55
|
logger.stdout(f"* [bold green]{ap.category}/{ap.name}[/]")
|
|
@@ -85,49 +82,45 @@ def _print_pkg_detail(
|
|
|
85
82
|
logger.stdout(f"[bold]## [green]{pm.category}/{pm.name}[/] [blue]{pm.ver}[/][/]\n")
|
|
86
83
|
|
|
87
84
|
if pm.slug is not None:
|
|
88
|
-
logger.stdout(
|
|
85
|
+
logger.stdout(f"* Slug: [yellow]{pm.slug}[/]")
|
|
89
86
|
else:
|
|
90
|
-
logger.stdout(
|
|
91
|
-
logger.stdout(
|
|
92
|
-
logger.stdout(
|
|
87
|
+
logger.stdout("* Slug: (none)")
|
|
88
|
+
logger.stdout(f"* Package kind: {sorted(pm.kind)}")
|
|
89
|
+
logger.stdout(f"* Vendor: {pm.vendor_name}")
|
|
93
90
|
if upstream_ver := pm.upstream_version:
|
|
94
|
-
logger.stdout(
|
|
95
|
-
_("* Upstream version number: {version}").format(version=upstream_ver)
|
|
96
|
-
)
|
|
91
|
+
logger.stdout(f"* Upstream version number: {upstream_ver}")
|
|
97
92
|
else:
|
|
98
|
-
logger.stdout(
|
|
93
|
+
logger.stdout("* Upstream version number: (undeclared)")
|
|
99
94
|
logger.stdout("")
|
|
100
95
|
|
|
101
96
|
sv = pm.service_level
|
|
102
97
|
if sv.has_known_issues:
|
|
103
|
-
logger.stdout(
|
|
98
|
+
logger.stdout("\nPackage has known issue(s):\n")
|
|
104
99
|
for x in sv.render_known_issues(pm.repo.messages, lang_code):
|
|
105
100
|
logger.stdout(x, end="\n\n")
|
|
106
101
|
|
|
107
102
|
df = pm.distfiles
|
|
108
|
-
logger.stdout(
|
|
103
|
+
logger.stdout(f"Package declares {len(df)} distfile(s):\n")
|
|
109
104
|
for dd in df.values():
|
|
110
105
|
logger.stdout(f"* [green]{dd.name}[/]")
|
|
111
|
-
logger.stdout(
|
|
106
|
+
logger.stdout(f" - Size: [yellow]{dd.size}[/] bytes")
|
|
112
107
|
for kind, csum in dd.checksums.items():
|
|
113
108
|
logger.stdout(f" - {kind.upper()}: [yellow]{csum}[/]")
|
|
114
109
|
|
|
115
110
|
if bm := pm.binary_metadata:
|
|
116
|
-
logger.stdout(
|
|
111
|
+
logger.stdout("\n### Binary artifacts\n")
|
|
117
112
|
for host, data in bm.data.items():
|
|
118
|
-
logger.stdout(
|
|
119
|
-
logger.stdout(
|
|
120
|
-
_(" - Distfiles: {distfiles}").format(distfiles=data["distfiles"])
|
|
121
|
-
)
|
|
113
|
+
logger.stdout(f"* Host [green]{host}[/]:")
|
|
114
|
+
logger.stdout(f" - Distfiles: {data['distfiles']}")
|
|
122
115
|
if cmds := data.get("commands"):
|
|
123
|
-
logger.stdout(
|
|
116
|
+
logger.stdout(" - Available command(s):")
|
|
124
117
|
for k in sorted(cmds.keys()):
|
|
125
118
|
logger.stdout(f" - [green]{k}[/]")
|
|
126
119
|
|
|
127
120
|
if tm := pm.toolchain_metadata:
|
|
128
|
-
logger.stdout(
|
|
129
|
-
logger.stdout(
|
|
130
|
-
logger.stdout(
|
|
131
|
-
logger.stdout(
|
|
121
|
+
logger.stdout("\n### Toolchain metadata\n")
|
|
122
|
+
logger.stdout(f"* Target: [bold green]{tm.target}[/]")
|
|
123
|
+
logger.stdout(f"* Quirks: {tm.quirks}")
|
|
124
|
+
logger.stdout("* Components:")
|
|
132
125
|
for tc in tm.components:
|
|
133
126
|
logger.stdout(f' - {tc["name"]} [bold green]{tc["version"]}[/]')
|
ruyi/ruyipkg/list_cli.py
CHANGED
|
@@ -2,7 +2,6 @@ import argparse
|
|
|
2
2
|
from typing import TYPE_CHECKING
|
|
3
3
|
|
|
4
4
|
from ..cli.cmd import RootCommand
|
|
5
|
-
from ..i18n import _
|
|
6
5
|
from .list_filter import ListFilter, ListFilterAction
|
|
7
6
|
|
|
8
7
|
if TYPE_CHECKING:
|
|
@@ -16,7 +15,7 @@ class ListCommand(
|
|
|
16
15
|
has_subcommands=True,
|
|
17
16
|
is_subcommand_required=False,
|
|
18
17
|
has_main=True,
|
|
19
|
-
help=
|
|
18
|
+
help="List available packages in configured repository",
|
|
20
19
|
):
|
|
21
20
|
@classmethod
|
|
22
21
|
def configure_args(cls, gc: "GlobalConfig", p: "ArgumentParser") -> None:
|
|
@@ -24,7 +23,7 @@ class ListCommand(
|
|
|
24
23
|
"--verbose",
|
|
25
24
|
"-v",
|
|
26
25
|
action="store_true",
|
|
27
|
-
help=
|
|
26
|
+
help="Also show details for every package",
|
|
28
27
|
)
|
|
29
28
|
|
|
30
29
|
# filter expressions
|
|
@@ -33,32 +32,28 @@ class ListCommand(
|
|
|
33
32
|
action=ListFilterAction,
|
|
34
33
|
nargs=1,
|
|
35
34
|
dest="filters",
|
|
36
|
-
help=
|
|
37
|
-
"Match packages that are installed (y/true/1) or not installed (n/false/0)"
|
|
38
|
-
),
|
|
35
|
+
help="Match packages that are installed (y/true/1) or not installed (n/false/0)",
|
|
39
36
|
)
|
|
40
37
|
p.add_argument(
|
|
41
38
|
"--category-contains",
|
|
42
39
|
action=ListFilterAction,
|
|
43
40
|
nargs=1,
|
|
44
41
|
dest="filters",
|
|
45
|
-
help=
|
|
46
|
-
"Match packages from categories whose names contain the given string"
|
|
47
|
-
),
|
|
42
|
+
help="Match packages from categories whose names contain the given string",
|
|
48
43
|
)
|
|
49
44
|
p.add_argument(
|
|
50
45
|
"--category-is",
|
|
51
46
|
action=ListFilterAction,
|
|
52
47
|
nargs=1,
|
|
53
48
|
dest="filters",
|
|
54
|
-
help=
|
|
49
|
+
help="Match packages from the given category",
|
|
55
50
|
)
|
|
56
51
|
p.add_argument(
|
|
57
52
|
"--name-contains",
|
|
58
53
|
action=ListFilterAction,
|
|
59
54
|
nargs=1,
|
|
60
55
|
dest="filters",
|
|
61
|
-
help=
|
|
56
|
+
help="Match packages whose names contain the given string",
|
|
62
57
|
)
|
|
63
58
|
|
|
64
59
|
if gc.is_experimental:
|
|
@@ -67,7 +62,7 @@ class ListCommand(
|
|
|
67
62
|
action=ListFilterAction,
|
|
68
63
|
nargs=1,
|
|
69
64
|
dest="filters",
|
|
70
|
-
help=
|
|
65
|
+
help="Match packages related to the given entity",
|
|
71
66
|
)
|
|
72
67
|
|
|
73
68
|
@classmethod
|
ruyi/ruyipkg/news.py
CHANGED
|
@@ -2,7 +2,6 @@ from rich import box
|
|
|
2
2
|
from rich.table import Table
|
|
3
3
|
|
|
4
4
|
from ..config import GlobalConfig
|
|
5
|
-
from ..i18n import _
|
|
6
5
|
from ..log import RuyiLogger
|
|
7
6
|
from ..utils.markdown import RuyiStyledMarkdown
|
|
8
7
|
from ..utils.porcelain import PorcelainOutput
|
|
@@ -15,12 +14,9 @@ def print_news_item_titles(
|
|
|
15
14
|
lang: str,
|
|
16
15
|
) -> None:
|
|
17
16
|
tbl = Table(box=box.SIMPLE, show_edge=False)
|
|
18
|
-
|
|
19
|
-
tbl.add_column(
|
|
20
|
-
|
|
21
|
-
tbl.add_column(_("ID"))
|
|
22
|
-
# i18n NOTE: used as news item table title
|
|
23
|
-
tbl.add_column(_("Title"))
|
|
17
|
+
tbl.add_column("No.")
|
|
18
|
+
tbl.add_column("ID")
|
|
19
|
+
tbl.add_column("Title")
|
|
24
20
|
|
|
25
21
|
for ni in newsitems:
|
|
26
22
|
unread = not ni.is_read
|
|
@@ -44,20 +40,14 @@ def maybe_notify_unread_news(
|
|
|
44
40
|
|
|
45
41
|
unread_newsitems = gc.repo.news_store().list(True)
|
|
46
42
|
if unread_newsitems:
|
|
47
|
-
gc.logger.stdout(
|
|
48
|
-
_("\nThere are {count} new news item(s):\n").format(
|
|
49
|
-
count=len(unread_newsitems),
|
|
50
|
-
)
|
|
51
|
-
)
|
|
43
|
+
gc.logger.stdout(f"\nThere are {len(unread_newsitems)} new news item(s):\n")
|
|
52
44
|
print_news_item_titles(gc.logger, unread_newsitems, gc.lang_code)
|
|
53
|
-
gc.logger.stdout(
|
|
45
|
+
gc.logger.stdout("\nYou can read them with [yellow]ruyi news read[/].")
|
|
54
46
|
return
|
|
55
47
|
|
|
56
48
|
if prompt_no_unread:
|
|
57
49
|
gc.logger.stdout(
|
|
58
|
-
|
|
59
|
-
"\nAll news items have been read. To see a list of them, run [yellow]ruyi news list[/].\n"
|
|
60
|
-
)
|
|
50
|
+
"\nAll news items have been read. To see a list of them, run [yellow]ruyi news list[/].\n"
|
|
61
51
|
)
|
|
62
52
|
|
|
63
53
|
|
|
@@ -75,9 +65,9 @@ def do_news_list(
|
|
|
75
65
|
po.emit(ni.to_porcelain())
|
|
76
66
|
return 0
|
|
77
67
|
|
|
78
|
-
logger.stdout(
|
|
68
|
+
logger.stdout("[bold green]News items:[/]\n")
|
|
79
69
|
if not newsitems:
|
|
80
|
-
logger.stdout(
|
|
70
|
+
logger.stdout(" (no unread item)" if only_unread else " (no item)")
|
|
81
71
|
return 0
|
|
82
72
|
|
|
83
73
|
print_news_item_titles(logger, newsitems, cfg.lang_code)
|
|
@@ -108,7 +98,7 @@ def do_news_read(
|
|
|
108
98
|
for ni in items:
|
|
109
99
|
print_news(logger, ni.get_content_for_lang(cfg.lang_code))
|
|
110
100
|
else:
|
|
111
|
-
logger.stdout(
|
|
101
|
+
logger.stdout("No news to display.")
|
|
112
102
|
|
|
113
103
|
# record read statuses
|
|
114
104
|
store.mark_as_read(*(ni.id for ni in items))
|
|
@@ -133,15 +123,13 @@ def filter_news_items_by_specs(
|
|
|
133
123
|
try:
|
|
134
124
|
ni_ord = int(i)
|
|
135
125
|
if ni_ord not in ni_by_ord:
|
|
136
|
-
logger.F(
|
|
137
|
-
_("there is no news item with ordinal {ord}").format(ord=ni_ord)
|
|
138
|
-
)
|
|
126
|
+
logger.F(f"there is no news item with ordinal {ni_ord}")
|
|
139
127
|
return None
|
|
140
128
|
items.append(ni_by_ord[ni_ord])
|
|
141
129
|
except ValueError:
|
|
142
130
|
# treat i as id
|
|
143
131
|
if i not in ni_by_id:
|
|
144
|
-
logger.F(
|
|
132
|
+
logger.F(f"there is no news item with ID '{i}'")
|
|
145
133
|
return None
|
|
146
134
|
items.append(ni_by_id[i])
|
|
147
135
|
|
ruyi/ruyipkg/news_cli.py
CHANGED
|
@@ -2,7 +2,6 @@ import argparse
|
|
|
2
2
|
from typing import TYPE_CHECKING
|
|
3
3
|
|
|
4
4
|
from ..cli.cmd import RootCommand
|
|
5
|
-
from ..i18n import _
|
|
6
5
|
|
|
7
6
|
if TYPE_CHECKING:
|
|
8
7
|
from ..cli.completion import ArgumentParser
|
|
@@ -15,7 +14,7 @@ class NewsCommand(
|
|
|
15
14
|
has_subcommands=True,
|
|
16
15
|
is_subcommand_required=False,
|
|
17
16
|
has_main=True,
|
|
18
|
-
help=
|
|
17
|
+
help="List and read news items from configured repository",
|
|
19
18
|
):
|
|
20
19
|
_my_parser: "ArgumentParser | None" = None
|
|
21
20
|
|
|
@@ -37,14 +36,14 @@ class NewsCommand(
|
|
|
37
36
|
class NewsListCommand(
|
|
38
37
|
NewsCommand,
|
|
39
38
|
cmd="list",
|
|
40
|
-
help=
|
|
39
|
+
help="List news items",
|
|
41
40
|
):
|
|
42
41
|
@classmethod
|
|
43
42
|
def configure_args(cls, gc: "GlobalConfig", p: "ArgumentParser") -> None:
|
|
44
43
|
p.add_argument(
|
|
45
44
|
"--new",
|
|
46
45
|
action="store_true",
|
|
47
|
-
help=
|
|
46
|
+
help="List unread news items only",
|
|
48
47
|
)
|
|
49
48
|
|
|
50
49
|
@classmethod
|
|
@@ -61,10 +60,8 @@ class NewsListCommand(
|
|
|
61
60
|
class NewsReadCommand(
|
|
62
61
|
NewsCommand,
|
|
63
62
|
cmd="read",
|
|
64
|
-
help=
|
|
65
|
-
description=
|
|
66
|
-
"Outputs news item(s) to the console and mark as already read. Defaults to reading all unread items if no item is specified."
|
|
67
|
-
),
|
|
63
|
+
help="Read news items",
|
|
64
|
+
description="Outputs news item(s) to the console and mark as already read. Defaults to reading all unread items if no item is specified.",
|
|
68
65
|
):
|
|
69
66
|
@classmethod
|
|
70
67
|
def configure_args(cls, gc: "GlobalConfig", p: "ArgumentParser") -> None:
|
|
@@ -72,13 +69,13 @@ class NewsReadCommand(
|
|
|
72
69
|
"--quiet",
|
|
73
70
|
"-q",
|
|
74
71
|
action="store_true",
|
|
75
|
-
help=
|
|
72
|
+
help="Do not output anything and only mark as read",
|
|
76
73
|
)
|
|
77
74
|
p.add_argument(
|
|
78
75
|
"item",
|
|
79
76
|
type=str,
|
|
80
77
|
nargs="*",
|
|
81
|
-
help=
|
|
78
|
+
help="Ordinal or ID of the news item(s) to read",
|
|
82
79
|
)
|
|
83
80
|
|
|
84
81
|
@classmethod
|
ruyi/ruyipkg/profile_cli.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import argparse
|
|
2
2
|
from typing import TYPE_CHECKING
|
|
3
3
|
|
|
4
|
-
from ..i18n import _
|
|
5
4
|
from .list_cli import ListCommand
|
|
6
5
|
|
|
7
6
|
if TYPE_CHECKING:
|
|
@@ -12,7 +11,7 @@ if TYPE_CHECKING:
|
|
|
12
11
|
class ListProfilesCommand(
|
|
13
12
|
ListCommand,
|
|
14
13
|
cmd="profiles",
|
|
15
|
-
help=
|
|
14
|
+
help="List all available profiles",
|
|
16
15
|
):
|
|
17
16
|
@classmethod
|
|
18
17
|
def configure_args(cls, gc: "GlobalConfig", p: "ArgumentParser") -> None:
|
|
@@ -29,11 +28,6 @@ class ListProfilesCommand(
|
|
|
29
28
|
logger.stdout(p.id)
|
|
30
29
|
continue
|
|
31
30
|
|
|
32
|
-
logger.stdout(
|
|
33
|
-
_("{profile_id} (needs quirks: {need_quirks})").format(
|
|
34
|
-
profile_id=p.id,
|
|
35
|
-
need_quirks=p.need_quirks,
|
|
36
|
-
)
|
|
37
|
-
)
|
|
31
|
+
logger.stdout(f"{p.id} (needs quirks: {p.need_quirks})")
|
|
38
32
|
|
|
39
33
|
return 0
|
ruyi/ruyipkg/repo.py
CHANGED
|
@@ -19,7 +19,6 @@ from urllib import parse
|
|
|
19
19
|
from pygit2 import clone_repository
|
|
20
20
|
from pygit2.repository import Repository
|
|
21
21
|
|
|
22
|
-
from ..i18n import _
|
|
23
22
|
from ..log import RuyiLogger
|
|
24
23
|
from ..pluginhost.ctx import PluginHostContext
|
|
25
24
|
from ..telemetry.scope import TelemetryScopeConfig
|
|
@@ -168,9 +167,7 @@ class RepoConfig:
|
|
|
168
167
|
return [url]
|
|
169
168
|
case _:
|
|
170
169
|
# deny others
|
|
171
|
-
logger.W(
|
|
172
|
-
_("unrecognized dist URL scheme: {scheme}").format(scheme=u.scheme)
|
|
173
|
-
)
|
|
170
|
+
logger.W(f"unrecognized dist URL scheme: {u.scheme}")
|
|
174
171
|
return []
|
|
175
172
|
|
|
176
173
|
def get_mirror_urls_for_file(self, mirror_id: str, path: str) -> list[str]:
|
|
@@ -289,13 +286,9 @@ class MetadataRepo(ProvidesPackageManifests):
|
|
|
289
286
|
return self.repo
|
|
290
287
|
|
|
291
288
|
self.logger.I(
|
|
292
|
-
|
|
293
|
-
root=self.root
|
|
294
|
-
)
|
|
295
|
-
)
|
|
296
|
-
self.logger.I(
|
|
297
|
-
_("cloning from [cyan link={remote}]{remote}[/]").format(remote=self.remote)
|
|
289
|
+
f"the package repository does not exist at [yellow]{self.root}[/]"
|
|
298
290
|
)
|
|
291
|
+
self.logger.I(f"cloning from [cyan link={self.remote}]{self.remote}[/]")
|
|
299
292
|
|
|
300
293
|
with RemoteGitProgressIndicator() as pr:
|
|
301
294
|
repo = clone_repository(
|
|
@@ -317,7 +310,7 @@ class MetadataRepo(ProvidesPackageManifests):
|
|
|
317
310
|
return self.repo
|
|
318
311
|
|
|
319
312
|
def sync(self) -> None:
|
|
320
|
-
self._gc.logger.I(
|
|
313
|
+
self._gc.logger.I("updating the package repository")
|
|
321
314
|
|
|
322
315
|
repo = self.ensure_git_repo()
|
|
323
316
|
|
|
@@ -334,7 +327,7 @@ class MetadataRepo(ProvidesPackageManifests):
|
|
|
334
327
|
allow_auto_management=allow_auto_management,
|
|
335
328
|
)
|
|
336
329
|
|
|
337
|
-
self._gc.logger.I(
|
|
330
|
+
self._gc.logger.I("package repository is updated")
|
|
338
331
|
|
|
339
332
|
@property
|
|
340
333
|
def global_config(self) -> "GlobalConfig":
|
|
@@ -612,9 +605,7 @@ class MetadataRepo(ProvidesPackageManifests):
|
|
|
612
605
|
contents = fp.read()
|
|
613
606
|
except UnicodeDecodeError:
|
|
614
607
|
self.logger.W(
|
|
615
|
-
|
|
616
|
-
path=os.path.join(news_dir, f)
|
|
617
|
-
)
|
|
608
|
+
f"UnicodeDecodeError: {os.path.join(news_dir, f)}"
|
|
618
609
|
)
|
|
619
610
|
continue
|
|
620
611
|
cache.add(f, contents) # may fail but failures are harmless
|
|
@@ -647,14 +638,9 @@ class MetadataRepo(ProvidesPackageManifests):
|
|
|
647
638
|
ret = self.eval_plugin_fn(plugin_entrypoint, args)
|
|
648
639
|
if not isinstance(ret, int):
|
|
649
640
|
self.logger.W(
|
|
650
|
-
|
|
651
|
-
"unexpected return type of cmd plugin '{plugin_id}': {type} is not int."
|
|
652
|
-
).format(
|
|
653
|
-
plugin_id=plugin_id,
|
|
654
|
-
type=type(ret),
|
|
655
|
-
)
|
|
641
|
+
f"unexpected return type of cmd plugin '{plugin_id}': {type(ret)} is not int."
|
|
656
642
|
)
|
|
657
|
-
self.logger.I(
|
|
643
|
+
self.logger.I("forcing return code to 1; the plugin should be fixed")
|
|
658
644
|
ret = 1
|
|
659
645
|
return ret
|
|
660
646
|
|
ruyi/ruyipkg/unpack.py
CHANGED
|
@@ -4,7 +4,6 @@ import shutil
|
|
|
4
4
|
import subprocess
|
|
5
5
|
from typing import Any, BinaryIO, NoReturn, Protocol
|
|
6
6
|
|
|
7
|
-
from ..i18n import _
|
|
8
7
|
from ..log import RuyiLogger
|
|
9
8
|
from ..utils import ar, prereqs
|
|
10
9
|
from .unpack_method import (
|
|
@@ -193,12 +192,7 @@ def _do_unpack_tar(
|
|
|
193
192
|
retcode = p.wait()
|
|
194
193
|
|
|
195
194
|
if retcode != 0:
|
|
196
|
-
raise RuntimeError(
|
|
197
|
-
_("untar failed: command {cmd} returned {retcode}").format(
|
|
198
|
-
cmd=" ".join(argv),
|
|
199
|
-
retcode=retcode,
|
|
200
|
-
)
|
|
201
|
-
)
|
|
195
|
+
raise RuntimeError(f"untar failed: command {' '.join(argv)} returned {retcode}")
|
|
202
196
|
|
|
203
197
|
|
|
204
198
|
def _do_unpack_zip(
|
|
@@ -212,12 +206,7 @@ def _do_unpack_zip(
|
|
|
212
206
|
logger.D(f"about to call unzip: argv={argv}")
|
|
213
207
|
retcode = subprocess.call(argv, cwd=dest)
|
|
214
208
|
if retcode != 0:
|
|
215
|
-
raise RuntimeError(
|
|
216
|
-
_("unzip failed: command {cmd} returned {retcode}").format(
|
|
217
|
-
cmd=" ".join(argv),
|
|
218
|
-
retcode=retcode,
|
|
219
|
-
)
|
|
220
|
-
)
|
|
209
|
+
raise RuntimeError(f"unzip failed: command {' '.join(argv)} returned {retcode}")
|
|
221
210
|
|
|
222
211
|
|
|
223
212
|
def _do_unpack_bare_gz(
|
|
@@ -237,10 +226,7 @@ def _do_unpack_bare_gz(
|
|
|
237
226
|
retcode = subprocess.call(argv, stdout=out)
|
|
238
227
|
if retcode != 0:
|
|
239
228
|
raise RuntimeError(
|
|
240
|
-
|
|
241
|
-
cmd=" ".join(argv),
|
|
242
|
-
retcode=retcode,
|
|
243
|
-
)
|
|
229
|
+
f"gunzip failed: command {' '.join(argv)} returned {retcode}"
|
|
244
230
|
)
|
|
245
231
|
|
|
246
232
|
|
|
@@ -261,10 +247,7 @@ def _do_unpack_bare_bzip2(
|
|
|
261
247
|
retcode = subprocess.call(argv, stdout=out)
|
|
262
248
|
if retcode != 0:
|
|
263
249
|
raise RuntimeError(
|
|
264
|
-
|
|
265
|
-
cmd=" ".join(argv),
|
|
266
|
-
retcode=retcode,
|
|
267
|
-
)
|
|
250
|
+
f"bzip2 failed: command {' '.join(argv)} returned {retcode}"
|
|
268
251
|
)
|
|
269
252
|
|
|
270
253
|
|
|
@@ -280,12 +263,7 @@ def _do_unpack_bare_lz4(
|
|
|
280
263
|
logger.D(f"about to call lz4: argv={argv}")
|
|
281
264
|
retcode = subprocess.call(argv, cwd=destdir)
|
|
282
265
|
if retcode != 0:
|
|
283
|
-
raise RuntimeError(
|
|
284
|
-
_("lz4 failed: command {cmd} returned {retcode}").format(
|
|
285
|
-
cmd=" ".join(argv),
|
|
286
|
-
retcode=retcode,
|
|
287
|
-
)
|
|
288
|
-
)
|
|
266
|
+
raise RuntimeError(f"lz4 failed: command {' '.join(argv)} returned {retcode}")
|
|
289
267
|
|
|
290
268
|
|
|
291
269
|
def _do_unpack_bare_xz(
|
|
@@ -305,10 +283,7 @@ def _do_unpack_bare_xz(
|
|
|
305
283
|
retcode = subprocess.call(argv, stdout=out)
|
|
306
284
|
if retcode != 0:
|
|
307
285
|
raise RuntimeError(
|
|
308
|
-
|
|
309
|
-
cmd=" ".join(argv),
|
|
310
|
-
retcode=retcode,
|
|
311
|
-
)
|
|
286
|
+
f"xz failed: command {' '.join(argv)} returned {retcode}"
|
|
312
287
|
)
|
|
313
288
|
|
|
314
289
|
|
|
@@ -324,12 +299,7 @@ def _do_unpack_bare_zstd(
|
|
|
324
299
|
logger.D(f"about to call zstd: argv={argv}")
|
|
325
300
|
retcode = subprocess.call(argv, cwd=destdir)
|
|
326
301
|
if retcode != 0:
|
|
327
|
-
raise RuntimeError(
|
|
328
|
-
_("zstd failed: command {cmd} returned {retcode}").format(
|
|
329
|
-
cmd=" ".join(argv),
|
|
330
|
-
retcode=retcode,
|
|
331
|
-
)
|
|
332
|
-
)
|
|
302
|
+
raise RuntimeError(f"zstd failed: command {' '.join(argv)} returned {retcode}")
|
|
333
303
|
|
|
334
304
|
|
|
335
305
|
def _do_unpack_deb(
|
|
@@ -351,11 +321,7 @@ def _do_unpack_deb(
|
|
|
351
321
|
a.open(f),
|
|
352
322
|
)
|
|
353
323
|
|
|
354
|
-
raise RuntimeError(
|
|
355
|
-
_("file '{filename}' does not appear to be a deb").format(
|
|
356
|
-
filename=filename,
|
|
357
|
-
)
|
|
358
|
-
)
|
|
324
|
+
raise RuntimeError(f"file '{filename}' does not appear to be a deb")
|
|
359
325
|
|
|
360
326
|
|
|
361
327
|
def _get_unpack_cmds_for_method(m: UnpackMethod) -> list[str]:
|
ruyi/ruyipkg/unpack_method.py
CHANGED
|
@@ -3,8 +3,6 @@ import re
|
|
|
3
3
|
import sys
|
|
4
4
|
from typing import Final
|
|
5
5
|
|
|
6
|
-
from ..i18n import _
|
|
7
|
-
|
|
8
6
|
RE_TARBALL: Final = re.compile(r"\.tar(?:\.gz|\.bz2|\.lz4|\.xz|\.zst)?$")
|
|
9
7
|
|
|
10
8
|
|
|
@@ -62,9 +60,7 @@ class UnrecognizedPackFormatError(Exception):
|
|
|
62
60
|
self.filename = filename
|
|
63
61
|
|
|
64
62
|
def __str__(self) -> str:
|
|
65
|
-
return
|
|
66
|
-
filename=self.filename,
|
|
67
|
-
)
|
|
63
|
+
return f"don't know how to unpack file {self.filename}"
|
|
68
64
|
|
|
69
65
|
|
|
70
66
|
def determine_unpack_method(
|
ruyi/ruyipkg/update_cli.py
CHANGED
|
@@ -2,7 +2,6 @@ import argparse
|
|
|
2
2
|
from typing import TYPE_CHECKING
|
|
3
3
|
|
|
4
4
|
from ..cli.cmd import RootCommand
|
|
5
|
-
from ..i18n import _
|
|
6
5
|
|
|
7
6
|
if TYPE_CHECKING:
|
|
8
7
|
from ..cli.completion import ArgumentParser
|
|
@@ -12,7 +11,7 @@ if TYPE_CHECKING:
|
|
|
12
11
|
class UpdateCommand(
|
|
13
12
|
RootCommand,
|
|
14
13
|
cmd="update",
|
|
15
|
-
help=
|
|
14
|
+
help="Update RuyiSDK repo and packages",
|
|
16
15
|
):
|
|
17
16
|
@classmethod
|
|
18
17
|
def configure_args(cls, gc: "GlobalConfig", p: "ArgumentParser") -> None:
|
|
@@ -33,20 +32,16 @@ class UpdateCommand(
|
|
|
33
32
|
|
|
34
33
|
if upgradable:
|
|
35
34
|
logger.stdout(
|
|
36
|
-
|
|
37
|
-
"\nNewer versions are available for some of your installed packages:\n"
|
|
38
|
-
)
|
|
35
|
+
"\nNewer versions are available for some of your installed packages:\n"
|
|
39
36
|
)
|
|
40
37
|
for pm, new_ver in upgradable:
|
|
41
38
|
logger.stdout(
|
|
42
39
|
f" - [bold]{pm.category}/{pm.name}[/]: [yellow]{pm.ver}[/] -> [green]{new_ver}[/]"
|
|
43
40
|
)
|
|
44
41
|
logger.stdout(
|
|
45
|
-
|
|
46
|
-
"""
|
|
42
|
+
"""
|
|
47
43
|
Re-run [yellow]ruyi install[/] to upgrade, and don't forget to re-create any affected
|
|
48
44
|
virtual environments."""
|
|
49
|
-
)
|
|
50
45
|
)
|
|
51
46
|
|
|
52
47
|
news.maybe_notify_unread_news(cfg, False)
|