mpflash 1.0.2__tar.gz → 1.0.4__tar.gz
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-1.0.2 → mpflash-1.0.4}/PKG-INFO +1 -1
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/common.py +2 -5
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/connected.py +2 -10
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/mpboard_id/store.py +8 -3
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/mpremoteboard/mpy_fw_info.py +27 -16
- {mpflash-1.0.2 → mpflash-1.0.4}/pyproject.toml +1 -1
- {mpflash-1.0.2 → mpflash-1.0.4}/LICENSE +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/README.md +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/__init__.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/add_firmware.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/ask_input.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/basicgit.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/bootloader/__init__.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/bootloader/activate.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/bootloader/detect.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/bootloader/manual.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/bootloader/micropython.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/bootloader/touch1200.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/cli_download.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/cli_flash.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/cli_group.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/cli_list.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/cli_main.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/config.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/download.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/downloaded.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/errors.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/flash/__init__.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/flash/esp.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/flash/stm32.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/flash/stm32_dfu.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/flash/uf2/__init__.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/flash/uf2/boardid.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/flash/uf2/linux.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/flash/uf2/macos.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/flash/uf2/uf2disk.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/flash/uf2/windows.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/flash/worklist.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/list.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/logger.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/mpboard_id/__init__.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/mpboard_id/add_boards.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/mpboard_id/board.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/mpboard_id/board_id.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/mpboard_id/board_info.zip +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/mpremoteboard/__init__.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/mpremoteboard/runner.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/vendor/click_aliases.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/vendor/dfu.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/vendor/pydfu.py +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/vendor/readme.md +0 -0
- {mpflash-1.0.2 → mpflash-1.0.4}/mpflash/versions.py +0 -0
@@ -30,11 +30,8 @@ PORT_FWTYPES = {
|
|
30
30
|
|
31
31
|
# Token with no permissions to avoid throttling
|
32
32
|
# https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28#getting-a-higher-rate-limit
|
33
|
-
PAT_NO_ACCESS =
|
34
|
-
|
35
|
-
+ "_11AAHPVFQ0qAkDnSUaMKSp"
|
36
|
-
+ "_ZkDl5NRRwBsUN6EYg9ahp1Dvj4FDDONnXVgimxC2EtpY7Q7BUKBoQ0Jq72X"
|
37
|
-
)
|
33
|
+
PAT_NO_ACCESS = "github_pat_"+"11AAHPVFQ0G4NTaQ73Bw5J"+"_fAp7K9sZ1qL8VFnI9g78eUlCdmOXHB3WzSdj2jtEYb4XF3N7PDJBl32qIxq"
|
34
|
+
|
38
35
|
PAT = os.environ.get("GITHUB_TOKEN") or PAT_NO_ACCESS
|
39
36
|
GH_CLIENT = Github(auth=Auth.Token(PAT))
|
40
37
|
|
@@ -7,15 +7,7 @@ from rich.table import Column
|
|
7
7
|
from mpflash.common import filtered_comports
|
8
8
|
from mpflash.mpremoteboard import MPRemoteBoard
|
9
9
|
|
10
|
-
import
|
11
|
-
|
12
|
-
if os.name == "linux":
|
13
|
-
from mpflash.common import find_serial_by_path # type: ignore
|
14
|
-
else:
|
15
|
-
|
16
|
-
def find_serial_by_path(path: str) -> str:
|
17
|
-
# log.warning(f"find_serial_by_path not implemented for {os.name}")
|
18
|
-
return path
|
10
|
+
from mpflash.common import find_serial_by_path
|
19
11
|
|
20
12
|
|
21
13
|
def connected_ports_boards(
|
@@ -71,7 +63,7 @@ def list_mcus(
|
|
71
63
|
connected_mcus = [
|
72
64
|
MPRemoteBoard(
|
73
65
|
c.device,
|
74
|
-
location=find_serial_by_path(c.device) or c.location or "?",
|
66
|
+
location=find_serial_by_path(c.device) or c.location or c.hwid or "?",
|
75
67
|
)
|
76
68
|
for c in comports
|
77
69
|
]
|
@@ -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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|