mpflash 1.0.2__py3-none-any.whl → 1.0.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/connected.py +2 -10
- mpflash/mpboard_id/boardinfo.csv +2389 -0
- mpflash/mpboard_id/store.py +8 -3
- mpflash/mpremoteboard/mpy_fw_info.py +27 -16
- {mpflash-1.0.2.dist-info → mpflash-1.0.3.dist-info}/METADATA +1 -1
- {mpflash-1.0.2.dist-info → mpflash-1.0.3.dist-info}/RECORD +9 -8
- {mpflash-1.0.2.dist-info → mpflash-1.0.3.dist-info}/LICENSE +0 -0
- {mpflash-1.0.2.dist-info → mpflash-1.0.3.dist-info}/WHEEL +0 -0
- {mpflash-1.0.2.dist-info → mpflash-1.0.3.dist-info}/entry_points.txt +0 -0
mpflash/mpboard_id/store.py
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
import functools
|
2
2
|
import zipfile
|
3
3
|
from pathlib import Path
|
4
|
-
from typing import List, Optional
|
4
|
+
from typing import Final, List, Optional
|
5
5
|
|
6
6
|
import jsons
|
7
7
|
|
8
8
|
from mpflash.mpboard_id.board import Board
|
9
9
|
|
10
10
|
###############################################################################################
|
11
|
-
HERE = Path(__file__).parent
|
11
|
+
HERE: Final = Path(__file__).parent
|
12
12
|
###############################################################################################
|
13
13
|
|
14
14
|
|
15
|
-
def write_boardinfo_json(board_list: List[Board], *, folder: Path):
|
15
|
+
def write_boardinfo_json(board_list: List[Board], *, folder: Optional[Path] = None):
|
16
16
|
"""Writes the board information to a JSON file.
|
17
17
|
|
18
18
|
Args:
|
@@ -21,6 +21,8 @@ def write_boardinfo_json(board_list: List[Board], *, folder: Path):
|
|
21
21
|
"""
|
22
22
|
import zipfile
|
23
23
|
|
24
|
+
if not folder:
|
25
|
+
folder = HERE
|
24
26
|
# create a zip file with the json file
|
25
27
|
with zipfile.ZipFile(folder / "board_info.zip", "w", compression=zipfile.ZIP_DEFLATED) as zipf:
|
26
28
|
# write the list to json file inside the zip
|
@@ -30,6 +32,9 @@ def write_boardinfo_json(board_list: List[Board], *, folder: Path):
|
|
30
32
|
|
31
33
|
@functools.lru_cache(maxsize=20)
|
32
34
|
def read_known_boardinfo(board_info: Optional[Path] = None) -> List[Board]:
|
35
|
+
"""Reads the board information from a JSON file in a zip file."""
|
36
|
+
|
37
|
+
import zipfile
|
33
38
|
|
34
39
|
if not board_info:
|
35
40
|
board_info = HERE / "board_info.zip"
|
@@ -36,7 +36,9 @@ def _info(): # type:() -> dict[str, str]
|
|
36
36
|
"version": "",
|
37
37
|
"build": "",
|
38
38
|
"ver": "",
|
39
|
-
"port":
|
39
|
+
"port": (
|
40
|
+
"stm32" if sys.platform.startswith("pyb") else sys.platform
|
41
|
+
), # port: esp32 / win32 / linux / stm32
|
40
42
|
"board": "GENERIC",
|
41
43
|
"cpu": "",
|
42
44
|
"mpy": "",
|
@@ -48,7 +50,11 @@ def _info(): # type:() -> dict[str, str]
|
|
48
50
|
except AttributeError:
|
49
51
|
pass
|
50
52
|
try:
|
51
|
-
machine =
|
53
|
+
machine = (
|
54
|
+
sys.implementation._machine
|
55
|
+
if "_machine" in dir(sys.implementation)
|
56
|
+
else os.uname().machine
|
57
|
+
)
|
52
58
|
info["board"] = machine.strip()
|
53
59
|
info["cpu"] = machine.split("with")[-1].strip() if "with" in machine else ""
|
54
60
|
info["mpy"] = (
|
@@ -100,7 +106,8 @@ def _info(): # type:() -> dict[str, str]
|
|
100
106
|
if (
|
101
107
|
info["version"]
|
102
108
|
and info["version"].endswith(".0")
|
103
|
-
and info["version"]
|
109
|
+
and info["version"]
|
110
|
+
>= "1.10.0" # versions from 1.10.0 to 1.20.0 do not have a micro .0
|
104
111
|
and info["version"] <= "1.19.9"
|
105
112
|
):
|
106
113
|
# drop the .0 for newer releases
|
@@ -110,19 +117,23 @@ def _info(): # type:() -> dict[str, str]
|
|
110
117
|
if "mpy" in info and info["mpy"]: # mpy on some v1.11+ builds
|
111
118
|
sys_mpy = int(info["mpy"])
|
112
119
|
# .mpy architecture
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
120
|
+
try:
|
121
|
+
arch = [
|
122
|
+
None,
|
123
|
+
"x86",
|
124
|
+
"x64",
|
125
|
+
"armv6",
|
126
|
+
"armv6m",
|
127
|
+
"armv7m",
|
128
|
+
"armv7em",
|
129
|
+
"armv7emsp",
|
130
|
+
"armv7emdp",
|
131
|
+
"xtensa",
|
132
|
+
"xtensawin",
|
133
|
+
"hazard3riscv", # assumed
|
134
|
+
][sys_mpy >> 10]
|
135
|
+
except IndexError:
|
136
|
+
arch = "unknown"
|
126
137
|
if arch:
|
127
138
|
info["arch"] = arch
|
128
139
|
# .mpy version.minor
|
@@ -15,7 +15,7 @@ mpflash/cli_list.py,sha256=ja21AZ4yghGTtOHkEtV1EOmT6EYxOiU2gzJc-mZaDto,2427
|
|
15
15
|
mpflash/cli_main.py,sha256=5EkvzsqOUDXvNaW814oSUcPWeNhnwh78Sg0MteDv_fk,1133
|
16
16
|
mpflash/common.py,sha256=f7yOivJCXiIs5aywbPMrMjz4T4036njEp8wXvdyHTnI,7398
|
17
17
|
mpflash/config.py,sha256=tdpvAvAlpco1GfeG2evn5tAKYluLEanqwrrvkir7QcQ,1073
|
18
|
-
mpflash/connected.py,sha256=
|
18
|
+
mpflash/connected.py,sha256=woYhuXoWpfzRMDUpBLVQZbVTGtMsKWNd5z1rsR1ELXA,3578
|
19
19
|
mpflash/download.py,sha256=wE4uBSFFMAKOBH4jwHweL0wVYh4vi74t1673ku_IeoA,14305
|
20
20
|
mpflash/downloaded.py,sha256=5qrf-V1fNTTGeueXaZUAnEqa-Yqru2jLyztx0wdyeuc,4938
|
21
21
|
mpflash/errors.py,sha256=IAidY3qkZsXy6Pm1rdmVFmGyg81ywHhse3itaPctA2w,247
|
@@ -37,17 +37,18 @@ mpflash/mpboard_id/add_boards.py,sha256=47TtN98FVc6PvuOr-3-g3LacYW8JvXpM5Gr_jhdU
|
|
37
37
|
mpflash/mpboard_id/board.py,sha256=CwtBux8y7GDUe7CADVxL8YefGRl9Fg8OAJBUhgaBYCI,1151
|
38
38
|
mpflash/mpboard_id/board_id.py,sha256=3Qeo9cQOfn6EQ0gr5MHsl0Nk7is_piYrz0mMbV2LC-Q,2957
|
39
39
|
mpflash/mpboard_id/board_info.zip,sha256=F6YowS96DAqjten4ySe4MXgZwPtE-saZOUfY5OQkqKk,19759
|
40
|
-
mpflash/mpboard_id/
|
40
|
+
mpflash/mpboard_id/boardinfo.csv,sha256=DL5Yde2cybmlWWrPOk3j_sTdPKykpvg-rppTZ8sjdYQ,364516
|
41
|
+
mpflash/mpboard_id/store.py,sha256=n85vnUAxGKv1C23wkm22ZFAFGK6AZZiCFvc1lGJJjis,1703
|
41
42
|
mpflash/mpremoteboard/__init__.py,sha256=3F6vZHM1znUOnAo0ne-FalApM6vwbTNYg4kJwkS1gNI,9521
|
42
|
-
mpflash/mpremoteboard/mpy_fw_info.py,sha256=
|
43
|
+
mpflash/mpremoteboard/mpy_fw_info.py,sha256=eRjhqN7MpmYE9TiS4iukquZZs3QE_lD5zv_vOPSjNrk,4821
|
43
44
|
mpflash/mpremoteboard/runner.py,sha256=-PgzAeBGbyXaAUlwyiw4mcINsP2U1XRRjP1_QdBrxpg,4786
|
44
45
|
mpflash/vendor/click_aliases.py,sha256=c853EHSlkE2DvFqeFvFpwXKuJj3_jsXDP7iotVOKaAw,3156
|
45
46
|
mpflash/vendor/dfu.py,sha256=ZXMcE6aH4-43Wh4tbQT4U-q-BU3RUiL3JAxmP_QAK2s,5755
|
46
47
|
mpflash/vendor/pydfu.py,sha256=_MdBRo1EeNeKDqFPSTB5tNL1jGSBJgsVeVjE5e7Pb8s,20542
|
47
48
|
mpflash/vendor/readme.md,sha256=iIIZxuLUIGHQ0KODzYVtMezsztvyxCXcNJp_AzwTIPk,86
|
48
49
|
mpflash/versions.py,sha256=EZtIe2RdBobhZaRIN7I-zZVNJ38CD_H8s3W8gXX9-IY,4627
|
49
|
-
mpflash-1.0.
|
50
|
-
mpflash-1.0.
|
51
|
-
mpflash-1.0.
|
52
|
-
mpflash-1.0.
|
53
|
-
mpflash-1.0.
|
50
|
+
mpflash-1.0.3.dist-info/entry_points.txt,sha256=Jk_visOhYOsZIcSP2Ms9hKqfKy1iorR-6dYltSoWCpY,52
|
51
|
+
mpflash-1.0.3.dist-info/LICENSE,sha256=mWpNhsIxWzetYNnTpr4eb3HtgsxGIC8KcYWxXEcxQvE,1077
|
52
|
+
mpflash-1.0.3.dist-info/METADATA,sha256=Zu2S1oMfZnlJBdqKx3o6qKXwFNX5X1UsIE7fmaZZ9Ac,17649
|
53
|
+
mpflash-1.0.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
54
|
+
mpflash-1.0.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|