mpflash 0.7.2__py3-none-any.whl → 0.7.3__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 +35 -11
- mpflash/mpboard_id/board_id.py +5 -3
- mpflash/mpremoteboard/__init__.py +2 -2
- {mpflash-0.7.2.dist-info → mpflash-0.7.3.dist-info}/METADATA +1 -1
- {mpflash-0.7.2.dist-info → mpflash-0.7.3.dist-info}/RECORD +8 -8
- {mpflash-0.7.2.dist-info → mpflash-0.7.3.dist-info}/LICENSE +0 -0
- {mpflash-0.7.2.dist-info → mpflash-0.7.3.dist-info}/WHEEL +0 -0
- {mpflash-0.7.2.dist-info → mpflash-0.7.3.dist-info}/entry_points.txt +0 -0
mpflash/list.py
CHANGED
@@ -51,23 +51,44 @@ def show_mcus(
|
|
51
51
|
conn_mcus: List[MPRemoteBoard],
|
52
52
|
title: str = "Connected boards",
|
53
53
|
refresh: bool = True,
|
54
|
-
):
|
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
|
+
):
|
55
72
|
"""Show the list of connected boards in a nice table"""
|
56
73
|
table = Table(
|
57
74
|
title=title,
|
58
75
|
title_style="magenta",
|
59
76
|
header_style="bold magenta",
|
60
77
|
collapse_padding=True,
|
61
|
-
|
78
|
+
padding=(0, 0),
|
79
|
+
# width=80,
|
62
80
|
)
|
63
|
-
|
64
|
-
|
81
|
+
needs_build = any(mcu.build for mcu in conn_mcus)
|
82
|
+
is_narrow = console.width < 100
|
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)
|
65
85
|
table.add_column("Port")
|
66
86
|
table.add_column("Board", overflow="fold")
|
67
87
|
# table.add_column("Variant") # TODO: add variant
|
68
88
|
table.add_column("CPU")
|
69
|
-
table.add_column("Version")
|
70
|
-
|
89
|
+
table.add_column("Version", overflow="fold", max_width=8 if is_narrow else None)
|
90
|
+
if needs_build:
|
91
|
+
table.add_column("Bld" if is_narrow else "Build", justify="right")
|
71
92
|
|
72
93
|
for mcu in track(conn_mcus, description="Updating board info", transient=True, update_period=0.1):
|
73
94
|
if refresh:
|
@@ -76,14 +97,17 @@ def show_mcus(
|
|
76
97
|
except ConnectionError:
|
77
98
|
continue
|
78
99
|
description = f"[italic bright_cyan]{mcu.description}" if mcu.description else ""
|
79
|
-
|
100
|
+
row = [
|
80
101
|
mcu.serialport.replace("/dev/", ""),
|
81
|
-
mcu.family,
|
102
|
+
abbrv_family(mcu.family, is_narrow),
|
82
103
|
mcu.port,
|
83
104
|
f"{mcu.board}\n{description}".strip(),
|
84
105
|
# mcu.variant,
|
85
106
|
mcu.cpu,
|
86
107
|
clean_version(mcu.version),
|
87
|
-
|
88
|
-
|
89
|
-
|
108
|
+
]
|
109
|
+
if needs_build:
|
110
|
+
row.append(mcu.build)
|
111
|
+
|
112
|
+
table.add_row(*row)
|
113
|
+
return 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_by_description(
|
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,7 +32,9 @@ def find_board_id(
|
|
32
32
|
|
33
33
|
|
34
34
|
@functools.lru_cache(maxsize=20)
|
35
|
-
def
|
35
|
+
def _find_board_id_by_description(
|
36
|
+
*, descr: str, short_descr: str, version="v1.21.0", board_info: Optional[Path] = None
|
37
|
+
):
|
36
38
|
"""
|
37
39
|
Find the MicroPython BOARD_ID based on the description in the firmware
|
38
40
|
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_by_description
|
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_by_description(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=zvrH7WYS3qEHUvx8Ad5fJyLpVjDa8qVxxUYQG0rXwQc,4037
|
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=R0amcK14T8uvPUAAtO21NJodEnErDtsV4A1ThbvBMXI,2386
|
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=I-grXnARsBxKxrm636MUXwIPiz_Hu6bOHe0WHVa6hRU,7047
|
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.3.dist-info/entry_points.txt,sha256=Jk_visOhYOsZIcSP2Ms9hKqfKy1iorR-6dYltSoWCpY,52
|
37
|
+
mpflash-0.7.3.dist-info/LICENSE,sha256=mWpNhsIxWzetYNnTpr4eb3HtgsxGIC8KcYWxXEcxQvE,1077
|
38
|
+
mpflash-0.7.3.dist-info/METADATA,sha256=pd3TwnWc3lBYK_UFdcuDjcT-2LjtA7PTP1l_xcqBc54,14633
|
39
|
+
mpflash-0.7.3.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
|
40
|
+
mpflash-0.7.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|