micropython-stubber 1.17.5__py3-none-any.whl → 1.19.0__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.17.5.dist-info → micropython_stubber-1.19.0.dist-info}/METADATA +7 -6
- {micropython_stubber-1.17.5.dist-info → micropython_stubber-1.19.0.dist-info}/RECORD +71 -52
- mpflash/README.md +22 -3
- mpflash/libusb_flash.ipynb +203 -0
- mpflash/mpflash/ask_input.py +234 -0
- mpflash/mpflash/cli_download.py +107 -0
- mpflash/mpflash/cli_flash.py +165 -0
- mpflash/mpflash/cli_group.py +41 -8
- mpflash/mpflash/cli_list.py +41 -0
- mpflash/mpflash/cli_main.py +13 -8
- mpflash/mpflash/common.py +33 -122
- mpflash/mpflash/config.py +9 -0
- mpflash/mpflash/{downloader.py → download.py} +112 -120
- mpflash/mpflash/downloaded.py +108 -0
- mpflash/mpflash/errors.py +5 -0
- mpflash/mpflash/flash.py +69 -0
- mpflash/mpflash/flash_esp.py +17 -23
- mpflash/mpflash/flash_stm32.py +16 -113
- mpflash/mpflash/flash_stm32_cube.py +111 -0
- mpflash/mpflash/flash_stm32_dfu.py +101 -0
- mpflash/mpflash/flash_uf2.py +8 -8
- mpflash/mpflash/flash_uf2_linux.py +25 -12
- mpflash/mpflash/flash_uf2_windows.py +24 -12
- mpflash/mpflash/list.py +34 -37
- mpflash/mpflash/logger.py +12 -13
- mpflash/mpflash/mpboard_id/__init__.py +96 -0
- mpflash/mpflash/mpboard_id/board_id.py +63 -0
- mpflash/mpflash/mpboard_id/board_info.csv +2213 -0
- mpflash/mpflash/mpboard_id/board_info.json +19910 -0
- mpflash/mpflash/mpremoteboard/__init__.py +208 -0
- mpflash/mpflash/mpremoteboard/mpy_fw_info.py +141 -0
- {stubber/bulk → mpflash/mpflash/mpremoteboard}/runner.py +22 -5
- mpflash/mpflash/vendor/dfu.py +164 -0
- mpflash/mpflash/vendor/pydfu.py +605 -0
- mpflash/mpflash/vendor/readme.md +3 -0
- mpflash/mpflash/vendor/versions.py +113 -0
- mpflash/mpflash/worklist.py +147 -0
- mpflash/poetry.lock +411 -595
- mpflash/pyproject.toml +24 -8
- mpflash/stm32_udev_rules.md +63 -0
- stubber/__init__.py +1 -1
- stubber/basicgit.py +1 -0
- stubber/board/createstubs.py +10 -4
- stubber/board/createstubs_db.py +11 -5
- stubber/board/createstubs_db_min.py +61 -58
- stubber/board/createstubs_db_mpy.mpy +0 -0
- stubber/board/createstubs_mem.py +11 -5
- stubber/board/createstubs_mem_min.py +56 -53
- stubber/board/createstubs_mem_mpy.mpy +0 -0
- stubber/board/createstubs_min.py +54 -51
- stubber/board/createstubs_mpy.mpy +0 -0
- stubber/bulk/mcu_stubber.py +9 -5
- stubber/codemod/_partials/db_main.py +14 -25
- stubber/codemod/_partials/lvgl_main.py +2 -2
- stubber/codemod/board.py +10 -3
- stubber/commands/clone_cmd.py +7 -7
- stubber/commands/config_cmd.py +3 -0
- stubber/freeze/get_frozen.py +0 -2
- stubber/publish/candidates.py +1 -1
- stubber/publish/package.py +1 -1
- stubber/publish/pathnames.py +1 -1
- stubber/publish/stubpackage.py +1 -0
- stubber/rst/lookup.py +1 -1
- stubber/tools/manifestfile.py +5 -3
- stubber/utils/config.py +26 -36
- stubber/utils/repos.py +2 -2
- stubber/utils/versions.py +1 -0
- mpflash/mpflash/flasher.py +0 -287
- stubber/bulk/board_id.py +0 -40
- stubber/bulk/mpremoteboard.py +0 -141
- {micropython_stubber-1.17.5.dist-info → micropython_stubber-1.19.0.dist-info}/LICENSE +0 -0
- {micropython_stubber-1.17.5.dist-info → micropython_stubber-1.19.0.dist-info}/WHEEL +0 -0
- {micropython_stubber-1.17.5.dist-info → micropython_stubber-1.19.0.dist-info}/entry_points.txt +0 -0
- /mpflash/mpflash/{uf2_boardid.py → flash_uf2_boardid.py} +0 -0
stubber/bulk/mpremoteboard.py
DELETED
@@ -1,141 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
Module to run mpremote commands, and retry on failure or timeout
|
3
|
-
"""
|
4
|
-
|
5
|
-
import sys
|
6
|
-
from pathlib import Path
|
7
|
-
from typing import List, Optional, Union
|
8
|
-
|
9
|
-
import serial.tools.list_ports
|
10
|
-
from loguru import logger as log
|
11
|
-
from tenacity import retry, stop_after_attempt, wait_fixed
|
12
|
-
|
13
|
-
from .board_id import find_board_designator
|
14
|
-
from .runner import run
|
15
|
-
from rich.progress import Progress
|
16
|
-
|
17
|
-
###############################################################################################
|
18
|
-
# TODO : make this a bit nicer
|
19
|
-
HERE = Path(__file__).parent
|
20
|
-
|
21
|
-
OK = 0
|
22
|
-
ERROR = -1
|
23
|
-
RETRIES = 3
|
24
|
-
###############################################################################################
|
25
|
-
|
26
|
-
|
27
|
-
class MPRemoteBoard:
|
28
|
-
"""Class to run mpremote commands"""
|
29
|
-
|
30
|
-
def __init__(self, serialport: str = ""):
|
31
|
-
self.serialport = serialport
|
32
|
-
# self.board = ""
|
33
|
-
self.firmware = {}
|
34
|
-
|
35
|
-
self.connected = False
|
36
|
-
self.path: Optional[Path] = None
|
37
|
-
self.family = "micropython"
|
38
|
-
self.description = ""
|
39
|
-
self.version = ""
|
40
|
-
self.port = ""
|
41
|
-
self.board = ""
|
42
|
-
self.cpu = ""
|
43
|
-
self.arch = ""
|
44
|
-
self.mpy = ""
|
45
|
-
self.build = ""
|
46
|
-
|
47
|
-
def __str__(self):
|
48
|
-
return f"MPRemoteBoard({self.serialport}, {self.family} {self.port}, {self.board}, {self.version})"
|
49
|
-
|
50
|
-
@staticmethod
|
51
|
-
def connected_boards():
|
52
|
-
"""Get a list of connected boards"""
|
53
|
-
devices = [p.device for p in serial.tools.list_ports.comports()]
|
54
|
-
return sorted(devices)
|
55
|
-
|
56
|
-
@retry(stop=stop_after_attempt(RETRIES), wait=wait_fixed(1), retry_error_cls=ConnectionError) # type: ignore
|
57
|
-
def get_mcu_info(self, timeout:int=6):
|
58
|
-
rc, result = self.run_command(
|
59
|
-
["run", str(HERE / "../board/fw_info.py")],
|
60
|
-
no_info=True,
|
61
|
-
timeout=timeout,
|
62
|
-
)
|
63
|
-
if rc != OK:
|
64
|
-
raise ConnectionError(f"Failed to get mcu_info for {self.serialport}")
|
65
|
-
# Ok we have the info, now parse it
|
66
|
-
s = result[0].strip()
|
67
|
-
if s.startswith("{") and s.endswith("}"):
|
68
|
-
info = eval(s)
|
69
|
-
self.family = info["family"]
|
70
|
-
self.version = info["version"]
|
71
|
-
self.build = info["build"]
|
72
|
-
self.port = info["port"]
|
73
|
-
self.cpu = info["cpu"]
|
74
|
-
self.arch = info["arch"]
|
75
|
-
self.mpy = info["mpy"]
|
76
|
-
self.description = descr = info["board"]
|
77
|
-
pos = descr.rfind(" with")
|
78
|
-
if pos != -1:
|
79
|
-
short_descr = descr[:pos].strip()
|
80
|
-
else:
|
81
|
-
short_descr = ""
|
82
|
-
if board_name := find_board_designator(descr, short_descr, HERE / "../data/board_info.csv"):
|
83
|
-
self.board = board_name
|
84
|
-
else:
|
85
|
-
self.board = "UNKNOWN"
|
86
|
-
|
87
|
-
def disconnect(self) -> bool:
|
88
|
-
"""Disconnect from a board"""
|
89
|
-
if not self.connected:
|
90
|
-
return True
|
91
|
-
if not self.serialport:
|
92
|
-
log.error("No port connected")
|
93
|
-
self.connected = False
|
94
|
-
return False
|
95
|
-
log.info(f"Disconnecting from {self.serialport}")
|
96
|
-
result = self.run_command(["disconnect"])[0] == OK
|
97
|
-
self.connected = False
|
98
|
-
return result
|
99
|
-
|
100
|
-
@retry(stop=stop_after_attempt(RETRIES), wait=wait_fixed(2))
|
101
|
-
def run_command(
|
102
|
-
self,
|
103
|
-
cmd: Union[str, List[str]],
|
104
|
-
*,
|
105
|
-
log_errors: bool = True,
|
106
|
-
no_info: bool = False,
|
107
|
-
timeout: int = 60,
|
108
|
-
**kwargs,
|
109
|
-
):
|
110
|
-
"""Run mpremote with the given command
|
111
|
-
Parameters
|
112
|
-
----------
|
113
|
-
cmd : Union[str,List[str]]
|
114
|
-
The command to run, either a string or a list of strings
|
115
|
-
check : bool, optional
|
116
|
-
If True, raise an exception if the command fails, by default False
|
117
|
-
Returns
|
118
|
-
-------
|
119
|
-
bool
|
120
|
-
True if the command succeeded, False otherwise
|
121
|
-
"""
|
122
|
-
if isinstance(cmd, str):
|
123
|
-
cmd = cmd.split(" ")
|
124
|
-
prefix = [sys.executable, "-m", "mpremote", "connect", self.serialport] if self.serialport else ["mpremote"]
|
125
|
-
# if connected add resume to keep state between commands
|
126
|
-
if self.connected:
|
127
|
-
prefix += ["resume"]
|
128
|
-
cmd = prefix + cmd
|
129
|
-
log.debug(" ".join(cmd))
|
130
|
-
result = run(cmd, timeout, log_errors, no_info, **kwargs)
|
131
|
-
self.connected = result[0] == OK
|
132
|
-
return result
|
133
|
-
|
134
|
-
@retry(stop=stop_after_attempt(RETRIES), wait=wait_fixed(1))
|
135
|
-
def mip_install(self, name: str) -> bool:
|
136
|
-
"""Install a micropython package"""
|
137
|
-
# install createstubs to the board
|
138
|
-
cmd = ["mip", "install", name]
|
139
|
-
result = self.run_command(cmd)[0] == OK
|
140
|
-
self.connected = True
|
141
|
-
return result
|
File without changes
|
File without changes
|
{micropython_stubber-1.17.5.dist-info → micropython_stubber-1.19.0.dist-info}/entry_points.txt
RENAMED
File without changes
|
File without changes
|