punchboot 2.3.0__tar.gz → 2.7.0__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.
- {punchboot-2.3.0 → punchboot-2.7.0}/PKG-INFO +17 -5
- {punchboot-2.3.0 → punchboot-2.7.0}/punchboot.egg-info/PKG-INFO +17 -5
- {punchboot-2.3.0 → punchboot-2.7.0}/pyproject.toml +5 -6
- {punchboot-2.3.0 → punchboot-2.7.0}/setup.py +4 -3
- {punchboot-2.3.0 → punchboot-2.7.0}/src/lib/bpak.c +1 -1
- {punchboot-2.3.0 → punchboot-2.7.0}/tools/punchboot/punchboot/__init__.py +5 -5
- {punchboot-2.3.0 → punchboot-2.7.0}/tools/punchboot/punchboot/__main__.py +17 -14
- {punchboot-2.3.0 → punchboot-2.7.0}/tools/punchboot/punchboot/partition.py +1 -1
- {punchboot-2.3.0 → punchboot-2.7.0}/tools/punchboot/punchboot/session.py +16 -16
- {punchboot-2.3.0 → punchboot-2.7.0}/tools/punchboot/python_wrapper.c +2 -2
- {punchboot-2.3.0 → punchboot-2.7.0}/LICENSE +0 -0
- {punchboot-2.3.0 → punchboot-2.7.0}/README.md +0 -0
- {punchboot-2.3.0 → punchboot-2.7.0}/punchboot.egg-info/SOURCES.txt +0 -0
- {punchboot-2.3.0 → punchboot-2.7.0}/punchboot.egg-info/dependency_links.txt +0 -0
- {punchboot-2.3.0 → punchboot-2.7.0}/punchboot.egg-info/entry_points.txt +0 -0
- {punchboot-2.3.0 → punchboot-2.7.0}/punchboot.egg-info/requires.txt +0 -0
- {punchboot-2.3.0 → punchboot-2.7.0}/punchboot.egg-info/top_level.txt +0 -0
- {punchboot-2.3.0 → punchboot-2.7.0}/setup.cfg +0 -0
- {punchboot-2.3.0 → punchboot-2.7.0}/src/wire.c +0 -0
- {punchboot-2.3.0 → punchboot-2.7.0}/tools/punchboot/api.c +0 -0
- {punchboot-2.3.0 → punchboot-2.7.0}/tools/punchboot/api_authentication.c +0 -0
- {punchboot-2.3.0 → punchboot-2.7.0}/tools/punchboot/api_board.c +0 -0
- {punchboot-2.3.0 → punchboot-2.7.0}/tools/punchboot/api_boot.c +0 -0
- {punchboot-2.3.0 → punchboot-2.7.0}/tools/punchboot/api_device.c +0 -0
- {punchboot-2.3.0 → punchboot-2.7.0}/tools/punchboot/api_misc.c +0 -0
- {punchboot-2.3.0 → punchboot-2.7.0}/tools/punchboot/api_partition.c +0 -0
- {punchboot-2.3.0 → punchboot-2.7.0}/tools/punchboot/api_slc.c +0 -0
- {punchboot-2.3.0 → punchboot-2.7.0}/tools/punchboot/api_stream.c +0 -0
- {punchboot-2.3.0 → punchboot-2.7.0}/tools/punchboot/error.c +0 -0
- {punchboot-2.3.0 → punchboot-2.7.0}/tools/punchboot/exceptions.c +0 -0
- {punchboot-2.3.0 → punchboot-2.7.0}/tools/punchboot/punchboot/helpers.py +0 -0
- {punchboot-2.3.0 → punchboot-2.7.0}/tools/punchboot/punchboot/py.typed +0 -0
- {punchboot-2.3.0 → punchboot-2.7.0}/tools/punchboot/punchboot/slc.py +0 -0
- {punchboot-2.3.0 → punchboot-2.7.0}/tools/punchboot/socket.c +0 -0
- {punchboot-2.3.0 → punchboot-2.7.0}/tools/punchboot/usb.c +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: punchboot
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.7.0
|
|
4
4
|
Summary: Punchboot tools
|
|
5
5
|
Home-page: https://github.com/jonasblixt/punchboot
|
|
6
6
|
Author: Jonas Blixt
|
|
@@ -11,16 +11,28 @@ Classifier: Intended Audience :: Developers
|
|
|
11
11
|
Classifier: Topic :: Software Development :: Embedded Systems
|
|
12
12
|
Classifier: License :: OSI Approved :: BSD License
|
|
13
13
|
Classifier: Programming Language :: Python :: 3
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
16
14
|
Classifier: Programming Language :: Python :: 3.10
|
|
17
15
|
Classifier: Programming Language :: Python :: 3.11
|
|
18
16
|
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
-
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
20
|
+
Requires-Python: >=3.10
|
|
20
21
|
Description-Content-Type: text/markdown
|
|
21
22
|
License-File: LICENSE
|
|
22
23
|
Requires-Dist: semver<4,>=3
|
|
23
24
|
Requires-Dist: click<9,>=8
|
|
25
|
+
Dynamic: author
|
|
26
|
+
Dynamic: author-email
|
|
27
|
+
Dynamic: classifier
|
|
28
|
+
Dynamic: description
|
|
29
|
+
Dynamic: description-content-type
|
|
30
|
+
Dynamic: home-page
|
|
31
|
+
Dynamic: license
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
Dynamic: requires-dist
|
|
34
|
+
Dynamic: requires-python
|
|
35
|
+
Dynamic: summary
|
|
24
36
|
|
|
25
37
|

