micropython-stubber 1.17.5__py3-none-any.whl → 1.17.6__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: micropython-stubber
3
- Version: 1.17.5
3
+ Version: 1.17.6
4
4
  Summary: Tooling to create and maintain stubs for MicroPython
5
5
  Home-page: https://github.com/Josverl/micropython-stubber#readme
6
6
  License: MIT
@@ -1,37 +1,37 @@
1
1
  mpflash/mpflash/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- mpflash/mpflash/cli_group.py,sha256=FuSJwE0z1lvnT1TMFs8Ejsps3UUzxyI-xdzYOa_HA3A,1226
3
- mpflash/mpflash/cli_main.py,sha256=fAh_gUrn2Tvo5PkFjiCNy0FX_KYlRY6y627WG0t1MGE,498
4
- mpflash/mpflash/common.py,sha256=bW1_JY5904cm6luUlMQmzgYXk7ukrDyMaxwovOyfHes,3875
2
+ mpflash/mpflash/cli_group.py,sha256=oWgZlUoXY_Wc9-XMXxuxH3F0TevYNafsFWpRtT_WiiU,1228
3
+ mpflash/mpflash/cli_main.py,sha256=nLFfR-ti_stLVvgwDRsNXgaQ43gQVZUOz_xvRERPuy0,494
4
+ mpflash/mpflash/common.py,sha256=RBNfbojPKLK3_cxLFIvtHWy8UZUbBxN0ogBN0nliVR4,3896
5
5
  mpflash/mpflash/config.py,sha256=R_sYZ_UwzIc9H2vhwIU5RSDhpcV3fHIX83FEURWOd5E,160
6
- mpflash/mpflash/downloader.py,sha256=OsOTNjv-91RQc2quD8ptUzI1-pJhHekE8jARdg-1rhk,9961
6
+ mpflash/mpflash/downloader.py,sha256=QVtgocj4b-c9ZunzEZnsyhEZu_Lbk8Hk-43qWBMJ0AI,9783
7
7
  mpflash/mpflash/flash_esp.py,sha256=XffVg1BKzaQo4pzSJdUoHmHa7h4s4gBlNQR50ahGJ1E,2301
8
8
  mpflash/mpflash/flash_stm32.py,sha256=Pn1y9rKw48D0khucT8yU3NjFkHQ9YYTvwco9ir4MmpQ,3742
9
9
  mpflash/mpflash/flash_uf2.py,sha256=8rZRqdi3Rtp8UsHxKgmoMfZ1yBXZbMFXcOeyVVMmX5w,2029
10
- mpflash/mpflash/flash_uf2_linux.py,sha256=NlnFN67qmUHw4GKOSay87I4H30ipOlrdHkFTF7MLwPc,3841
10
+ mpflash/mpflash/flash_uf2_linux.py,sha256=wXtpqFan6x5k8h2bwwLqwY-LKbpyTg7n2SbD4eb6yH0,4012
11
11
  mpflash/mpflash/flash_uf2_windows.py,sha256=AiFg5jrSyEMX2QxC2sgfn8GekKBw-fPkIi8emlU7Z7o,711
12
- mpflash/mpflash/flasher.py,sha256=_N-CYZZZ401kxZ45CDgl1XDj3lqdMPHjhpbn82ow2Kc,9575
13
- mpflash/mpflash/list.py,sha256=shFNDyEnmqqDjiJ4WSpJLTkDO_6H3fvYBeJKzfGFJMw,2004
12
+ mpflash/mpflash/flasher.py,sha256=J7-bsrfQ0MPEKrnUx47q0OqAS61roLBaETu4nv4MfMU,9400
13
+ mpflash/mpflash/list.py,sha256=7GpZEK7fh6GCzgUdRLHGp8FMEeCbLstV-2u3ohaRYsc,1970
14
14
  mpflash/mpflash/logger.py,sha256=FvGQSR2l4O9nmJV0rKbyoeJDd7fbY2vKQTmPEED0h6s,1048
15
15
  mpflash/mpflash/uf2_boardid.py,sha256=WZKucGu_hJ8ymb236uuZbiR6pD6AA_l4LA-7LwtQhq8,414
