mpflash 1.25.0rc1__py3-none-any.whl → 1.25.0rc2__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/cli_list.py CHANGED
@@ -1,4 +1,5 @@
1
1
  import json
2
+ import time
2
3
  from typing import List
3
4
 
4
5
  import rich_click as click
@@ -82,5 +83,9 @@ def cli_list_mcus(serial: List[str], ignore: List[str], bluetooth: bool, as_json
82
83
  show_mcus(conn_mcus, refresh=False)
83
84
  for mcu in conn_mcus:
84
85
  # reset the board so it can continue to whatever it was running before
85
- mcu.run_command("reset")
86
+ if mcu.family == "circuitpython":
87
+ # CircuitPython boards need a special reset command
88
+ mcu.run_command(["exec", "--no-follow", "import microcontroller,time;time.sleep(0.01);microcontroller.reset()"], resume=False)
89
+ else:
90
+ mcu.run_command("reset")
86
91
  return 0 if conn_mcus else 1
mpflash/db/core.py CHANGED
@@ -6,6 +6,7 @@ from sqlalchemy import create_engine
6
6
  from sqlalchemy.orm import sessionmaker
7
7
 
8
8
  from mpflash.config import config
9
+ from mpflash.errors import MPFlashError
9
10
 
10
11
  # TODO: lazy import to avoid slowdowns ?
11
12
  from .models import Base
@@ -24,11 +25,15 @@ def migrate_database(boards: bool = True, firmwares: bool = True):
24
25
  # get the location of the database from the session
25
26
  with Session() as session:
26
27
  db_location = session.get_bind().url.database # type: ignore
27
- log.debug(f"Database location: {Path(db_location)}") # type: ignore
28
-
29
- create_database()
28
+ log.debug(f"Database location: {Path(db_location)}") # type: ignore
29
+
30
+ try:
31
+ create_database()
32
+ except (DatabaseError, OperationalError) as e:
33
+ log.error(f"Error creating database: {e}")
34
+ log.error("Database might already exist, trying to migrate.")
35
+ raise MPFlashError("Database migration failed. Please check the logs for more details.") from e
30
36
  if boards:
31
-
32
37
  update_boards()
33
38
  if firmwares:
34
39
  jsonl_file = config.firmware_folder / "firmware.jsonl"
mpflash/db/loader.py CHANGED
@@ -76,6 +76,8 @@ def load_jsonl_to_db(jsonl_path: Path):
76
76
  if "preview" in record:
77
77
  record["version"] = f"{record['version']}-preview" if record["preview"] else record["version"]
78
78
  record.pop("preview", None) # Remove 'preview' column
79
+ if not "custom" in record:
80
+ record["custom"] = False
79
81
  firmware_file = str(Path(record["filename"]).as_posix()) if record["filename"] else ""
80
82
 
81
83
  # Check if Firmware with this firmware_file exists
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: mpflash
3
- Version: 1.25.0rc1
3
+ Version: 1.25.0rc2
4
4
  Summary: Flash and download tool for MicroPython firmwares
5
5
  License: MIT
6
6
  Keywords: MicroPython,firmware,flash,download,UF2,esptool
@@ -11,15 +11,15 @@ mpflash/bootloader/touch1200.py,sha256=VND7_YniS9Vx6WEaAxjI72RZZ6WBOwmBTsKJkbuaA
11
11
  mpflash/cli_download.py,sha256=sMMIVTE4P9O2GpWB9jcbOiKQX-XJ0nu2bBylRbWu0X8,3872
12
12
  mpflash/cli_flash.py,sha256=K2TEyQndibtKdwSkeeu_esDUsu8H0_4DB_37SF7DR9E,7657
13
13
  mpflash/cli_group.py,sha256=Uf_1ZmeeSIsaGLuuKn3KPPPVi8fJVbIacJYFZx_oPHc,2684
14
- mpflash/cli_list.py,sha256=XwX0j9JzFzm2o-_oEWLR07QaMMAUrS1a553_-IpCdj0,2352
14
+ mpflash/cli_list.py,sha256=ZuRalXXjDGo6FhgMTv54BQD_PNss7eeopeZQ_uE1J90,2632
15
15
  mpflash/cli_main.py,sha256=NMhEtMtSe7ApE-210Q4p-g7ZgewgO-4z1Q-vNKLQ47Y,1277
16
16
  mpflash/common.py,sha256=fEFxSy2KVAhBUlJv0GsWnUHdJtRckp2XGlYVPAhS8WE,5924
17
17
  mpflash/config.py,sha256=bmwNSJzk27iHcI-r3C6hm6-TeOat2ymzbbv-Q-xuO2o,3048
18
18
  mpflash/connected.py,sha256=oxZdk1o-AfNPhJsSxr3KrMH_gdYfrjqc_IpT6J8Ng9k,3496
19
19
  mpflash/db/__init__.py,sha256=wnIlO4nOXsPGXMbn2OCqHRsR-hUmtJsko8VdqjH3ZUE,45
20
- mpflash/db/core.py,sha256=2t6pE385d8WgVrG7Kp2jmGdVZ5n0FiK6mHWAWOqZXW4,1949
20
+ mpflash/db/core.py,sha256=hyzurZp8QMl8Q9B00Q-tOkOUp68T8XhM7tj3dm5cDHw,2283
21
21
  mpflash/db/gather_boards.py,sha256=8QS7NIt3n9ROqtgVAnoqU8YMeObLGaN2pvJL7d_kULA,3905
22
- mpflash/db/loader.py,sha256=RUbcnJ51r6bDq61vdglAlvYZzIaoLLGtTtm3FrSFrTQ,4758
22
+ mpflash/db/loader.py,sha256=0L4I3ySaGLFlzy9FlV7_nzbqzA6MHwi0FhgDG5FJ_9U,4848
23
23
  mpflash/db/meta.py,sha256=I7JycEx37MVVYowA0VFfUYFX9IURiTTsWQ1RhFgGqes,2251
24
24
  mpflash/db/micropython_boards.zip,sha256=cc4m7VSskj__rhabw3j5OZCiz1yEi6yCx7JGFn1QB0k,16647
25
25
  mpflash/db/models.py,sha256=Q4yjZPcNRIGWevoACeGDS1i31QX6jq1q5TsyPjmdmz4,3448
@@ -62,8 +62,8 @@ mpflash/vendor/pico-universal-flash-nuke/universal_flash_nuke.uf2,sha256=QuPMppq
62
62
  mpflash/vendor/pydfu.py,sha256=1I8dwbacUH_-u2y6gYZYRKO_Iof8Eb3rZsVyQ1ETluI,20364
63
63
  mpflash/vendor/readme.md,sha256=BQ7Uxf8joeYMjTUuSLLBG49ob6a9MgFPIEwuc72-Mfw,415
64
64
  mpflash/versions.py,sha256=HuujLNdMKY_mQXyEqwXVHcU8nbuXeBiWP2TMA5JQhr4,4884
65
- mpflash-1.25.0rc1.dist-info/entry_points.txt,sha256=Jk_visOhYOsZIcSP2Ms9hKqfKy1iorR-6dYltSoWCpY,52
66
- mpflash-1.25.0rc1.dist-info/LICENSE,sha256=mWpNhsIxWzetYNnTpr4eb3HtgsxGIC8KcYWxXEcxQvE,1077
67
- mpflash-1.25.0rc1.dist-info/METADATA,sha256=L7CGVRIBkloWrj0gm30DxyXLAtFUPE425HzvyjenePU,23938
68
- mpflash-1.25.0rc1.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
69
- mpflash-1.25.0rc1.dist-info/RECORD,,
65
+ mpflash-1.25.0rc2.dist-info/entry_points.txt,sha256=Jk_visOhYOsZIcSP2Ms9hKqfKy1iorR-6dYltSoWCpY,52
66
+ mpflash-1.25.0rc2.dist-info/LICENSE,sha256=mWpNhsIxWzetYNnTpr4eb3HtgsxGIC8KcYWxXEcxQvE,1077
67
+ mpflash-1.25.0rc2.dist-info/METADATA,sha256=yw6z-qe0GA3gXJJJHyVBp58Wqah9knQLX_vDUNTm1Y8,23938
68
+ mpflash-1.25.0rc2.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
69
+ mpflash-1.25.0rc2.dist-info/RECORD,,