|
|
26
38
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: punchboot
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.7.0
|
|
4
4
|
Summary: Punchboot tools
|
|
5
5
|
Home-page: https://github.com/jonasblixt/punchboot
|
|
6
6
|
Author: Jonas Blixt
|
|
@@ -11,16 +11,28 @@ Classifier: Intended Audience :: Developers
|
|
|
11
11
|
Classifier: Topic :: Software Development :: Embedded Systems
|
|
12
12
|
Classifier: License :: OSI Approved :: BSD License
|
|
13
13
|
Classifier: Programming Language :: Python :: 3
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
16
14
|
Classifier: Programming Language :: Python :: 3.10
|
|
17
15
|
Classifier: Programming Language :: Python :: 3.11
|
|
18
16
|
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
-
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
20
|
+
Requires-Python: >=3.10
|
|
20
21
|
Description-Content-Type: text/markdown
|
|
21
22
|
License-File: LICENSE
|
|
22
23
|
Requires-Dist: semver<4,>=3
|
|
23
24
|
Requires-Dist: click<9,>=8
|
|
25
|
+
Dynamic: author
|
|
26
|
+
Dynamic: author-email
|
|
27
|
+
Dynamic: classifier
|
|
28
|
+
Dynamic: description
|
|
29
|
+
Dynamic: description-content-type
|
|
30
|
+
Dynamic: home-page
|
|
31
|
+
Dynamic: license
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
Dynamic: requires-dist
|
|
34
|
+
Dynamic: requires-python
|
|
35
|
+
Dynamic: summary
|
|
24
36
|
|
|
25
37
|