16
- mpflash/poetry.lock,sha256=l12pnxUVYcoxY0wsF-fbuKdaXTERhbmVLGNG-UJsvSA,137771
17
- mpflash/pyproject.toml,sha256=JvsomVM_lkFtOpgz1tl6MgHVFmNaPTOU4BH31FvyFfg,1324
18
- mpflash/README.md,sha256=duiZ7oJb9821qJqwT9oMoOxDqaQRZLeVR2MpojLeKM4,11275
19
- stubber/__init__.py,sha256=8COnpfs3Cp80leTdzMMC08HsaDEJvmkcByuc_LaaHL0,49
16
+ mpflash/poetry.lock,sha256=1Gf00ycWFfkHFFmLFDnL8ov7GhZPz0qYv-k2S91s-xo,137771
17
+ mpflash/pyproject.toml,sha256=vffY5dhFWQLUllZl_-f5YFfSsmYwvBN8DakysierFOA,1247
18
+ mpflash/README.md,sha256=B25tOMF5eyZ3ych_6pfTWRc6cJxwNPXbw7F2QMfJt8A,11455
19
+ stubber/__init__.py,sha256=b_G4a0TzIG3P--Gsh1qzZaXiera0wZdKQDeZvPTSECM,49
20
20
  stubber/basicgit.py,sha256=5y7eIxmZXfGHwgGrdHtFWTB-tYdgAc7A-0b299wHMYc,9543
21
21
  stubber/board/board_info.csv,sha256=K2VSmfR013fN-oJWkQUmiQ19w09dVwJHDquPy6QmMhY,8627
22
22
  stubber/board/boot.py,sha256=XjWlKErU5nI1HJSugXIP_3hlwgRQboE6sJrpcbSygnk,1120
23
- stubber/board/createstubs.py,sha256=H9br-MDsuYZ1n8_ehA4GbRNzLevg0uih5r3RojZbU-w,32546
24
- stubber/board/createstubs_db.py,sha256=GDCA69oH5iKEutIww6v_WCsM7Qel-hG6eP1PXgkmmAI,30284
25
- stubber/board/createstubs_db_min.py,sha256=iTepiVcMzx4jc4dsaUPpsuS_aS2arYtNu98DInTI5eI,11424
26
- stubber/board/createstubs_db_mpy.mpy,sha256=5EznC9ZMMykldMvD5WqY5Ef5uI-5uhtVamGIq50dnTQ,9509
23
+ stubber/board/createstubs.py,sha256=4yD2Ixt-E2fUS2Rq3zBrcFKYNr_avNg0pBWQP4HrWgk,32546
24
+ stubber/board/createstubs_db.py,sha256=pbfa7tNxs0GtjaknCCDPmDqNpukw5DKqqd3UlJNiW2E,30284
25
+ stubber/board/createstubs_db_min.py,sha256=FxhpNl8iMpH8JNXy8f6i0Ijk_e6rlGiHRv5gVK5HuYM,11424
26
+ stubber/board/createstubs_db_mpy.mpy,sha256=tedfLsrbARO2mqJrZ-8565wMg4VMq88yB-S_f4xjt0I,9509
27
27
  stubber/board/createstubs_lvgl.py,sha256=CTe7eq1ACRK_JJxavaqDD8znn29nSWJiHHTZ_ps6EhM,27217
28
28
  stubber/board/createstubs_lvgl_min.py,sha256=jLkWYmeboI2A8feMC7pT7cYWttLejQTuX7WAEZCylhw,27207
29
29
  stubber/board/createstubs_lvgl_mpy.mpy,sha256=ex-nlq2V5e8anQBJvRWEEc-FzU7nlwg5NSrZ8vOadIA,9267
30
- stubber/board/createstubs_mem.py,sha256=taf12EX-546Bl-pE4K3PL0Qk_FD1tk5BrKNCl06lCGI,28618
31
- stubber/board/createstubs_mem_min.py,sha256=fZ9nS7z7ncSgZsEzxPYTWYP1DzE3BGkRhnnuaQ8LA0w,10970
32
- stubber/board/createstubs_mem_mpy.mpy,sha256=7autWFvUL0oP03qAh6okGghZAh3g8WtGjH5puJFqF-s,9091
33
- stubber/board/createstubs_min.py,sha256=V9mSqVH2UpZcUwg4SPeXLTrSetfIwQZqxh77HlLv3k4,13509
34
- stubber/board/createstubs_mpy.mpy,sha256=Ck2ZtG8PLrq214sJOKVbJr2q9I21c2aYWcwqbjNZX-Y,12193
30
+ stubber/board/createstubs_mem.py,sha256=H8RV8p_tI8u2wsxbv4lPUQ-6e5xm0G2fL48s09rk1OY,28618
31
+ stubber/board/createstubs_mem_min.py,sha256=aJGZFnYhz3nF7R8OZDydOBs1y1RorLDpV6UYpo3ykSg,10970
32
+ stubber/board/createstubs_mem_mpy.mpy,sha256=SJow8erMqxCCDTkrmy5_O1S-iQy5uXyTosYGEkSpTY8,9091
33
+ stubber/board/createstubs_min.py,sha256=9s0KTIXVwzD386ECOvVd1MW04bztv1XZd1WbsDtPErs,13509
34
+ stubber/board/createstubs_mpy.mpy,sha256=YBDgMGamFVTq6HvTsQkAWBi7TxvC0oBEsqVL7IWbB2o,12193
35
35
  stubber/board/fw_info.py,sha256=6AQbN3jtQgllqWQYl4e-63KeEtV08EXk8_JnM6XBkvo,4554
