punchboot 2.1.0__tar.gz → 2.2.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.1.0 → punchboot-2.2.0}/PKG-INFO +1 -1
- {punchboot-2.1.0 → punchboot-2.2.0}/punchboot.egg-info/PKG-INFO +1 -1
- {punchboot-2.1.0 → punchboot-2.2.0}/tools/punchboot/punchboot/helpers.py +2 -1
- {punchboot-2.1.0 → punchboot-2.2.0}/tools/punchboot/python_wrapper.c +16 -9
- {punchboot-2.1.0 → punchboot-2.2.0}/LICENSE +0 -0
- {punchboot-2.1.0 → punchboot-2.2.0}/README.md +0 -0
- {punchboot-2.1.0 → punchboot-2.2.0}/punchboot.egg-info/SOURCES.txt +0 -0
- {punchboot-2.1.0 → punchboot-2.2.0}/punchboot.egg-info/dependency_links.txt +0 -0
- {punchboot-2.1.0 → punchboot-2.2.0}/punchboot.egg-info/entry_points.txt +0 -0
- {punchboot-2.1.0 → punchboot-2.2.0}/punchboot.egg-info/requires.txt +0 -0
- {punchboot-2.1.0 → punchboot-2.2.0}/punchboot.egg-info/top_level.txt +0 -0
- {punchboot-2.1.0 → punchboot-2.2.0}/pyproject.toml +0 -0
- {punchboot-2.1.0 → punchboot-2.2.0}/setup.cfg +0 -0
- {punchboot-2.1.0 → punchboot-2.2.0}/setup.py +0 -0
- {punchboot-2.1.0 → punchboot-2.2.0}/src/lib/bpak.c +0 -0
- {punchboot-2.1.0 → punchboot-2.2.0}/src/wire.c +0 -0
- {punchboot-2.1.0 → punchboot-2.2.0}/tools/punchboot/api.c +0 -0
- {punchboot-2.1.0 → punchboot-2.2.0}/tools/punchboot/api_authentication.c +0 -0
- {punchboot-2.1.0 → punchboot-2.2.0}/tools/punchboot/api_board.c +0 -0
- {punchboot-2.1.0 → punchboot-2.2.0}/tools/punchboot/api_boot.c +0 -0
- {punchboot-2.1.0 → punchboot-2.2.0}/tools/punchboot/api_device.c +0 -0
- {punchboot-2.1.0 → punchboot-2.2.0}/tools/punchboot/api_misc.c +0 -0
- {punchboot-2.1.0 → punchboot-2.2.0}/tools/punchboot/api_partition.c +0 -0
- {punchboot-2.1.0 → punchboot-2.2.0}/tools/punchboot/api_slc.c +0 -0
- {punchboot-2.1.0 → punchboot-2.2.0}/tools/punchboot/api_stream.c +0 -0
- {punchboot-2.1.0 → punchboot-2.2.0}/tools/punchboot/error.c +0 -0
- {punchboot-2.1.0 → punchboot-2.2.0}/tools/punchboot/exceptions.c +0 -0
- {punchboot-2.1.0 → punchboot-2.2.0}/tools/punchboot/punchboot/__init__.py +0 -0
- {punchboot-2.1.0 → punchboot-2.2.0}/tools/punchboot/punchboot/__main__.py +0 -0
- {punchboot-2.1.0 → punchboot-2.2.0}/tools/punchboot/punchboot/partition.py +0 -0
- {punchboot-2.1.0 → punchboot-2.2.0}/tools/punchboot/punchboot/py.typed +0 -0
- {punchboot-2.1.0 → punchboot-2.2.0}/tools/punchboot/punchboot/session.py +0 -0
- {punchboot-2.1.0 → punchboot-2.2.0}/tools/punchboot/punchboot/slc.py +0 -0
- {punchboot-2.1.0 → punchboot-2.2.0}/tools/punchboot/socket.c +0 -0
- {punchboot-2.1.0 → punchboot-2.2.0}/tools/punchboot/usb.c +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""Various punchboot helper functions."""
|
|
2
2
|
|
|
3
3
|
import uuid
|
|
4
|
+
from importlib.metadata import version
|
|
4
5
|
from typing import Iterable
|
|
5
6
|
|
|
6
7
|
import _punchboot # type: ignore
|
|
@@ -9,7 +10,7 @@ import semver
|
|
|
9
10
|
|
|
10
11
|
def library_version() -> semver.Version:
|
|
11
12
|
"""Return the version string of the C library."""
|
|
12
|
-
return semver.Version.parse(
|
|
13
|
+
return semver.Version.parse(version('punchboot'))
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
def pb_id(cmd: str) -> int:
|
|
@@ -24,17 +24,25 @@
|
|
|
24
24
|
|
|
25
25
|
static int log_cb(struct pb_context *ctx, int level, const char *fmt, ...)
|
|
26
26
|
{
|
|
27
|
-
static PyObject *
|
|
27
|
+
static PyObject *logger = NULL;
|
|
28
28
|
static PyObject *log_msg = NULL;
|
|
29
29
|
char msg_buf[1024];
|
|
30
30
|
int rc;
|
|
31
31
|
(void)ctx;
|
|
32
32
|
(void)level;
|
|
33
33
|
|
|
34
|
-
if (
|
|
35
|
-
logging = PyImport_ImportModuleNoBlock("logging");
|
|
34
|
+
if (logger == NULL) {
|
|
35
|
+
PyObject *logging = PyImport_ImportModuleNoBlock("logging");
|
|
36
36
|
if (logging == NULL) {
|
|
37
37
|
PyErr_SetString(PyExc_ImportError, "Could not import module 'logging'");
|
|
38
|
+
return -1;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
logger = PyObject_CallMethod(logging, "getLogger", "s", "pb");
|
|
42
|
+
|
|
43
|
+
if (logger == NULL) {
|
|
44
|
+
PyErr_SetString(PyExc_RuntimeError, "Can't configure logger");
|
|
45
|
+
return -1;
|
|
38
46
|
}
|
|
39
47
|
}
|
|
40
48
|
|
|
@@ -48,7 +56,7 @@ static int log_cb(struct pb_context *ctx, int level, const char *fmt, ...)
|
|
|
48
56
|
msg_buf[rc - 1] = 0;
|
|
49
57
|
|
|
50
58
|
log_msg = Py_BuildValue("s", msg_buf);
|
|
51
|
-
PyObject_CallMethod(
|
|
59
|
+
PyObject_CallMethod(logger, "debug", "O", log_msg);
|
|
52
60
|
Py_DECREF(log_msg);
|
|
53
61
|
}
|
|
54
62
|
va_end(args);
|
|
@@ -1059,13 +1067,12 @@ static PyObject *wait_for_device(PyObject *self, PyObject *args, PyObject *kwds)
|
|
|
1059
1067
|
|
|
1060
1068
|
while (true) {
|
|
1061
1069
|
rc = init_transport(NULL, NULL, &ctx);
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1070
|
+
|
|
1071
|
+
if (rc == PB_RESULT_OK) {
|
|
1072
|
+
rc = get_uuid(ctx, uuid);
|
|
1073
|
+
pb_api_free_context(ctx);
|
|
1065
1074
|
}
|
|
1066
1075
|
|
|
1067
|
-
rc = get_uuid(ctx, uuid);
|
|
1068
|
-
pb_api_free_context(ctx);
|
|
1069
1076
|
if (rc != PB_RESULT_OK) {
|
|
1070
1077
|
if (timeout > 0) {
|
|
1071
1078
|
sleep(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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|