|
|
26
38
|
|
|
@@ -5,7 +5,7 @@ extend-exclude = [
|
|
|
5
5
|
"doc",
|
|
6
6
|
"scripts/**",
|
|
7
7
|
]
|
|
8
|
-
target-version = "
|
|
8
|
+
target-version = "py310"
|
|
9
9
|
|
|
10
10
|
[tool.ruff.lint]
|
|
11
11
|
# See: https://docs.astral.sh/ruff/rules/ for details
|
|
@@ -13,12 +13,10 @@ select = ["ALL"]
|
|
|
13
13
|
ignore = [
|
|
14
14
|
"COM812", # Conflicts with the formatter
|
|
15
15
|
"ISC001", # Conflicts with the formatter
|
|
16
|
-
"ANN101", # "missing-type-self"
|
|
17
16
|
"PLE0605", # ruff does not handle += in __all__
|
|
18
17
|
"FBT", # don't care for these at the moment
|
|
18
|
+
"CPY001", # Copyright notices are not used in the python sources
|
|
19
19
|
"PT001", # https://github.com/astral-sh/ruff/issues/8796#issuecomment-1825907715
|
|
20
|
-
"PT004", # https://github.com/astral-sh/ruff/issues/8796#issuecomment-1825907715
|
|
21
|
-
"PT005", # https://github.com/astral-sh/ruff/issues/8796#issuecomment-1825907715
|
|
22
20
|
"PT023", # https://github.com/astral-sh/ruff/issues/8796#issuecomment-1825907715
|
|
23
21
|
]
|
|
24
22
|
|
|
@@ -39,11 +37,12 @@ warn_return_any = true
|
|
|
39
37
|
exclude = [
|
|
40
38
|
"^build.*",
|
|
41
39
|
"^doc.*",
|
|
42
|
-
"^scripts/menuconfig\\.py$"
|
|
40
|
+
"^scripts/menuconfig\\.py$",
|
|
41
|
+
"^scripts/olddefconfig\\.py$"
|
|
43
42
|
]
|
|
44
43
|
|
|
45
44
|
[tool.cibuildwheel]
|
|
46
|
-
skip = ["*-musl*", "pp*", "*linux_i686", "*win32*"]
|
|
45
|
+
skip = ["*-musl*", "pp*", "*linux_i686", "*win32*", "cp3??t-*"]
|
|
47
46
|
|
|
48
47
|
[tool.cibuildwheel.linux]
|
|
49
48
|
before-all = "yum install -y libusbx-devel"
|
|
@@ -67,11 +67,12 @@ setup(
|
|
|
67
67
|
"Topic :: Software Development :: Embedded Systems",
|
|
68
68
|
"License :: OSI Approved :: BSD License",
|
|
69
69
|
"Programming Language :: Python :: 3",
|
|
70
|
-
"Programming Language :: Python :: 3.8",
|
|
71
|
-
"Programming Language :: Python :: 3.9",
|
|
72
70
|
"Programming Language :: Python :: 3.10",
|
|
73
71
|
"Programming Language :: Python :: 3.11",
|
|
74
72
|
"Programming Language :: Python :: 3.12",
|
|
73
|
+
"Programming Language :: Python :: 3.13",
|
|
74
|
+
"Programming Language :: Python :: 3.14",
|
|
75
|
+
"Programming Language :: Python :: 3.15",
|
|
75
76
|
],
|
|
76
77
|
url="https://github.com/jonasblixt/punchboot",
|
|
77
78
|
packages=["punchboot"],
|
|
@@ -81,7 +82,7 @@ setup(
|
|
|
81
82
|
package_data={
|
|
82
83
|
"punchboot": ["py.typed"],
|
|
83
84
|
},
|
|
84
|
-
python_requires=">=3.
|
|
85
|
+
python_requires=">=3.10",
|
|
85
86
|
entry_points={"console_scripts": ["punchboot=punchboot.__main__:cli"]},
|
|
86
87
|
ext_modules=[
|
|
87
88
|
Extension(
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
#include <string.h>
|
|
12
12
|
|
|
13
13
|
/* BPAK_META_ALIGN is a power-of-2 */
|
|
14
|
-
#define BPAK_META_ALIGN_SIZE(_x) (((_x) + ((BPAK_META_ALIGN)-1)) & ~((BPAK_META_ALIGN)-1))
|
|
14
|
+
#define BPAK_META_ALIGN_SIZE(_x) (((_x) + ((BPAK_META_ALIGN) - 1)) & ~((BPAK_META_ALIGN) - 1))
|
|
15
15
|
|
|
16
16
|
static int bpak_get_meta_int(struct bpak_header *hdr,
|
|
17
17
|
bpak_id_t id,
|
|
@@ -6,7 +6,7 @@ from _punchboot import ( # type: ignore[import-not-found] # noqa: F401
|
|
|
6
6
|
CommandError,
|
|
7
7
|
Error,
|
|
8
8
|
GenericError,
|
|
9
|
-
IOError,
|
|
9
|
+
IOError, # noqa: A004
|
|
10
10
|
KeyRevokedError,
|
|
11
11
|
MemError,
|
|
12
12
|
NoMemoryError,
|
|
@@ -17,7 +17,7 @@ from _punchboot import ( # type: ignore[import-not-found] # noqa: F401
|
|
|
17
17
|
PartVerifyError,
|
|
18
18
|
SignatureError,
|
|
19
19
|
StreamNotInitializedError,
|
|
20
|
-
TimeoutError,
|
|
20
|
+
TimeoutError, # noqa: A004
|
|
21
21
|
TransferError,
|
|
22
22
|
)
|
|
23
23
|
|
|
@@ -48,13 +48,13 @@ _pb_exceptions = [
|
|
|
48
48
|
]
|
|
49
49
|
|
|
50
50
|
__all__ = [
|
|
51
|
-
"
|
|
51
|
+
"SLC",
|
|
52
52
|
"Partition",
|
|
53
53
|
"PartitionFlags",
|
|
54
|
-
"
|
|
54
|
+
"Session",
|
|
55
55
|
"library_version",
|
|
56
|
+
"list_usb_devices",
|
|
56
57
|
"pb_id",
|
|
57
58
|
"wait_for_device",
|
|
58
|
-
"list_usb_devices",
|
|
59
59
|
]
|
|
60
60
|
__all__ += _pb_exceptions
|
|
@@ -9,9 +9,10 @@ import os
|
|
|
9
9
|
import pathlib
|
|
10
10
|
import sys
|
|
11
11
|
import uuid
|
|
12
|
+
from collections.abc import Callable, Iterable
|
|
12
13
|
from functools import update_wrapper
|
|
13
14
|
from importlib.metadata import version
|
|
14
|
-
from typing import Any,
|
|
15
|
+
from typing import Any, TypeVar
|
|
15
16
|
|
|
16
17
|
import click
|
|
17
18
|
from click.shell_completion import CompletionItem
|
|
@@ -37,8 +38,8 @@ def _completion_helper_init_session() -> Session:
|
|
|
37
38
|
"""
|
|
38
39
|
cmd_line = os.environ["COMP_WORDS"].split()[1:]
|
|
39
40
|
opts, _ = getopt.getopt(cmd_line, "t:u:s:", ["transport=", "device-uuid=", "socket="])
|
|
40
|
-
skt_path:
|
|
41
|
-
dev_uuid:
|
|
41
|
+
skt_path: str | None = None
|
|
42
|
+
dev_uuid: uuid.UUID | None = None
|
|
42
43
|
for o, a in opts:
|
|
43
44
|
if o in ("-s", "--socket"):
|
|
44
45
|
skt_path = a
|
|
@@ -62,19 +63,19 @@ def _get_board_name(uu: uuid.UUID) -> str:
|
|
|
62
63
|
|
|
63
64
|
def _dev_completion_helper(
|
|
64
65
|
_ctx: click.Context, _param: click.Option, _incomplete: str
|
|
65
|
-
) ->
|
|
66
|
+
) -> list[CompletionItem]:
|
|
66
67
|
"""Completion handler for USB attached devices."""
|
|
67
68
|
return [CompletionItem(str(uu), help=_get_board_name(uu)) for uu in list_usb_devices()]
|
|
68
69
|
|
|
69
70
|
|
|
70
71
|
def _get_part_completion_helper(
|
|
71
72
|
*, filt_write: bool = False, filt_read: bool = False, filt_boot: bool = False
|
|
72
|
-
) -> Callable[[click.Context, click.Parameter, str],
|
|
73
|
+
) -> Callable[[click.Context, click.Parameter, str], list[CompletionItem]]:
|
|
73
74
|
"""Construct a completion handler for partitions with given filtering."""
|
|
74
75
|
|
|
75
76
|
def _part_completion_helper(
|
|
76
77
|
_ctx: click.Context, _param: click.Parameter, _incomplete: str
|
|
77
|
-
) ->
|
|
78
|
+
) -> list[CompletionItem]:
|
|
78
79
|
"""Completion handler for partitions."""
|
|
79
80
|
with contextlib.suppress(Exception):
|
|
80
81
|
s: Session = _completion_helper_init_session()
|
|
@@ -103,7 +104,7 @@ def pb_session(f: TFunc) -> TFunc:
|
|
|
103
104
|
|
|
104
105
|
@click.pass_context
|
|
105
106
|
def new_func(ctx: click.Context, *args: Any, **kwargs: Any) -> Any: # noqa: ANN401
|
|
106
|
-
device_uuid:
|
|
107
|
+
device_uuid: uuid.UUID | None = ctx.obj["device-uuid"]
|
|
107
108
|
socket: str = ctx.obj["socket"]
|
|
108
109
|
transport: str = ctx.obj["transport"]
|
|
109
110
|
try:
|
|
@@ -270,7 +271,7 @@ def auth_password(
|
|
|
270
271
|
@click.pass_context
|
|
271
272
|
def auth_token(_ctx: click.Context, s: Session, token: pathlib.Path, key_id: str) -> None:
|
|
272
273
|
"""DSA token authentication."""
|
|
273
|
-
key_id_p:
|
|
274
|
+
key_id_p: int | str = 0
|
|
274
275
|
|
|
275
276
|
try:
|
|
276
277
|
key_id_p = int(key_id, 0)
|
|
@@ -308,7 +309,9 @@ def part_list(_ctx: click.Context, s: Session) -> None:
|
|
|
308
309
|
False,
|
|
309
310
|
False,
|
|
310
311
|
)
|
|
311
|
-
return "".join(
|
|
312
|
+
return "".join(
|
|
313
|
+
flag if is_set else "-" for flag, is_set in zip(flags, part_param, strict=False)
|
|
314
|
+
)
|
|
312
315
|
|
|
313
316
|
def _size_helper(part: Partition) -> str:
|
|
314
317
|
part_bytes = (part.last_block - part.first_block + 1) * part.block_size
|
|
@@ -444,12 +447,12 @@ def board_command(
|
|
|
444
447
|
_ctx: click.Context,
|
|
445
448
|
s: Session,
|
|
446
449
|
command: str,
|
|
447
|
-
args:
|
|
450
|
+
args: str | None,
|
|
448
451
|
out_fmt: str,
|
|
449
|
-
args_from_file:
|
|
452
|
+
args_from_file: pathlib.Path | None,
|
|
450
453
|
) -> None:
|
|
451
454
|
"""Execute a board specific command."""
|
|
452
|
-
board_command:
|
|
455
|
+
board_command: int | str = 0
|
|
453
456
|
board_args: bytes = b""
|
|
454
457
|
|
|
455
458
|
try:
|
|
@@ -527,7 +530,7 @@ def boot_bpak(
|
|
|
527
530
|
_ctx: click.Context,
|
|
528
531
|
s: Session,
|
|
529
532
|
file: pathlib.Path,
|
|
530
|
-
pretend_part:
|
|
533
|
+
pretend_part: uuid.UUID | None,
|
|
531
534
|
verbose: bool,
|
|
532
535
|
) -> None:
|
|
533
536
|
"""Load a bpak file into ram and run it."""
|
|
@@ -638,7 +641,7 @@ def slc_eol(_ctx: click.Context, s: Session, force: bool) -> None:
|
|
|
638
641
|
@click.pass_context
|
|
639
642
|
def slc_revoke_key(_ctx: click.Context, s: Session, key_id: str, force: bool) -> None:
|
|
640
643
|
"""Revoke a key."""
|
|
641
|
-
revoke_key_id:
|
|
644
|
+
revoke_key_id: int | str = 0
|
|
642
645
|
try:
|
|
643
646
|
revoke_key_id = int(key_id, 0)
|
|
644
647
|
except ValueError:
|
|
@@ -9,7 +9,7 @@ import hashlib
|
|
|
9
9
|
import io
|
|
10
10
|
import pathlib
|
|
11
11
|
import uuid
|
|
12
|
-
from typing import IO, TYPE_CHECKING
|
|
12
|
+
from typing import IO, TYPE_CHECKING
|
|
13
13
|
|
|
14
14
|
import _punchboot # type: ignore[import-not-found]
|
|
15
15
|
import semver # type: ignore[import-not-found]
|
|
@@ -19,7 +19,7 @@ from .partition import Partition, PartitionFlags
|
|
|
19
19
|
from .slc import SLC
|
|
20
20
|
|
|
21
21
|
if TYPE_CHECKING:
|
|
22
|
-
from collections.abc import Sequence
|
|
22
|
+
from collections.abc import Callable, Sequence
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
def _has_fileno(file: IO[bytes]) -> bool:
|
|
@@ -34,7 +34,7 @@ def _has_fileno(file: IO[bytes]) -> bool:
|
|
|
34
34
|
return True
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
PartUUIDType =
|
|
37
|
+
PartUUIDType = uuid.UUID | str
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
def _partuuid_to_uuid(uu: PartUUIDType) -> uuid.UUID:
|
|
@@ -54,8 +54,8 @@ class Session:
|
|
|
54
54
|
|
|
55
55
|
def __init__(
|
|
56
56
|
self,
|
|
57
|
-
device_uuid:
|
|
58
|
-
socket_path:
|
|
57
|
+
device_uuid: uuid.UUID | str | None = None,
|
|
58
|
+
socket_path: pathlib.Path | str | None = None,
|
|
59
59
|
) -> None:
|
|
60
60
|
"""Initialize the punchboot session.
|
|
61
61
|
|
|
@@ -101,7 +101,7 @@ class Session:
|
|
|
101
101
|
self.pb_s.auth_set_password(password)
|
|
102
102
|
|
|
103
103
|
def authenticate_dsa_token(
|
|
104
|
-
self, token:
|
|
104
|
+
self, token: pathlib.Path | bytes, key_id: str | int
|
|
105
105
|
) -> None:
|
|
106
106
|
"""Authenticate session using a DSA token.
|
|
107
107
|
|
|
@@ -134,7 +134,7 @@ class Session:
|
|
|
134
134
|
for p in self.pb_s.part_get_partitions()
|
|
135
135
|
]
|
|
136
136
|
|
|
137
|
-
def part_verify(self, file:
|
|
137
|
+
def part_verify(self, file: pathlib.Path | IO[bytes] | bytes, part: PartUUIDType) -> None:
|
|
138
138
|
"""Verify the contents of a partition.
|
|
139
139
|
|
|
140
140
|
Keyword arguments:
|
|
@@ -178,6 +178,7 @@ class Session:
|
|
|
178
178
|
bpak_header_valid = valid_bpak_magic(file)
|
|
179
179
|
data_length = len(file)
|
|
180
180
|
elif _has_fileno(file):
|
|
181
|
+
file.seek(0)
|
|
181
182
|
data_length = _chunk_reader(file)
|
|
182
183
|
else:
|
|
183
184
|
msg = "File is not a supported type"
|
|
@@ -185,7 +186,7 @@ class Session:
|
|
|
185
186
|
|
|
186
187
|
self.pb_s.part_verify(uu.bytes, hash_ctx.digest(), data_length, bpak_header_valid)
|
|
187
188
|
|
|
188
|
-
def part_write(self, file:
|
|
189
|
+
def part_write(self, file: pathlib.Path | IO[bytes], part: PartUUIDType) -> None:
|
|
189
190
|
"""Write data to a partition.
|
|
190
191
|
|
|
191
192
|
Keyword arguments:
|
|
@@ -202,7 +203,7 @@ class Session:
|
|
|
202
203
|
msg = "File is not a supported type"
|
|
203
204
|
raise TypeError(msg)
|
|
204
205
|
|
|
205
|
-
def part_read(self, file:
|
|
206
|
+
def part_read(self, file: pathlib.Path | IO[bytes], part: PartUUIDType) -> None:
|
|
206
207
|
"""Read data from a partition to a file.
|
|
207
208
|
|
|
208
209
|
Keyword arguments:
|
|
@@ -222,7 +223,7 @@ class Session:
|
|
|
222
223
|
def part_erase(
|
|
223
224
|
self,
|
|
224
225
|
part_uu: PartUUIDType,
|
|
225
|
-
progress_cb:
|
|
226
|
+
progress_cb: Callable[[int, int], None] | None = None,
|
|
226
227
|
) -> None:
|
|
227
228
|
"""Erase partition.
|
|
228
229
|
|
|
@@ -282,7 +283,7 @@ class Session:
|
|
|
282
283
|
uu: uuid.UUID = _partuuid_to_uuid(part)
|
|
283
284
|
self.pb_s.part_table_install(uu.bytes, variant)
|
|
284
285
|
|
|
285
|
-
def boot_set_boot_part(self, part:
|
|
286
|
+
def boot_set_boot_part(self, part: PartUUIDType | None) -> None:
|
|
286
287
|
"""Set active boot partition.
|
|
287
288
|
|
|
288
289
|
Keyword arguments:
|
|
@@ -308,7 +309,7 @@ class Session:
|
|
|
308
309
|
else:
|
|
309
310
|
self.pb_s.boot_set_boot_part(None)
|
|
310
311
|
|
|
311
|
-
def boot_status(self) ->
|
|
312
|
+
def boot_status(self) -> tuple[uuid.UUID, str]:
|
|
312
313
|
"""Boot status.
|
|
313
314
|
|
|
314
315
|
Reads the currently active boot partition.
|
|
@@ -364,8 +365,7 @@ class Session:
|
|
|
364
365
|
def device_get_punchboot_version(self) -> semver.Version:
|
|
365
366
|
"""Read the punchboot version."""
|
|
366
367
|
ver_str: str = self.pb_s.device_get_punchboot_version()
|
|
367
|
-
|
|
368
|
-
ver_str = ver_str[1:]
|
|
368
|
+
ver_str = ver_str.removeprefix("v")
|
|
369
369
|
return semver.Version.parse(ver_str)
|
|
370
370
|
|
|
371
371
|
def device_get_uuid(self) -> uuid.UUID:
|
|
@@ -376,7 +376,7 @@ class Session:
|
|
|
376
376
|
"""Read the device's board name."""
|
|
377
377
|
return str(self.pb_s.device_get_boardname())
|
|
378
378
|
|
|
379
|
-
def board_run_command(self, cmd:
|
|
379
|
+
def board_run_command(self, cmd: str | int, args: bytes = b"") -> bytes:
|
|
380
380
|
"""Execute a board specific command.
|
|
381
381
|
|
|
382
382
|
Keyword arguments:
|
|
@@ -439,7 +439,7 @@ class Session:
|
|
|
439
439
|
"""Read Security Life Cycle (SLC)."""
|
|
440
440
|
return SLC(self.pb_s.slc_get_lifecycle())
|
|
441
441
|
|
|
442
|
-
def slc_revoke_key(self, key_id:
|
|
442
|
+
def slc_revoke_key(self, key_id: int | str) -> None:
|
|
443
443
|
"""Revokey key.
|
|
444
444
|
|
|
445
445
|
Keyword arguments:
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
static int log_cb(struct pb_context *ctx, int level, const char *fmt, ...)
|
|
26
26
|
{
|
|
27
27
|
static PyObject *logger = NULL;
|
|
28
|
-
|
|
28
|
+
PyObject *log_msg;
|
|
29
29
|
char msg_buf[1024];
|
|
30
30
|
int rc;
|
|
31
31
|
(void)ctx;
|
|
32
32
|
(void)level;
|
|
33
33
|
|
|
34
34
|
if (logger == NULL) {
|
|
35
|
-
PyObject *logging =
|
|
35
|
+
PyObject *logging = PyImport_ImportModule("logging");
|
|
36
36
|
if (logging == NULL) {
|
|
37
37
|
PyErr_SetString(PyExc_ImportError, "Could not import module 'logging'");
|
|
38
38
|
return -1;
|
|
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
|