36
36
  stubber/board/info.py,sha256=b7SOPZHVsVhaayKCwVkFZlYu0BW-UFI7LuG1Eop9480,5629
37
37
  stubber/board/main.py,sha256=f6V3tdt6sPZVLuwemT-NLuK9GySfW2c2J6PJMOOWQQw,413
@@ -40,7 +40,7 @@ stubber/board/pyrightconfig.json,sha256=6oHS4aDOfwKBAFeUPsCGJzEXpUgBZsPaF0M4P-N2
40
40
  stubber/bulk/board_id.py,sha256=R37zhRpg9kj3CqDJvPacQdbLq4d9k-Du1e7VUDWrzkI,1531
41
41
  stubber/bulk/mcu_stubber.py,sha256=NvJ8Q8nw09EfUsRg58FOGLldvb3lVIqQ1CHnpIIyeSk,16287
42
42
  stubber/bulk/mpremoteboard.py,sha256=YtaCZBCeS1ZBZrLGI7cVWuM0-0Fyc-hSpxLWofmo0qA,4843
43
- stubber/bulk/runner.py,sha256=r6b5V6U6LvYbrHH2L8zWwsaCqoTvgVTdU4w83CUH79Y,4070
43
+ stubber/bulk/runner.py,sha256=AQUu8Rhj2jN5-R8F7zHi8pOCv6Z3HE0E0-KIed7QDx4,4159
44
44
  stubber/codemod/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
45
45
  stubber/codemod/_partials/__init__.py,sha256=4v1lkgSBzFw08gxwujh5sivpbJbYqg5lZeRzgyvN4TE,1561
46
46
  stubber/codemod/_partials/db_main.py,sha256=APeyLDuAc-FNXRQ7ECFVqVPLfOLVyAoLuE83e2Sfg1E,4183
@@ -125,8 +125,8 @@ stubber/utils/stubmaker.py,sha256=qld_Wfm9f4EuzedXlX1Ky0i0BJdR75oOOTha13_ekz0,52
125
125
  stubber/utils/typed_config_toml.py,sha256=ikifCIZGNhS_uqsfp6IwIpxdtZqbLtywprjWG_Q0y8o,2629
126
126
  stubber/utils/versions.py,sha256=VvADhHG3ZEu5z1mm927Aj18PO1krFvxVXxxwdecRPlY,3756
127
127
  stubber/variants.py,sha256=-o4TgotbKaCcYBdXkutPaBSR1JdxWmOAiuNT1UlahYc,3784
128
- micropython_stubber-1.17.5.dist-info/entry_points.txt,sha256=NQi_M36fgq5k6giSuASas3LrpF6CVdkzfvJC0ja73_g,55
129
- micropython_stubber-1.17.5.dist-info/LICENSE,sha256=Fx9qrL45ayRXgH6QzttboqZEjKXms0w1t_b_nkOqYCU,1572
130
- micropython_stubber-1.17.5.dist-info/METADATA,sha256=yAYj5axWwo_M19-u4Mv2reEoSFEx7vLMwpClsDu3T7I,19029
131
- micropython_stubber-1.17.5.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
132
- micropython_stubber-1.17.5.dist-info/RECORD,,
128
+ micropython_stubber-1.17.6.dist-info/entry_points.txt,sha256=NQi_M36fgq5k6giSuASas3LrpF6CVdkzfvJC0ja73_g,55
129
+ micropython_stubber-1.17.6.dist-info/LICENSE,sha256=Fx9qrL45ayRXgH6QzttboqZEjKXms0w1t_b_nkOqYCU,1572
130
+ micropython_stubber-1.17.6.dist-info/METADATA,sha256=vXkIJk9X8j3kkA6jrJzRYWXYeGXoASOg8710O_qwL8s,19029
131
+ micropython_stubber-1.17.6.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
132
+ micropython_stubber-1.17.6.dist-info/RECORD,,
mpflash/README.md CHANGED
@@ -43,9 +43,12 @@ This will download the latest stable version of the MicroPython firmware for the
43
43
  The stable version (default) is determined based on the most recent published release,
