mpflash 0.7.3__py3-none-any.whl → 0.7.4__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.
- mpflash/list.py +11 -35
- mpflash/mpboard_id/board_id.py +3 -5
- mpflash/mpremoteboard/__init__.py +2 -2
- {mpflash-0.7.3.dist-info → mpflash-0.7.4.dist-info}/METADATA +1 -1
- {mpflash-0.7.3.dist-info → mpflash-0.7.4.dist-info}/RECORD +8 -8
- {mpflash-0.7.3.dist-info → mpflash-0.7.4.dist-info}/LICENSE +0 -0
- {mpflash-0.7.3.dist-info → mpflash-0.7.4.dist-info}/WHEEL +0 -0
- {mpflash-0.7.3.dist-info → mpflash-0.7.4.dist-info}/entry_points.txt +0 -0
mpflash/list.py
CHANGED
@@ -51,44 +51,23 @@ def show_mcus(
|
|
51
51
|
conn_mcus: List[MPRemoteBoard],
|
52
52
|
title: str = "Connected boards",
|
53
53
|
refresh: bool = True,
|
54
|
-
):
|
55
|
-
console.print(mcu_table(conn_mcus, title, refresh))
|
56
|
-
|
57
|
-
|
58
|
-
def abbrv_family(family: str, is_narrow: bool) -> str:
|
59
|
-
ABRV = {"micropython": "upy", "circuitpython": "cpy"}
|
60
|
-
if is_narrow:
|
61
|
-
if family in ABRV:
|
62
|
-
return ABRV[family]
|
63
|
-
return family[:4]
|
64
|
-
return family
|
65
|
-
|
66
|
-
|
67
|
-
def mcu_table(
|
68
|
-
conn_mcus: List[MPRemoteBoard],
|
69
|
-
title: str = "Connected boards",
|
70
|
-
refresh: bool = True,
|
71
|
-
):
|
54
|
+
): # sourcery skip: extract-duplicate-method
|
72
55
|
"""Show the list of connected boards in a nice table"""
|
73
56
|
table = Table(
|
74
57
|
title=title,
|
75
58
|
title_style="magenta",
|
76
59
|
header_style="bold magenta",
|
77
60
|
collapse_padding=True,
|
78
|
-
|
79
|
-
# width=80,
|
61
|
+
width=110,
|
80
62
|
)
|
81
|
-
|
82
|
-
|
83
|
-
table.add_column("Ser." if is_narrow else "Serial", overflow="fold")
|
84
|
-
table.add_column("Fam." if is_narrow else "Family", overflow="crop", max_width=4 if is_narrow else None)
|
63
|
+
table.add_column("Serial", overflow="fold")
|
64
|
+
table.add_column("Family")
|
85
65
|
table.add_column("Port")
|
86
66
|
table.add_column("Board", overflow="fold")
|
87
67
|
# table.add_column("Variant") # TODO: add variant
|
88
68
|
table.add_column("CPU")
|
89
|
-
table.add_column("Version"
|
90
|
-
|
91
|
-
table.add_column("Bld" if is_narrow else "Build", justify="right")
|
69
|
+
table.add_column("Version")
|
70
|
+
table.add_column("build", justify="right")
|
92
71
|
|
93
72
|
for mcu in track(conn_mcus, description="Updating board info", transient=True, update_period=0.1):
|
94
73
|
if refresh:
|
@@ -97,17 +76,14 @@ def mcu_table(
|
|
97
76
|
except ConnectionError:
|
98
77
|
continue
|
99
78
|
description = f"[italic bright_cyan]{mcu.description}" if mcu.description else ""
|
100
|
-
|
79
|
+
table.add_row(
|
101
80
|
mcu.serialport.replace("/dev/", ""),
|
102
|
-
|
81
|
+
mcu.family,
|
103
82
|
mcu.port,
|
104
83
|
f"{mcu.board}\n{description}".strip(),
|
105
84
|
# mcu.variant,
|
106
85
|
mcu.cpu,
|
107
86
|
clean_version(mcu.version),
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
table.add_row(*row)
|
113
|
-
return table
|
87
|
+
mcu.build,
|
88
|
+
)
|
89
|
+
console.print(table)
|
mpflash/mpboard_id/board_id.py
CHANGED
@@ -15,12 +15,12 @@ HERE = Path(__file__).parent
|
|
15
15
|
###############################################################################################
|
16
16
|
|
17
17
|
|
18
|
-
def
|
18
|
+
def find_board_id(
|
19
19
|
descr: str, short_descr: str, board_info: Optional[Path] = None, version: str = "stable"
|
20
20
|
) -> Optional[str]:
|
21
21
|
"""Find the MicroPython BOARD_ID based on the description in the firmware"""
|
22
22
|
try:
|
23
|
-
boards =
|
23
|
+
boards = find_board_id_by_description(
|
24
24
|
descr=descr,
|
25
25
|
short_descr=short_descr,
|
26
26
|
board_info=board_info,
|
@@ -32,9 +32,7 @@ def find_board_id_by_description(
|
|
32
32
|
|
33
33
|
|
34
34
|
@functools.lru_cache(maxsize=20)
|
35
|
-
def
|
36
|
-
*, descr: str, short_descr: str, version="v1.21.0", board_info: Optional[Path] = None
|
37
|
-
):
|
35
|
+
def find_board_id_by_description(*, descr: str, short_descr: str, version="v1.21.0", board_info: Optional[Path] = None):
|
38
36
|
"""
|
39
37
|
Find the MicroPython BOARD_ID based on the description in the firmware
|
40
38
|
using the pre-built board_info.json file
|
@@ -13,7 +13,7 @@ from rich.progress import track
|
|
13
13
|
from tenacity import retry, stop_after_attempt, wait_fixed
|
14
14
|
|
15
15
|
from mpflash.errors import MPFlashError
|
16
|
-
from mpflash.mpboard_id.board_id import
|
16
|
+
from mpflash.mpboard_id.board_id import find_board_id
|
17
17
|
from mpflash.mpremoteboard.runner import run
|
18
18
|
|
19
19
|
###############################################################################################
|
@@ -116,7 +116,7 @@ class MPRemoteBoard:
|
|
116
116
|
self.description = descr = info["board"]
|
117
117
|
pos = descr.rfind(" with")
|
118
118
|
short_descr = descr[:pos].strip() if pos != -1 else ""
|
119
|
-
if board_name :=
|
119
|
+
if board_name := find_board_id(descr, short_descr):
|
120
120
|
self.board = board_name
|
121
121
|
else:
|
122
122
|
self.board = "UNKNOWN"
|
@@ -19,13 +19,13 @@ mpflash/flash_uf2.py,sha256=KvNPk1zDwQexJfPI5MlIoR7zTD0u-pQQwSHuFQjuMXg,2093
|
|
19
19
|
mpflash/flash_uf2_boardid.py,sha256=WZKucGu_hJ8ymb236uuZbiR6pD6AA_l4LA-7LwtQhq8,414
|
20
20
|
mpflash/flash_uf2_linux.py,sha256=LAGkzTImVq-wKo7LGUNlwkUHv1L4rGO7igR5dwxY07o,4298
|
21
21
|
mpflash/flash_uf2_windows.py,sha256=dcmA-koavH7duOuNwI0n2aDDbhF1_5ZZ-mXFAXgj8z4,1072
|
22
|
-
mpflash/list.py,sha256=
|
22
|
+
mpflash/list.py,sha256=R3upYux3mEltpqfrt467Ufs4hVatW1NE40jjhN7Ei1g,3252
|
23
23
|
mpflash/logger.py,sha256=dI_H_a7EOdQJyvoeRHQuYeZuTKYVUS3DUPTLhE9rkdM,1098
|
24
24
|
mpflash/mpboard_id/__init__.py,sha256=JYGe7VwpBV4ig2M9a6vJUQrMtgdNjZKHt_Z5N13Ycrs,3509
|
25
|
-
mpflash/mpboard_id/board_id.py,sha256=
|
25
|
+
mpflash/mpboard_id/board_id.py,sha256=G2oW969pqDuLbQS7UrFNmbWNdDIXfWBAoZMt1EWHLak,2361
|
26
26
|
mpflash/mpboard_id/board_info.csv,sha256=KPWDo-zHWfrPGQn9oInsDH-5IdCzhBCs6K_YAmqqSpQ,96983
|
27
27
|
mpflash/mpboard_id/board_info.json,sha256=JtVyOMIO1O7vLKzJ0hyXQ4JSxXiQBJyay2hjdNLnZM0,674442
|
28
|
-
mpflash/mpremoteboard/__init__.py,sha256=
|
28
|
+
mpflash/mpremoteboard/__init__.py,sha256=DxlO_7LiyWDz5hNRI77fzp3sI3fZQ9Sd23dnGLx4Zl0,7017
|
29
29
|
mpflash/mpremoteboard/mpy_fw_info.py,sha256=6AQbN3jtQgllqWQYl4e-63KeEtV08EXk8_JnM6XBkvo,4554
|
30
30
|
mpflash/mpremoteboard/runner.py,sha256=-PgzAeBGbyXaAUlwyiw4mcINsP2U1XRRjP1_QdBrxpg,4786
|
31
31
|
mpflash/vendor/dfu.py,sha256=oK_MRSOyDJrUuS6D24IMIsfL7oLcrvUq0yp_h4WIY2U,5739
|
@@ -33,8 +33,8 @@ mpflash/vendor/pydfu.py,sha256=_MdBRo1EeNeKDqFPSTB5tNL1jGSBJgsVeVjE5e7Pb8s,20542
|
|
33
33
|
mpflash/vendor/readme.md,sha256=iIIZxuLUIGHQ0KODzYVtMezsztvyxCXcNJp_AzwTIPk,86
|
34
34
|
mpflash/vendor/versions.py,sha256=ooRZjeeYepQHwp12hMu2m0p8nZXQ5s942w5mGkKmgeI,3629
|
35
35
|
mpflash/worklist.py,sha256=qZsqF3Lf5Bl7QQ31ZLVHewP6WC8fmwQPMbyNgbG7LB4,5299
|
36
|
-
mpflash-0.7.
|
37
|
-
mpflash-0.7.
|
38
|
-
mpflash-0.7.
|
39
|
-
mpflash-0.7.
|
40
|
-
mpflash-0.7.
|
36
|
+
mpflash-0.7.4.dist-info/entry_points.txt,sha256=Jk_visOhYOsZIcSP2Ms9hKqfKy1iorR-6dYltSoWCpY,52
|
37
|
+
mpflash-0.7.4.dist-info/LICENSE,sha256=mWpNhsIxWzetYNnTpr4eb3HtgsxGIC8KcYWxXEcxQvE,1077
|
38
|
+
mpflash-0.7.4.dist-info/METADATA,sha256=yuYr4EWKmSRD8yg7M6tyfP-EYSt-4UrZjGEycTSUH4o,14633
|
39
|
+
mpflash-0.7.4.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
|
40
|
+
mpflash-0.7.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|