micropython-stubber 1.20.1__py3-none-any.whl → 1.20.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.
- {micropython_stubber-1.20.1.dist-info → micropython_stubber-1.20.4.dist-info}/METADATA +4 -3
- {micropython_stubber-1.20.1.dist-info → micropython_stubber-1.20.4.dist-info}/RECORD +58 -51
- {micropython_stubber-1.20.1.dist-info → micropython_stubber-1.20.4.dist-info}/WHEEL +1 -1
- mpflash/README.md +16 -5
- mpflash/mpflash/add_firmware.py +98 -0
- mpflash/mpflash/ask_input.py +97 -120
- mpflash/mpflash/cli_download.py +42 -25
- mpflash/mpflash/cli_flash.py +70 -32
- mpflash/mpflash/cli_group.py +17 -14
- mpflash/mpflash/cli_list.py +39 -3
- mpflash/mpflash/cli_main.py +17 -6
- mpflash/mpflash/common.py +125 -12
- mpflash/mpflash/config.py +12 -0
- mpflash/mpflash/connected.py +74 -0
- mpflash/mpflash/download.py +132 -51
- mpflash/mpflash/downloaded.py +36 -15
- mpflash/mpflash/flash.py +2 -2
- mpflash/mpflash/flash_esp.py +2 -2
- mpflash/mpflash/flash_uf2.py +14 -8
- mpflash/mpflash/flash_uf2_boardid.py +2 -1
- mpflash/mpflash/flash_uf2_linux.py +5 -16
- mpflash/mpflash/flash_uf2_macos.py +37 -0
- mpflash/mpflash/flash_uf2_windows.py +5 -5
- mpflash/mpflash/list.py +57 -57
- mpflash/mpflash/mpboard_id/__init__.py +41 -44
- mpflash/mpflash/mpboard_id/add_boards.py +255 -0
- mpflash/mpflash/mpboard_id/board.py +37 -0
- mpflash/mpflash/mpboard_id/board_id.py +54 -34
- mpflash/mpflash/mpboard_id/board_info.zip +0 -0
- mpflash/mpflash/mpboard_id/store.py +43 -0
- mpflash/mpflash/mpremoteboard/__init__.py +18 -6
- mpflash/mpflash/uf2disk.py +12 -0
- mpflash/mpflash/vendor/basicgit.py +288 -0
- mpflash/mpflash/vendor/dfu.py +1 -0
- mpflash/mpflash/vendor/versions.py +7 -3
- mpflash/mpflash/worklist.py +71 -48
- mpflash/poetry.lock +164 -138
- mpflash/pyproject.toml +18 -15
- stubber/__init__.py +1 -1
- stubber/board/createstubs.py +13 -3
- stubber/board/createstubs_db.py +5 -7
- stubber/board/createstubs_db_min.py +329 -825
- stubber/board/createstubs_db_mpy.mpy +0 -0
- stubber/board/createstubs_mem.py +6 -7
- stubber/board/createstubs_mem_min.py +304 -765
- stubber/board/createstubs_mem_mpy.mpy +0 -0
- stubber/board/createstubs_min.py +293 -975
- stubber/board/createstubs_mpy.mpy +0 -0
- stubber/board/modulelist.txt +10 -0
- stubber/commands/get_core_cmd.py +7 -6
- stubber/commands/get_docstubs_cmd.py +8 -3
- stubber/commands/get_frozen_cmd.py +5 -2
- stubber/publish/publish.py +18 -7
- stubber/update_module_list.py +2 -24
- stubber/utils/makeversionhdr.py +3 -2
- stubber/utils/versions.py +2 -1
- mpflash/mpflash/mpboard_id/board_info.csv +0 -2213
- mpflash/mpflash/mpboard_id/board_info.json +0 -19910
- {micropython_stubber-1.20.1.dist-info → micropython_stubber-1.20.4.dist-info}/LICENSE +0 -0
- {micropython_stubber-1.20.1.dist-info → micropython_stubber-1.20.4.dist-info}/entry_points.txt +0 -0
mpflash/mpflash/worklist.py
CHANGED
@@ -3,13 +3,12 @@ from typing import Dict, List, Optional, Tuple
|
|
3
3
|
|
4
4
|
from loguru import logger as log
|
5
5
|
|
6
|
-
from mpflash.common import FWInfo
|
6
|
+
from mpflash.common import FWInfo, filtered_comports
|
7
7
|
from mpflash.errors import MPFlashError
|
8
8
|
|
9
|
-
from .config import config
|
10
9
|
from .downloaded import find_downloaded_firmware
|
11
10
|
from .list import show_mcus
|
12
|
-
from .mpboard_id import
|
11
|
+
from .mpboard_id import find_known_board
|
13
12
|
from .mpremoteboard import MPRemoteBoard
|
14
13
|
|
15
14
|
# #########################################################################################################
|
@@ -60,14 +59,53 @@ def auto_update(
|
|
60
59
|
|
61
60
|
# just use the last firmware
|
62
61
|
fw_info = board_firmwares[-1]
|
63
|
-
log.info(f"Found {target_version} firmware {fw_info
|
62
|
+
log.info(f"Found {target_version} firmware {fw_info.filename} for {mcu.board} on {mcu.serialport}.")
|
64
63
|
wl.append((mcu, fw_info))
|
65
64
|
return wl
|
66
65
|
|
67
66
|
|
67
|
+
def manual_worklist(
|
68
|
+
serial: str,
|
69
|
+
*,
|
70
|
+
board_id: str,
|
71
|
+
version: str,
|
72
|
+
fw_folder: Path,
|
73
|
+
) -> WorkList:
|
74
|
+
"""Create a worklist for a single board specified manually.
|
75
|
+
|
76
|
+
Args:
|
77
|
+
serial (str): Serial port of the board
|
78
|
+
board (str): Board_ID
|
79
|
+
version (str): Firmware version
|
80
|
+
fw_folder (Path): Path to the firmware folder
|
81
|
+
|
82
|
+
Returns:
|
83
|
+
WorkList: List of boards and firmware information to update
|
84
|
+
"""
|
85
|
+
log.trace(f"Manual updating {serial} to {board_id} {version}")
|
86
|
+
mcu = MPRemoteBoard(serial)
|
87
|
+
# Lookup the matching port and cpu in board_info based in the board name
|
88
|
+
try:
|
89
|
+
info = find_known_board(board_id)
|
90
|
+
mcu.port = info.port
|
91
|
+
# need the CPU type for the esptool
|
92
|
+
mcu.cpu = info.cpu
|
93
|
+
except (LookupError, MPFlashError) as e:
|
94
|
+
log.error(f"Board {board_id} not found in board_info.zip")
|
95
|
+
log.exception(e)
|
96
|
+
return []
|
97
|
+
mcu.board = board_id
|
98
|
+
firmwares = find_downloaded_firmware(fw_folder=fw_folder, board_id=board_id, version=version, port=mcu.port)
|
99
|
+
if not firmwares:
|
100
|
+
log.error(f"No firmware found for {mcu.port} {board_id} version {version}")
|
101
|
+
return []
|
102
|
+
# use the most recent matching firmware
|
103
|
+
return [(mcu, firmwares[-1])] # type: ignore
|
104
|
+
|
105
|
+
|
68
106
|
def single_auto_worklist(
|
107
|
+
serial: str,
|
69
108
|
*,
|
70
|
-
serial_port: str,
|
71
109
|
version: str,
|
72
110
|
fw_folder: Path,
|
73
111
|
) -> WorkList:
|
@@ -81,13 +119,16 @@ def single_auto_worklist(
|
|
81
119
|
Returns:
|
82
120
|
WorkList: List of boards and firmware information to update
|
83
121
|
"""
|
84
|
-
|
122
|
+
log.trace(f"Auto updating {serial} to {version}")
|
123
|
+
conn_boards = [MPRemoteBoard(serial)]
|
85
124
|
todo = auto_update(conn_boards, version, fw_folder) # type: ignore # List / list
|
86
125
|
show_mcus(conn_boards) # type: ignore
|
87
126
|
return todo
|
88
127
|
|
89
128
|
|
90
|
-
def full_auto_worklist(
|
129
|
+
def full_auto_worklist(
|
130
|
+
all_boards: List[MPRemoteBoard], *, include: List[str], ignore: List[str], version: str, fw_folder: Path
|
131
|
+
) -> WorkList:
|
91
132
|
"""
|
92
133
|
Create a worklist for all connected micropython boards based on the information retrieved from the board.
|
93
134
|
This allows the firmware version of one or moae boards to be changed without needing to specify the port or board_id manually.
|
@@ -99,49 +140,31 @@ def full_auto_worklist(*, version: str, fw_folder: Path) -> WorkList:
|
|
99
140
|
Returns:
|
100
141
|
WorkList: List of boards and firmware information to update
|
101
142
|
"""
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
except ConnectionError as e:
|
107
|
-
log.error(f"Error connecting to boards: {e}")
|
143
|
+
log.trace(f"Auto updating all boards to {version}")
|
144
|
+
if selected_boards := filter_boards(all_boards, include=include, ignore=ignore):
|
145
|
+
return auto_update(selected_boards, version, fw_folder)
|
146
|
+
else:
|
108
147
|
return []
|
109
|
-
return auto_update(conn_boards, version, fw_folder) # type: ignore
|
110
|
-
|
111
|
-
|
112
|
-
def manual_worklist(
|
113
|
-
version: str,
|
114
|
-
fw_folder: Path,
|
115
|
-
serial_port: str,
|
116
|
-
board: str,
|
117
|
-
# port: str,
|
118
|
-
) -> WorkList:
|
119
|
-
"""Create a worklist for a single board specified manually.
|
120
148
|
|
121
|
-
Args:
|
122
|
-
version (str): Firmware version
|
123
|
-
fw_folder (Path): Path to the firmware folder
|
124
|
-
serial_port (str): Serial port of the board
|
125
|
-
board (str): Board name
|
126
149
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
150
|
+
def filter_boards(
|
151
|
+
all_boards: List[MPRemoteBoard],
|
152
|
+
*,
|
153
|
+
include: List[str],
|
154
|
+
ignore: List[str],
|
155
|
+
):
|
133
156
|
try:
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
157
|
+
comports = [
|
158
|
+
p.device
|
159
|
+
for p in filtered_comports(
|
160
|
+
ignore=ignore,
|
161
|
+
include=include,
|
162
|
+
bluetooth=False,
|
163
|
+
)
|
164
|
+
]
|
165
|
+
selected_boards = [b for b in all_boards if b.serialport in comports]
|
166
|
+
# [MPRemoteBoard(port.device, update=True) for port in comports]
|
167
|
+
except ConnectionError as e:
|
168
|
+
log.error(f"Error connecting to boards: {e}")
|
145
169
|
return []
|
146
|
-
|
147
|
-
return [(mcu, firmwares[-1])] # type: ignore
|
170
|
+
return selected_boards # type: ignore
|