44
44
  other optionse are `--version preview` and `--version x.y.z` to download the latest preview or version x.y.z respectively.
45
45
 
46
+ by default the firmware will be downloaded to Downloads in a `firmware` folder in your, but you can specify a different directory using the `--dir` option.
47
+
48
+ ```bash
46
49
  The directory structure will be something like this:
47
50
  ```
48
- firmware
51
+ Downloads/firmware
49
52
  | firmware.jsonl
50
53
  +---esp8266
51
54
  | ESP8266_GENERIC-FLASH_1M-v1.22.2.bin
@@ -40,11 +40,11 @@ def cb_ignore(ctx, param, value):
40
40
  "--ignore",
41
41
  "-i",
42
42
  is_eager=True,
43
- help="Serial port(s) to ignore. Defaults to MPTOOL_IGNORE.",
43
+ help="Serial port(s) to ignore. Defaults to MPFLASH_IGNORE.",
44
44
  callback=cb_ignore,
45
45
  multiple=True,
46
46
  default=[],
47
- envvar="MPTOOL_IGNORE",
47
+ envvar="MPFLASH_IGNORE",
48
48
  show_default=True,
49
49
  metavar="SERIALPORT",
50
50
  )
@@ -14,7 +14,7 @@ def mpflash():
14
14
  # cli.add_command(flash_board)
15
15
  # cli.add_command(list_boards)
16
16
  # cli.add_command(download)
17
- cli() # auto_envvar_prefix='MPTOOL')
17
+ cli(auto_envvar_prefix="MPFLASH")
18
18
 
19
19
 
20
20
  if __name__ == "__main__":
mpflash/mpflash/common.py CHANGED
@@ -1,6 +1,7 @@
1
1
  from pathlib import Path
2
2
  from typing import Dict, Union
3
3
 
4
+ import platformdirs
4
5
  from github import Github
5
6
  from loguru import logger as log
6
7
  from packaging.version import parse
@@ -12,11 +13,11 @@ PORT_FWTYPES = {
12
13
  "rp2": ".uf2",
13
14
  "samd": ".uf2",
14
15
  "mimxrt": ".hex",
15
- "nrf": ".hex",
16
+ "nrf": ".uf2",
16
17
  "renesas-ra": ".hex",
17
18
  }
18
19
 
19
- DEFAULT_FW_PATH = Path.cwd() / "firmware"
20
+ DEFAULT_FW_PATH = platformdirs.user_downloads_path() / "firmware"
20
21
  # DEFAULT_FW_PATH = Path.home() / "mp_firmware"
21
22
 
22
23
  FWInfo = Dict[str, Union[str, bool]]
@@ -87,9 +88,7 @@ def micropython_versions(minver: str = "v1.9.2"):
87
88
  g = Github()
88
89
  _ = 1 / 0
89
90
  repo = g.get_repo("micropython/micropython")
90
- versions = [
91
- tag.name for tag in repo.get_tags() if parse(tag.name) >= parse(minver)
92
- ]
91
+ versions = [tag.name for tag in repo.get_tags() if parse(tag.name) >= parse(minver)]
93
92
  except Exception:
94
93
  versions = [
95
94
  "v9.99.9-preview",
@@ -18,7 +18,7 @@ from loguru import logger as log
18
18
  from rich.progress import track
19
19
 
20
20
  from .cli_group import cli
21
- from .common import PORT_FWTYPES, clean_version
21
+ from .common import DEFAULT_FW_PATH, PORT_FWTYPES, clean_version
22
22
 
23
23
  MICROPYTHON_ORG_URL = "https://micropython.org/"
24
24
 
@@ -40,6 +40,7 @@ DEFAULT_BOARDS = [
40
40
  "ARDUINO_NANO_RP2040_CONNECT",
41
41
  "PIMORONI_PICOLIPO_16MB",
42
42
  "SEEED_WIO_TERMINAL",
43
+ "PARTICLE_XENON",
43
44
  ]
44
45
 
45
46
 
@@ -77,9 +78,7 @@ def firmware_list(board_url: str, base_url: str, ext: str) -> List[str]:
77
78
  tags = soup.findAll(
78
79
  "a",
79
80
  recursive=True,
80
- attrs={
81
- "href": re.compile(r"^/resources/firmware/.*\." + ext.lstrip(".") + "$")
82
- },
81
+ attrs={"href": re.compile(r"^/resources/firmware/.*\." + ext.lstrip(".") + "$")},
83
82
  )
84
83
  if "?" in base_url:
85
84
  base_url = base_url.split("?")[0]
@@ -94,9 +93,7 @@ FirmwareInfo = Dict[str, str]
94
93
  # boards we are interested in ( this avoids getting a lot of boards we don't care about)
95
94
  # The first run takes ~60 seconds to run for 4 ports , all boards
96
95
  # so it makes sense to cache the results and skip boards as soon as possible
97
- def get_boards(
98
- fw_types: Dict[str, str], board_list: List[str], clean: bool
99
- ) -> List[FirmwareInfo]:
96
+ def get_boards(fw_types: Dict[str, str], board_list: List[str], clean: bool) -> List[FirmwareInfo]:
100
97
  board_urls: List[FirmwareInfo] = []
101
98
  for port in fw_types:
102
99
  download_page_url = f"{MICROPYTHON_ORG_URL}download/?port={port}"
@@ -107,9 +104,7 @@ def get_boards(
107
104
  for board in _urls:
108
105
  board["port"] = port
109
106
 
110
- for board in track(
111
- _urls, description="Checking download pages", transient=True
112
- ):
107
+ for board in track(_urls, description=f"Checking {port} download pages", transient=True):
113
108
  # add a board to the list for each firmware found
114
109
  firmwares = firmware_list(board["url"], MICROPYTHON_ORG_URL, fw_types[port])
115
110
  for _url in firmwares:
@@ -130,11 +125,7 @@ def get_boards(
130
125
  # remove hash from firmware name
131
126
  fname = re.sub(RE_HASH, ".", fname)
132
127
  board["filename"] = fname
133
- board["variant"] = (
134
- board["filename"].split("-v")[0]
135
- if "-v" in board["filename"]
136
- else ""
137
- )
128
+ board["variant"] = board["filename"].split("-v")[0] if "-v" in board["filename"] else ""
138
129
  board_urls.append(board.copy())
139
130
  return board_urls
140
131
 
@@ -171,9 +162,7 @@ def download_firmwares(
171
162
 
172
163
  firmware_folder.mkdir(exist_ok=True)
173
164
 
174
- with open(
175
- firmware_folder / "firmware.jsonl", "a", encoding="utf-8", buffering=1
176
- ) as f_jsonl:
165
+ with open(firmware_folder / "firmware.jsonl", "a", encoding="utf-8", buffering=1) as f_jsonl:
177
166
  for board in unique_boards:
178
167
  filename = firmware_folder / board["port"] / board["filename"]
179
168
  filename.parent.mkdir(exist_ok=True)
@@ -197,21 +186,16 @@ def download_firmwares(
197
186
  log.info(f"Downloaded {downloaded} firmwares, skipped {skipped} existing files.")
198
187
 
199
188
 
200
- def get_firmware_list(
201
- board_list: List[str], version_list: List[str], preview: bool, clean: bool
202
- ):
189
+ def get_firmware_list(board_list: List[str], version_list: List[str], preview: bool, clean: bool):
203
190
  log.trace("Checking MicroPython download pages")
204
191
 
205
- board_urls = sorted(
206
- get_boards(PORT_FWTYPES, board_list, clean), key=key_fw_variant_ver
207
- )
192
+ board_urls = sorted(get_boards(PORT_FWTYPES, board_list, clean), key=key_fw_variant_ver)
208
193
 
209
194
  log.debug(f"Total {len(board_urls)} firmwares")
210
195
  relevant = [
211
196
  board
212
197
  for board in board_urls
213
- if board["board"] in board_list
214
- and (board["version"] in version_list or board["preview"] and preview)
198
+ if board["board"] in board_list and (board["version"] in version_list or board["preview"] and preview)
215
199
  # and b["port"] in ["esp32", "rp2"]
216
200
  ]
217
201
  log.debug(f"Matching firmwares: {len(relevant)}")
@@ -233,7 +217,7 @@ def get_firmware_list(
233
217
  "--destination",
234
218
  "-d",
235
219
  type=click.Path(file_okay=False, dir_okay=True, path_type=Path),
236
- default="./firmware",
220
+ default=DEFAULT_FW_PATH,
237
221
  show_default=True,
238
222
  help="The folder to download the firmware to.",
239
223
  )
@@ -267,19 +251,13 @@ def get_firmware_list(
267
251
  help="""Force download of firmware even if it already exists.""",
268
252
  show_default=True,
269
253
  )
270
- def download(
271
- destination: Path, boards: List[str], versions: List[str], force: bool, clean: bool
272
- ):
254
+ def download(destination: Path, boards: List[str], versions: List[str], force: bool, clean: bool):
273
255
  versions = list(versions)
274
256
  # preview is not a version, it is an option to include preview versions
275
257
  preview = "preview" in versions
276
258
  versions = [v for v in versions if v != "preview"]
277
259
 
278
260
  boards = list(boards) or DEFAULT_BOARDS
279
- versions = [
280
- clean_version(v, drop_v=True) for v in versions
281
- ] # remove leading v from version
261
+ versions = [clean_version(v, drop_v=True) for v in versions] # remove leading v from version
282
262
  destination.mkdir(exist_ok=True)
283
- download_firmwares(
284
- destination, boards, versions, preview=preview, force=force, clean=clean
285
- )
263
+ download_firmwares(destination, boards, versions, preview=preview, force=force, clean=clean)
@@ -1,11 +1,13 @@
1
1
  from __future__ import annotations
2
- from pathlib import Path
2
+
3
3
  import subprocess
4
4
  import sys
5
5
  import time
6
+ from pathlib import Path
7
+ from typing import List
8
+
6
9
  from loguru import logger as log
7
10
 
8
- from typing import List
9
11
  from .uf2_boardid import get_board_id
10
12
 
11
13
  glb_dismount_me: List[UF2Disk] = []
@@ -112,10 +114,14 @@ def wait_for_UF2_linux():
112
114
  for drive in get_uf2_drives():
113
115
  pmount(drive)
114
116
  time.sleep(1)
115
- if Path(drive.mountpoint, "INFO_UF2.TXT").exists():
116
- board_id = get_board_id(Path(drive.mountpoint)) # type: ignore
117
- destination = Path(drive.mountpoint)
118
- break
117
+ try:
118
+ if Path(drive.mountpoint, "INFO_UF2.TXT").exists():
119
+ board_id = get_board_id(Path(drive.mountpoint)) # type: ignore
120
+ destination = Path(drive.mountpoint)
121
+ break
122
+ except PermissionError:
123
+ log.debug(f"Permission error on {drive.mountpoint}")
124
+ continue
119
125
  time.sleep(1)
120
126
  wait -= 1
121
127
  return destination
@@ -104,9 +104,7 @@ def auto_update(conn_boards: List[MPRemoteBoard], target_version: str, fw_folder
104
104
  wl: WorkList = []
105
105
  for mcu in conn_boards:
106
106
  if mcu.family != "micropython":
107
- log.warning(
108
- f"Skipping {mcu.board} on {mcu.serialport} as it is not a micropython board"
109
- )
107
+ log.warning(f"Skipping {mcu.board} on {mcu.serialport} as it is not a micropython board")
110
108
  continue
111
109
  board_firmwares = find_firmware(
112
110
  fw_folder=fw_folder,
@@ -117,19 +115,13 @@ def auto_update(conn_boards: List[MPRemoteBoard], target_version: str, fw_folder
117
115
  )
118
116
 
119
117
  if not board_firmwares:
120
- log.error(
121
- f"No {target_version} firmware found for {mcu.board} on {mcu.serialport}."
122
- )
118
+ log.error(f"No {target_version} firmware found for {mcu.board} on {mcu.serialport}.")
123
119
  continue
124
120
  if len(board_firmwares) > 1:
125
- log.debug(
126
- f"Multiple {target_version} firmwares found for {mcu.board} on {mcu.serialport}."
127
- )
121
+ log.debug(f"Multiple {target_version} firmwares found for {mcu.board} on {mcu.serialport}.")
128
122
  # just use the last firmware
129
123
  fw_info = board_firmwares[-1]
130
- log.info(
131
- f"Found {target_version} firmware {fw_info['filename']} for {mcu.board} on {mcu.serialport}."
132
- )
124
+ log.info(f"Found {target_version} firmware {fw_info['filename']} for {mcu.board} on {mcu.serialport}.")
133
125
  wl.append((mcu, fw_info))
134
126
  return wl
135
127
 
@@ -148,7 +140,7 @@ def auto_update(conn_boards: List[MPRemoteBoard], target_version: str, fw_folder
148
140
  "-f",
149
141
  "fw_folder",
150
142
  type=click.Path(exists=True, file_okay=False, dir_okay=True, path_type=Path),
151
- default="./firmware",
143
+ default=DEFAULT_FW_PATH,
152
144
  show_default=True,
153
145
  help="The folder to retrieve the firmware from.",
154
146
  )
@@ -233,9 +225,7 @@ def flash_board(
233
225
  if serial_port == "auto":
234
226
  # update all connected boards
235
227
  conn_boards = [
236
- MPRemoteBoard(sp)
237
- for sp in MPRemoteBoard.connected_boards()
238
- if sp not in config.ignore_ports
228
+ MPRemoteBoard(sp) for sp in MPRemoteBoard.connected_boards() if sp not in config.ignore_ports
239
229
  ]
240
230
  else:
241
231
  # just this serial port
@@ -247,9 +237,7 @@ def flash_board(
247
237
  for mcu, fw_info in todo:
248
238
  fw_file = fw_folder / fw_info["filename"] # type: ignore
249
239
  if not fw_file.exists():
250
- log.error(
251
- f"File {fw_file} does not exist, skipping {mcu.board} on {mcu.serialport}"
252
- )
240
+ log.error(f"File {fw_file} does not exist, skipping {mcu.board} on {mcu.serialport}")
253
241
  continue
254
242
  log.info(f"Updating {mcu.board} on {mcu.serialport} to {fw_info['version']}")
255
243
 
@@ -269,12 +257,13 @@ def flash_board(
269
257
 
270
258
  if flashed:
271
259
  log.info(f"Flashed {len(flashed)} boards")
272
- conn_boards = [
273
- MPRemoteBoard(sp)
274
- for sp in MPRemoteBoard.connected_boards()
275
- if sp not in config.ignore_ports
276
- ]
277
- show_boards(conn_boards, title="Connected boards after flashing")
260
+ # conn_boards = [
261
+ # MPRemoteBoard(sp)
262
+ # for sp in MPRemoteBoard.connected_boards()
263
+ # if sp not in config.ignore_ports
264
+ # ]
265
+
266
+ show_boards(flashed, title="Connected boards after flashing")
278
267
 
279
268
 
280
269
  # TODO:
mpflash/mpflash/list.py CHANGED
@@ -24,11 +24,7 @@ from .config import config
24
24
  help="""Output in json format""",
25
25
  )
26
26
  def list_boards(as_json: bool):
27
- conn_boards = [
28
- MPRemoteBoard(sp)
29
- for sp in MPRemoteBoard.connected_boards()
30
- if sp not in config.ignore_ports
31
- ]
27
+ conn_boards = [MPRemoteBoard(sp) for sp in MPRemoteBoard.connected_boards() if sp not in config.ignore_ports]
32
28
 
33
29
  for mcu in track(conn_boards, description="Getting board info"):
34
30
  try:
mpflash/poetry.lock CHANGED
@@ -1777,4 +1777,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p
1777
1777
  [metadata]
1778
1778
  lock-version = "2.0"
1779
1779
  python-versions = ">=3.9,<3.12"
1780
- content-hash = "0e7b4bce38a6ab5223f97d0dc1a275d0458951b0572fd9154741264d32101602"
1780
+ content-hash = "f759dfee8eeeb1da187db90a1a4a53c08e0029961413ce4bfc209b8593d6f3b0"
mpflash/pyproject.toml CHANGED
@@ -1,11 +1,11 @@
1
1
  [tool.poetry]
2
2
  name = "mpflash"
3
- version = "0.2.0"
4
- description = "Download and flashing tool for MicroPython firmwares"
3
+ version = "0.2.3"
4
+ description = "Download and flash tool for MicroPython firmwares"
5
5
  authors = ["Jos Verlinde <jos_verlinde@hotmail.com>"]
6
6
  license = "MIT"
7
7
  readme = "README.md"
8
- keywords = ["MicroPython", "firmware", "flashing", "download"]
8
+ keywords = ["MicroPython", "firmware", "flash", "download", "UF2", "esptool"]
9
9
  homepage = "https://github.com/Josverl/micropython-stubber/blob/main/src/mpflash/README.md"
10
10
  repository = "https://github.com/Josverl/micropython-stubber"
11
11
  classifiers = [
@@ -27,11 +27,11 @@ jsonlines = "^4.0.0"
27
27
  bincopy = "^20.0.0"
28
28
  strip-ansi = "^0.1.1"
29
29
  rich-click = "^1.7.3"
30
- # micropython-stubber = {git = "https://github.com/josverl/micropython-stubber.git", rev = "action_board_stubber"}
31
- micropython-stubber = "1.17.4"
30
+ micropython-stubber = ">=1.17.4"
32
31
  psutil = "^5.9.8"
33
32
  blkinfo = "^0.2.0"
34
33
  pygithub = "^2.1.1"
34
+ platformdirs = "^4.2.0"
35
35
 
36
36
  [tool.poetry.group.dev.dependencies]
37
37
  types-beautifulsoup4 = "^4.12.0.20240106"
stubber/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  """get the version"""
2
2
 
3
- __version__ = "1.17.5"
3
+ __version__ = "1.17.6"
@@ -24,7 +24,7 @@ try:
24
24
  except ImportError:
25
25
  from ucollections import OrderedDict # type: ignore
26
26
 
27
- __version__ = "v1.17.5"
27
+ __version__ = "v1.17.6"
28
28
  ENOENT = 2
29
29
  _MAX_CLASS_LEVEL = 2 # Max class nesting
30
30
  LIBS = ["lib", "/lib", "/sd/lib", "/flash/lib", "."]
@@ -18,7 +18,7 @@ Create stubs for (all) modules on a MicroPython board.
18
18
  - cross compilation, using mpy-cross, to avoid the compilation step on the micropython device
19
19
 
20
20
 
21
- This variant was generated from createstubs.py by micropython-stubber v1.17.5
21
+ This variant was generated from createstubs.py by micropython-stubber v1.17.6
22
22
  """
23
23
 
24
24
  # Copyright (c) 2019-2023 Jos Verlinde
@@ -43,7 +43,7 @@ try:
43
43
  except ImportError:
44
44
  from ucollections import OrderedDict # type: ignore
45
45
 
46
- __version__ = "v1.17.5"
46
+ __version__ = "v1.17.6"
47
47
  ENOENT = 2
48
48
  _MAX_CLASS_LEVEL = 2 # Max class nesting
49
49
  LIBS = ["lib", "/lib", "/sd/lib", "/flash/lib", "."]
@@ -51,7 +51,7 @@ try:from machine import reset
51
51
  except O:pass
52
52
  try:from collections import OrderedDict as k
53
53
  except O:from ucollections import OrderedDict as k
54
- __version__='v1.17.5'
54
+ __version__='v1.17.6'
55
55
  A3=2
56
56
  A4=2
57
57
  A5=['lib','/lib','/sd/lib','/flash/lib',J]
Binary file
@@ -9,7 +9,7 @@
9
9
  - cross compilation, using mpy-cross,
10
10
  to avoid the compilation step on the micropython device
11
11
 
12
- This variant was generated from createstubs.py by micropython-stubber v1.17.5
12
+ This variant was generated from createstubs.py by micropython-stubber v1.17.6
13
13
  """
14
14
 
15
15
  # Copyright (c) 2019-2023 Jos Verlinde
@@ -34,7 +34,7 @@ try:
34
34
  except ImportError:
35
35
  from ucollections import OrderedDict # type: ignore
36
36
 
37
- __version__ = "v1.17.5"
37
+ __version__ = "v1.17.6"
38
38
  ENOENT = 2
39
39
  _MAX_CLASS_LEVEL = 2 # Max class nesting
40
40
  LIBS = ["lib", "/lib", "/sd/lib", "/flash/lib", "."]
@@ -47,7 +47,7 @@ try:from machine import reset
47
47
  except N:pass
48
48
  try:from collections import OrderedDict as f
49
49
  except N:from ucollections import OrderedDict as f
50
- __version__='v1.17.5'
50
+ __version__='v1.17.6'
51
51
  y=2
52
52
  z=2
53
53
  A0=['lib','/lib','/sd/lib','/flash/lib',J]
Binary file
@@ -50,7 +50,7 @@ try:from machine import reset
50
50
  except N:pass
51
51
  try:from collections import OrderedDict as g
52
52
  except N:from ucollections import OrderedDict as g
53
- __version__='v1.17.5'
53
+ __version__='v1.17.6'
54
54
  A0=2
55
55
  A1=2
56
56
  A5=['lib','/lib','/sd/lib','/flash/lib',J]
Binary file
stubber/bulk/runner.py CHANGED
@@ -11,6 +11,7 @@ from loguru import logger as log
11
11
 
12
12
  LogTagList = List[str]
13
13
 
14
+
14
15
  @dataclass
15
16
  class LogTags:
16
17
  reset_tags: LogTagList
@@ -115,9 +116,10 @@ def run(
115
116
  if proc.stderr and log_errors:
116
117
  for line in proc.stderr:
117
118
  log.warning(line)
119
+ except UnicodeDecodeError as e:
120
+ log.error(f"Failed to decode output: {e}")
118
121
  finally:
119
122
  timer.cancel()
120
123
 
121
124
  proc.wait(timeout=1)
122
125
  return proc.returncode or 0, output
123
-