micropython-stubber 1.23.0__py3-none-any.whl → 1.23.1__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.23.0.dist-info → micropython_stubber-1.23.1.dist-info}/METADATA +4 -3
- {micropython_stubber-1.23.0.dist-info → micropython_stubber-1.23.1.dist-info}/RECORD +80 -80
- mpflash/README.md +14 -4
- mpflash/mpflash/add_firmware.py +1 -1
- mpflash/mpflash/ask_input.py +1 -1
- {stubber → mpflash/mpflash}/basicgit.py +3 -13
- mpflash/mpflash/bootloader/__init__.py +2 -37
- mpflash/mpflash/bootloader/activate.py +60 -0
- mpflash/mpflash/bootloader/detect.py +82 -0
- mpflash/mpflash/bootloader/manual.py +10 -11
- mpflash/mpflash/bootloader/micropython.py +2 -0
- mpflash/mpflash/bootloader/touch1200.py +13 -22
- mpflash/mpflash/cli_download.py +1 -1
- mpflash/mpflash/cli_flash.py +3 -3
- mpflash/mpflash/cli_group.py +18 -5
- mpflash/mpflash/cli_main.py +3 -5
- mpflash/mpflash/common.py +1 -0
- mpflash/mpflash/config.py +2 -1
- mpflash/mpflash/connected.py +9 -5
- mpflash/mpflash/download.py +9 -5
- mpflash/mpflash/downloaded.py +1 -1
- mpflash/mpflash/{flash.py → flash/__init__.py} +3 -3
- mpflash/mpflash/{flash_esp.py → flash/esp.py} +1 -1
- mpflash/mpflash/{flash_stm32.py → flash/stm32.py} +4 -3
- mpflash/mpflash/{flash_stm32_dfu.py → flash/stm32_dfu.py} +1 -1
- mpflash/mpflash/{flash_uf2.py → flash/uf2/__init__.py} +19 -20
- mpflash/mpflash/{flash_uf2_linux.py → flash/uf2/linux.py} +12 -11
- mpflash/mpflash/{flash_uf2_macos.py → flash/uf2/macos.py} +11 -6
- mpflash/mpflash/{flash_uf2_windows.py → flash/uf2/windows.py} +11 -6
- mpflash/mpflash/{worklist.py → flash/worklist.py} +8 -9
- mpflash/mpflash/list.py +13 -3
- mpflash/mpflash/mpboard_id/__init__.py +1 -1
- mpflash/mpflash/mpboard_id/add_boards.py +3 -7
- mpflash/mpflash/mpboard_id/board_id.py +1 -1
- mpflash/mpflash/mpremoteboard/__init__.py +7 -11
- {stubber/utils → mpflash/mpflash}/versions.py +31 -24
- mpflash/poetry.lock +16 -5
- mpflash/pyproject.toml +4 -3
- stubber/__init__.py +1 -1
- stubber/board/createstubs.py +4 -4
- stubber/board/createstubs_db.py +5 -5
- stubber/board/createstubs_db_min.py +1 -1
- stubber/board/createstubs_db_mpy.mpy +0 -0
- stubber/board/createstubs_mem.py +5 -5
- stubber/board/createstubs_mem_min.py +1 -1
- stubber/board/createstubs_mem_mpy.mpy +0 -0
- stubber/board/createstubs_min.py +1 -1
- stubber/board/createstubs_mpy.mpy +0 -0
- stubber/codemod/utils.py +2 -3
- stubber/commands/cli.py +1 -1
- stubber/commands/clone_cmd.py +2 -1
- stubber/commands/get_docstubs_cmd.py +1 -1
- stubber/commands/get_frozen_cmd.py +1 -1
- stubber/commands/get_mcu_cmd.py +1 -1
- stubber/commands/merge_cmd.py +1 -2
- stubber/commands/publish_cmd.py +1 -2
- stubber/commands/switch_cmd.py +2 -2
- stubber/commands/variants_cmd.py +1 -2
- stubber/freeze/get_frozen.py +1 -1
- stubber/minify.py +4 -3
- stubber/publish/candidates.py +4 -10
- stubber/publish/defaults.py +4 -9
- stubber/publish/missing_class_methods.py +1 -1
- stubber/publish/package.py +1 -1
- stubber/publish/pathnames.py +1 -1
- stubber/publish/publish.py +1 -1
- stubber/publish/stubpackage.py +3 -5
- stubber/rst/reader.py +5 -13
- stubber/tools/manifestfile.py +0 -1
- stubber/update_fallback.py +1 -1
- stubber/utils/__init__.py +2 -1
- stubber/utils/config.py +3 -5
- stubber/utils/manifest.py +2 -4
- stubber/utils/repos.py +5 -12
- mpflash/mpflash/flash_stm32_cube.py +0 -111
- mpflash/mpflash/vendor/versions.py +0 -119
- {micropython_stubber-1.23.0.dist-info → micropython_stubber-1.23.1.dist-info}/LICENSE +0 -0
- {micropython_stubber-1.23.0.dist-info → micropython_stubber-1.23.1.dist-info}/WHEEL +0 -0
- {micropython_stubber-1.23.0.dist-info → micropython_stubber-1.23.1.dist-info}/entry_points.txt +0 -0
- /mpflash/{mpflash/vendor/basicgit.py → basicgit.py} +0 -0
- /mpflash/mpflash/{flash_uf2_boardid.py → flash/uf2/boardid.py} +0 -0
- /mpflash/mpflash/{uf2disk.py → flash/uf2/uf2disk.py} +0 -0
@@ -9,7 +9,7 @@ from typing import Optional
|
|
9
9
|
from mpflash.errors import MPFlashError
|
10
10
|
from mpflash.logger import log
|
11
11
|
from mpflash.mpboard_id.store import read_known_boardinfo
|
12
|
-
from mpflash.
|
12
|
+
from mpflash.versions import clean_version, get_stable_mp_version
|
13
13
|
|
14
14
|
|
15
15
|
def find_board_id_by_description(
|
@@ -29,7 +29,7 @@ RETRIES = 3
|
|
29
29
|
class MPRemoteBoard:
|
30
30
|
"""Class to run mpremote commands"""
|
31
31
|
|
32
|
-
def __init__(self, serialport: str = "", update: bool = False):
|
32
|
+
def __init__(self, serialport: str = "", update: bool = False, *, location: str = ""):
|
33
33
|
"""
|
34
34
|
Initialize MPRemoteBoard object.
|
35
35
|
|
@@ -37,7 +37,7 @@ class MPRemoteBoard:
|
|
37
37
|
- serialport (str): The serial port to connect to. Default is an empty string.
|
38
38
|
- update (bool): Whether to update the MCU information. Default is False.
|
39
39
|
"""
|
40
|
-
self.serialport = serialport
|
40
|
+
self.serialport: str = serialport
|
41
41
|
self.firmware = {}
|
42
42
|
|
43
43
|
self.connected = False
|
@@ -51,6 +51,7 @@ class MPRemoteBoard:
|
|
51
51
|
self.arch = ""
|
52
52
|
self.mpy = ""
|
53
53
|
self.build = ""
|
54
|
+
self.location = location
|
54
55
|
if update:
|
55
56
|
self.get_mcu_info()
|
56
57
|
|
@@ -91,9 +92,7 @@ class MPRemoteBoard:
|
|
91
92
|
|
92
93
|
if sys.platform == "win32":
|
93
94
|
# Windows sort of comports by number - but fallback to device name
|
94
|
-
return sorted(
|
95
|
-
output, key=lambda x: int(x.split()[0][3:]) if x.split()[0][3:].isdigit() else x
|
96
|
-
)
|
95
|
+
return sorted(output, key=lambda x: int(x.split()[0][3:]) if x.split()[0][3:].isdigit() else x)
|
97
96
|
# sort by device name
|
98
97
|
return sorted(output)
|
99
98
|
|
@@ -129,9 +128,7 @@ class MPRemoteBoard:
|
|
129
128
|
self.description = descr = info["board"]
|
130
129
|
pos = descr.rfind(" with")
|
131
130
|
short_descr = descr[:pos].strip() if pos != -1 else ""
|
132
|
-
if board_name := find_board_id_by_description(
|
133
|
-
descr, short_descr, version=self.version
|
134
|
-
):
|
131
|
+
if board_name := find_board_id_by_description(descr, short_descr, version=self.version):
|
135
132
|
self.board = board_name
|
136
133
|
else:
|
137
134
|
self.board = "UNKNOWN_BOARD"
|
@@ -211,11 +208,10 @@ class MPRemoteBoard:
|
|
211
208
|
"""wait for the board to restart"""
|
212
209
|
for _ in track(
|
213
210
|
range(timeout),
|
214
|
-
description="Waiting for the board to restart",
|
211
|
+
description=f"Waiting for the board to restart ({timeout}s)",
|
215
212
|
transient=True,
|
216
|
-
get_time=lambda: time.time(),
|
217
213
|
show_speed=False,
|
218
|
-
refresh_per_second=
|
214
|
+
refresh_per_second=1,
|
219
215
|
total=timeout,
|
220
216
|
):
|
221
217
|
time.sleep(1)
|
@@ -1,14 +1,17 @@
|
|
1
|
-
"""
|
1
|
+
"""
|
2
|
+
#############################################################
|
3
|
+
# Version handling copied from stubber/utils/versions.py
|
4
|
+
#############################################################
|
5
|
+
"""
|
2
6
|
|
3
|
-
from functools import lru_cache
|
4
7
|
from pathlib import Path
|
5
8
|
|
6
|
-
from
|
9
|
+
from cache_to_disk import NoCacheCondition, cache_to_disk
|
7
10
|
from loguru import logger as log
|
8
11
|
from packaging.version import parse
|
9
12
|
|
10
|
-
import
|
11
|
-
|
13
|
+
import mpflash.basicgit as git
|
14
|
+
from mpflash.common import GH_CLIENT
|
12
15
|
|
13
16
|
OLDEST_VERSION = "1.16"
|
14
17
|
"This is the oldest MicroPython version to build the stubs on"
|
@@ -27,7 +30,7 @@ def clean_version(
|
|
27
30
|
commit: bool = False,
|
28
31
|
drop_v: bool = False,
|
29
32
|
flat: bool = False,
|
30
|
-
):
|
33
|
+
): # sourcery skip: assign-if-exp
|
31
34
|
"Clean up and transform the many flavours of versions"
|
32
35
|
# 'v1.13.0-103-gb137d064e' --> 'v1.13-103'
|
33
36
|
if version in {"", "-"}:
|
@@ -48,14 +51,12 @@ def clean_version(
|
|
48
51
|
if len(nibbles) == 1:
|
49
52
|
version = nibbles[0]
|
50
53
|
elif build and not is_preview:
|
54
|
+
# HACK: this is not always right, but good enough most of the time
|
51
55
|
version = "-".join(nibbles) if commit else "-".join(nibbles[:-1])
|
56
|
+
elif is_preview:
|
57
|
+
version = "-".join((nibbles[0], V_PREVIEW))
|
52
58
|
else:
|
53
|
-
|
54
|
-
# HACK: this is not always right, but good enough most of the time
|
55
|
-
if is_preview:
|
56
|
-
version = "-".join((nibbles[0], V_PREVIEW))
|
57
|
-
else:
|
58
|
-
version = V_PREVIEW
|
59
|
+
version = V_PREVIEW
|
59
60
|
if flat:
|
60
61
|
version = version.strip().replace(".", "_").replace("-", "_")
|
61
62
|
else:
|
@@ -70,20 +71,12 @@ def clean_version(
|
|
70
71
|
return version
|
71
72
|
|
72
73
|
|
73
|
-
@
|
74
|
-
def checkedout_version(path: Path, flat: bool = False) -> str:
|
75
|
-
"""Get the checked-out version of the repo"""
|
76
|
-
version = git.get_local_tag(path.as_posix())
|
77
|
-
if not version:
|
78
|
-
raise ValueError("No valid Tag found")
|
79
|
-
version = utils.clean_version(version, flat=flat, drop_v=False)
|
80
|
-
return version
|
81
|
-
|
82
|
-
|
74
|
+
@cache_to_disk(n_days_to_cache=1)
|
83
75
|
def micropython_versions(minver: str = "v1.20", reverse: bool = False):
|
84
76
|
"""Get the list of micropython versions from github tags"""
|
77
|
+
cache_it = True
|
85
78
|
try:
|
86
|
-
gh_client =
|
79
|
+
gh_client = GH_CLIENT
|
87
80
|
repo = gh_client.get_repo("micropython/micropython")
|
88
81
|
versions = [tag.name for tag in repo.get_tags() if parse(tag.name) >= parse(minver)]
|
89
82
|
# Only keep the last preview
|
@@ -109,10 +102,15 @@ def micropython_versions(minver: str = "v1.20", reverse: bool = False):
|
|
109
102
|
"v1.11",
|
110
103
|
"v1.10",
|
111
104
|
]
|
105
|
+
cache_it = False
|
112
106
|
versions = [v for v in versions if parse(v) >= parse(minver)]
|
113
107
|
# remove all but the most recent (preview) version
|
114
108
|
versions = versions[:1] + [v for v in versions if "preview" not in v]
|
115
|
-
|
109
|
+
versions = sorted(versions, reverse=reverse)
|
110
|
+
if cache_it:
|
111
|
+
return versions
|
112
|
+
# returns - but does not cache
|
113
|
+
raise NoCacheCondition(function_value=versions)
|
116
114
|
|
117
115
|
|
118
116
|
def get_stable_mp_version() -> str:
|
@@ -126,3 +124,12 @@ def get_preview_mp_version() -> str:
|
|
126
124
|
all_versions = micropython_versions(minver=OLDEST_VERSION)
|
127
125
|
return [v for v in all_versions if v.endswith(V_PREVIEW)][-1]
|
128
126
|
|
127
|
+
|
128
|
+
# Do not cache , same path will have different versions checked out
|
129
|
+
def checkedout_version(path: Path, flat: bool = False) -> str:
|
130
|
+
"""Get the checked-out version of the repo"""
|
131
|
+
version = git.get_local_tag(path.as_posix())
|
132
|
+
if not version:
|
133
|
+
raise ValueError("No valid Tag found")
|
134
|
+
version = clean_version(version, flat=flat, drop_v=False)
|
135
|
+
return version
|
mpflash/poetry.lock
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# This file is automatically @generated by Poetry 1.8.
|
1
|
+
# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand.
|
2
2
|
|
3
3
|
[[package]]
|
4
4
|
name = "ansicon"
|
@@ -249,6 +249,17 @@ files = [
|
|
249
249
|
{file = "blkinfo-0.2.0.tar.gz", hash = "sha256:322a906595f78832d6725ac74a0b9fd2794df3388584d9f05c1a2f8e19324851"},
|
250
250
|
]
|
251
251
|
|
252
|
+
[[package]]
|
253
|
+
name = "cache-to-disk"
|
254
|
+
version = "2.0.0"
|
255
|
+
description = "Local disk caching decorator for python function."
|
256
|
+
optional = false
|
257
|
+
python-versions = "*"
|
258
|
+
files = [
|
259
|
+
{file = "cache_to_disk-2.0.0-py3-none-any.whl", hash = "sha256:ea5afe13d4284cb4a06169b0807fbc60547cbe19c54563bf90e1d44f24029481"},
|
260
|
+
{file = "cache_to_disk-2.0.0.tar.gz", hash = "sha256:79e19ea9b72eedc5cec83bb8aa55374afc671493e7d13d541f3b63eb3a13fb32"},
|
261
|
+
]
|
262
|
+
|
252
263
|
[[package]]
|
253
264
|
name = "cachetools"
|
254
265
|
version = "5.3.3"
|
@@ -1452,13 +1463,13 @@ test = ["codecov", "coverage", "mypy", "nptyping (>=1.3.0)", "numpy", "pycodesty
|
|
1452
1463
|
|
1453
1464
|
[[package]]
|
1454
1465
|
name = "urllib3"
|
1455
|
-
version = "2.2.
|
1466
|
+
version = "2.2.2"
|
1456
1467
|
description = "HTTP library with thread-safe connection pooling, file post, and more."
|
1457
1468
|
optional = false
|
1458
1469
|
python-versions = ">=3.8"
|
1459
1470
|
files = [
|
1460
|
-
{file = "urllib3-2.2.
|
1461
|
-
{file = "urllib3-2.2.
|
1471
|
+
{file = "urllib3-2.2.2-py3-none-any.whl", hash = "sha256:a448b2f64d686155468037e1ace9f2d2199776e17f0a46610480d311f73e3472"},
|
1472
|
+
{file = "urllib3-2.2.2.tar.gz", hash = "sha256:dd505485549a7a552833da5e6063639d0d177c04f23bc3864e41e5dc5f612168"},
|
1462
1473
|
]
|
1463
1474
|
|
1464
1475
|
[package.extras]
|
@@ -1585,4 +1596,4 @@ files = [
|
|
1585
1596
|
[metadata]
|
1586
1597
|
lock-version = "2.0"
|
1587
1598
|
python-versions = ">=3.8.1,<4.0"
|
1588
|
-
content-hash = "
|
1599
|
+
content-hash = "e0f5697e08c8c691e538c586c7a478cdc93de23d56435373b56abdd2147bda87"
|
mpflash/pyproject.toml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "mpflash"
|
3
|
-
version = "0.9.
|
3
|
+
version = "0.9.1.Post2"
|
4
4
|
description = "Flash and download tool for MicroPython firmwares"
|
5
5
|
authors = ["Jos Verlinde <jos_verlinde@hotmail.com>"]
|
6
6
|
license = "MIT"
|
@@ -26,18 +26,19 @@ esptool = "^4.7.0"
|
|
26
26
|
inquirer = "^3.2.4"
|
27
27
|
jsonlines = "^4.0.0"
|
28
28
|
jsons = "^1.6.3"
|
29
|
-
libusb = {version = "^1.0.27", platform = "win32"}
|
29
|
+
libusb = { version = "^1.0.27", platform = "win32" }
|
30
30
|
loguru = "^0.7.2"
|
31
31
|
mpremote = "^1.22.0"
|
32
32
|
packaging = "23.2"
|
33
33
|
platformdirs = "^4.2.0"
|
34
34
|
psutil = "^5.9.8"
|
35
35
|
pygithub = "^2.1.1"
|
36
|
-
python =
|
36
|
+
python = ">=3.8.1,<4.0"
|
37
37
|
pyusb = "^1.2.1"
|
38
38
|
requests = "^2.31.0"
|
39
39
|
rich-click = "^1.8.1"
|
40
40
|
tenacity = "8.2.3"
|
41
|
+
cache-to-disk = "^2.0.0"
|
41
42
|
|
42
43
|
|
43
44
|
[tool.poetry.group.dev]
|
stubber/__init__.py
CHANGED
stubber/board/createstubs.py
CHANGED
@@ -24,7 +24,7 @@ try:
|
|
24
24
|
except ImportError:
|
25
25
|
from ucollections import OrderedDict # type: ignore
|
26
26
|
|
27
|
-
__version__ = "v1.23.
|
27
|
+
__version__ = "v1.23.1"
|
28
28
|
ENOENT = 2
|
29
29
|
_MAX_CLASS_LEVEL = 2 # Max class nesting
|
30
30
|
LIBS = ["lib", "/lib", "/sd/lib", "/flash/lib", "."]
|
@@ -488,7 +488,7 @@ def ensure_folder(path: str):
|
|
488
488
|
|
489
489
|
def _build(s):
|
490
490
|
# extract build from sys.version or os.uname().version if available
|
491
|
-
# sys.version: 'MicroPython v1.23.
|
491
|
+
# sys.version: 'MicroPython v1.23.1-preview.6.g3d0b6276f'
|
492
492
|
# sys.implementation.version: 'v1.13-103-gb137d064e'
|
493
493
|
if not s:
|
494
494
|
return ""
|
@@ -595,10 +595,10 @@ def _info(): # type:() -> dict[str, str]
|
|
595
595
|
if (
|
596
596
|
info["version"]
|
597
597
|
and info["version"].endswith(".0")
|
598
|
-
and info["version"] >= "1.10.0" # versions from 1.10.0 to 1.23.
|
598
|
+
and info["version"] >= "1.10.0" # versions from 1.10.0 to 1.23.1 do not have a micro .0
|
599
599
|
and info["version"] <= "1.19.9"
|
600
600
|
):
|
601
|
-
# versions from 1.10.0 to 1.23.
|
601
|
+
# versions from 1.10.0 to 1.23.1 do not have a micro .0
|
602
602
|
info["version"] = info["version"][:-2]
|
603
603
|
|
604
604
|
# spell-checker: disable
|
stubber/board/createstubs_db.py
CHANGED
@@ -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.23.
|
21
|
+
This variant was generated from createstubs.py by micropython-stubber v1.23.1
|
22
22
|
"""
|
23
23
|
|
24
24
|
# Copyright (c) 2019-2024 Jos Verlinde
|
@@ -43,7 +43,7 @@ try:
|
|
43
43
|
except ImportError:
|
44
44
|
from ucollections import OrderedDict # type: ignore
|
45
45
|
|
46
|
-
__version__ = "v1.23.
|
46
|
+
__version__ = "v1.23.1"
|
47
47
|
ENOENT = 2
|
48
48
|
_MAX_CLASS_LEVEL = 2 # Max class nesting
|
49
49
|
LIBS = ["lib", "/lib", "/sd/lib", "/flash/lib", "."]
|
@@ -501,7 +501,7 @@ def ensure_folder(path: str):
|
|
501
501
|
|
502
502
|
def _build(s):
|
503
503
|
# extract build from sys.version or os.uname().version if available
|
504
|
-
# sys.version: 'MicroPython v1.23.
|
504
|
+
# sys.version: 'MicroPython v1.23.1-preview.6.g3d0b6276f'
|
505
505
|
# sys.implementation.version: 'v1.13-103-gb137d064e'
|
506
506
|
if not s:
|
507
507
|
return ""
|
@@ -606,10 +606,10 @@ def _info(): # type:() -> dict[str, str]
|
|
606
606
|
if (
|
607
607
|
info["version"]
|
608
608
|
and info["version"].endswith(".0")
|
609
|
-
and info["version"] >= "1.10.0" # versions from 1.10.0 to 1.23.
|
609
|
+
and info["version"] >= "1.10.0" # versions from 1.10.0 to 1.23.1 do not have a micro .0
|
610
610
|
and info["version"] <= "1.19.9"
|
611
611
|
):
|
612
|
-
# versions from 1.10.0 to 1.23.
|
612
|
+
# versions from 1.10.0 to 1.23.1 do not have a micro .0
|
613
613
|
info["version"] = info["version"][:-2]
|
614
614
|
|
615
615
|
# spell-checker: disable
|
@@ -51,7 +51,7 @@ try:from machine import reset
|
|
51
51
|
except O:pass
|
52
52
|
try:from collections import OrderedDict as l
|
53
53
|
except O:from ucollections import OrderedDict as l
|
54
|
-
__version__='v1.23.
|
54
|
+
__version__='v1.23.1'
|
55
55
|
A3=2
|
56
56
|
A4=2
|
57
57
|
A5=['lib','/lib','/sd/lib','/flash/lib',J]
|
Binary file
|
stubber/board/createstubs_mem.py
CHANGED
@@ -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.23.
|
12
|
+
This variant was generated from createstubs.py by micropython-stubber v1.23.1
|
13
13
|
"""
|
14
14
|
|
15
15
|
# Copyright (c) 2019-2024 Jos Verlinde
|
@@ -34,7 +34,7 @@ try:
|
|
34
34
|
except ImportError:
|
35
35
|
from ucollections import OrderedDict # type: ignore
|
36
36
|
|
37
|
-
__version__ = "v1.23.
|
37
|
+
__version__ = "v1.23.1"
|
38
38
|
ENOENT = 2
|
39
39
|
_MAX_CLASS_LEVEL = 2 # Max class nesting
|
40
40
|
LIBS = ["lib", "/lib", "/sd/lib", "/flash/lib", "."]
|
@@ -492,7 +492,7 @@ def ensure_folder(path: str):
|
|
492
492
|
|
493
493
|
def _build(s):
|
494
494
|
# extract build from sys.version or os.uname().version if available
|
495
|
-
# sys.version: 'MicroPython v1.23.
|
495
|
+
# sys.version: 'MicroPython v1.23.1-preview.6.g3d0b6276f'
|
496
496
|
# sys.implementation.version: 'v1.13-103-gb137d064e'
|
497
497
|
if not s:
|
498
498
|
return ""
|
@@ -597,10 +597,10 @@ def _info(): # type:() -> dict[str, str]
|
|
597
597
|
if (
|
598
598
|
info["version"]
|
599
599
|
and info["version"].endswith(".0")
|
600
|
-
and info["version"] >= "1.10.0" # versions from 1.10.0 to 1.23.
|
600
|
+
and info["version"] >= "1.10.0" # versions from 1.10.0 to 1.23.1 do not have a micro .0
|
601
601
|
and info["version"] <= "1.19.9"
|
602
602
|
):
|
603
|
-
# versions from 1.10.0 to 1.23.
|
603
|
+
# versions from 1.10.0 to 1.23.1 do not have a micro .0
|
604
604
|
info["version"] = info["version"][:-2]
|
605
605
|
|
606
606
|
# spell-checker: disable
|
Binary file
|
stubber/board/createstubs_min.py
CHANGED
@@ -50,7 +50,7 @@ try:from machine import reset
|
|
50
50
|
except N:pass
|
51
51
|
try:from collections import OrderedDict as h
|
52
52
|
except N:from ucollections import OrderedDict as h
|
53
|
-
__version__='v1.23.
|
53
|
+
__version__='v1.23.1'
|
54
54
|
A0=2
|
55
55
|
A1=2
|
56
56
|
A5=['lib','/lib','/sd/lib','/flash/lib',J]
|
Binary file
|
stubber/codemod/utils.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
from libcst import matchers as m
|
3
|
-
from libcst.matchers._visitors import _gather_constructed_leave_funcs, _gather_constructed_visit_funcs
|
3
|
+
from libcst.matchers._visitors import _gather_constructed_leave_funcs, _gather_constructed_visit_funcs # type: ignore
|
4
4
|
from typing import Any, Optional
|
5
5
|
from types import FunctionType
|
6
6
|
import itertools
|
@@ -13,14 +13,13 @@ def shallow_copy_function(func: Any) -> FunctionType:
|
|
13
13
|
attributes defined on the function.
|
14
14
|
|
15
15
|
"""
|
16
|
-
|
16
|
+
return FunctionType(
|
17
17
|
func.__code__,
|
18
18
|
func.__globals__,
|
19
19
|
name=func.__name__,
|
20
20
|
argdefs=getattr(func, "__defaults__", None),
|
21
21
|
closure=getattr(func, "__closure__", None),
|
22
22
|
)
|
23
|
-
return ret
|
24
23
|
|
25
24
|
|
26
25
|
class ScopeableMatcherTransformer(m.MatcherDecoratableTransformer):
|
stubber/commands/cli.py
CHANGED
stubber/commands/clone_cmd.py
CHANGED
@@ -8,7 +8,7 @@ from pathlib import Path
|
|
8
8
|
from typing import List, Tuple, Union
|
9
9
|
|
10
10
|
import rich_click as click
|
11
|
-
import
|
11
|
+
import mpflash.basicgit as git
|
12
12
|
from loguru import logger as log
|
13
13
|
from stubber.utils.config import CONFIG
|
14
14
|
|
@@ -27,6 +27,7 @@ from .cli import stubber_cli
|
|
27
27
|
type=click.Path(file_okay=False, dir_okay=True),
|
28
28
|
)
|
29
29
|
@click.option(
|
30
|
+
"--stubs/--no-stubs",
|
30
31
|
"--add-stubs/--no-stubs",
|
31
32
|
"stubs",
|
32
33
|
default=False,
|
@@ -9,7 +9,7 @@ from typing import Optional
|
|
9
9
|
import rich_click as click
|
10
10
|
from loguru import logger as log
|
11
11
|
|
12
|
-
import
|
12
|
+
import mpflash.basicgit as git
|
13
13
|
import stubber.utils as utils
|
14
14
|
from stubber.stubs_from_docs import generate_from_rst
|
15
15
|
from stubber.utils.config import CONFIG
|
stubber/commands/get_mcu_cmd.py
CHANGED
stubber/commands/merge_cmd.py
CHANGED
stubber/commands/publish_cmd.py
CHANGED
stubber/commands/switch_cmd.py
CHANGED
@@ -7,10 +7,10 @@ from typing import Optional, Union
|
|
7
7
|
|
8
8
|
import rich_click as click
|
9
9
|
|
10
|
-
import
|
10
|
+
import mpflash.basicgit as git
|
11
11
|
from stubber.utils.config import CONFIG
|
12
12
|
from stubber.utils.repos import fetch_repos, repo_paths
|
13
|
-
from
|
13
|
+
from mpflash.versions import SET_PREVIEW, V_PREVIEW
|
14
14
|
|
15
15
|
from .cli import stubber_cli
|
16
16
|
|
stubber/commands/variants_cmd.py
CHANGED
stubber/freeze/get_frozen.py
CHANGED
@@ -25,11 +25,11 @@ from typing import List, Optional
|
|
25
25
|
from loguru import logger as log
|
26
26
|
from packaging.version import Version
|
27
27
|
|
28
|
+
from mpflash.versions import SET_PREVIEW, V_PREVIEW
|
28
29
|
from stubber import utils
|
29
30
|
from stubber.freeze.freeze_folder import freeze_folders # Micropython < v1.12
|
30
31
|
from stubber.freeze.freeze_manifest_2 import freeze_one_manifest_2
|
31
32
|
from stubber.utils.config import CONFIG
|
32
|
-
from stubber.utils.versions import SET_PREVIEW, V_PREVIEW
|
33
33
|
|
34
34
|
FAMILY = "micropython"
|
35
35
|
|
stubber/minify.py
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
Processing for createstubs.py
|
3
3
|
Minimizes and cross-compiles a MicroPyton file.
|
4
4
|
"""
|
5
|
+
|
5
6
|
import itertools
|
6
7
|
import subprocess
|
7
8
|
import tempfile
|
@@ -10,14 +11,14 @@ from io import BytesIO, IOBase, StringIO, TextIOWrapper
|
|
10
11
|
from pathlib import Path
|
11
12
|
from typing import List, Tuple, Union
|
12
13
|
|
13
|
-
try:
|
14
|
+
try:
|
14
15
|
import python_minifier
|
15
16
|
except ImportError:
|
16
17
|
python_minifier = None
|
17
18
|
|
18
19
|
from loguru import logger as log
|
19
20
|
|
20
|
-
from
|
21
|
+
from mpflash.versions import SET_PREVIEW, V_PREVIEW
|
21
22
|
|
22
23
|
# Type Aliases for minify
|
23
24
|
StubSource = Union[Path, str, StringIO, TextIOWrapper]
|
@@ -243,7 +244,7 @@ def minify_script(source_script: StubSource, keep_report: bool = True, diff: boo
|
|
243
244
|
],
|
244
245
|
# remove_pass=True, # no dead code
|
245
246
|
# convert_posargs_to_args=True, # Does not save any space
|
246
|
-
|
247
|
+
)
|
247
248
|
len_3 = len(min_source)
|
248
249
|
if 1:
|
249
250
|
# write to temp file for debugging
|
stubber/publish/candidates.py
CHANGED
@@ -17,13 +17,13 @@ from typing import Any, Dict, Generator, List, Optional, Union
|
|
17
17
|
from loguru import logger as log
|
18
18
|
from packaging.version import parse
|
19
19
|
|
20
|
-
import
|
20
|
+
import mpflash.basicgit as git
|
21
|
+
from mpflash.versions import OLDEST_VERSION, SET_PREVIEW, V_PREVIEW, clean_version, micropython_versions
|
21
22
|
from stubber import utils
|
22
23
|
from stubber.publish.defaults import GENERIC, GENERIC_L, GENERIC_U
|
23
24
|
|
24
25
|
# from stubber.publish.enums import COMBO_STUBS
|
25
26
|
from stubber.utils.config import CONFIG
|
26
|
-
from stubber.utils.versions import OLDEST_VERSION, SET_PREVIEW, V_PREVIEW, clean_version, micropython_versions
|
27
27
|
|
28
28
|
|
29
29
|
def subfolder_names(path: Path):
|
@@ -215,9 +215,7 @@ def board_candidates(
|
|
215
215
|
else:
|
216
216
|
r = git.checkout_tag(repo=mpy_path, tag=version)
|
217
217
|
if not r:
|
218
|
-
log.warning(
|
219
|
-
f"Incorrect version: {version} or did you forget to run `stubber clone` to get the micropython repo?"
|
220
|
-
)
|
218
|
+
log.warning(f"Incorrect version: {version} or did you forget to run `stubber clone` to get the micropython repo?")
|
221
219
|
return []
|
222
220
|
ports = list_micropython_ports(family=family, mpy_path=mpy_path)
|
223
221
|
for port in ports:
|
@@ -254,9 +252,5 @@ def filter_list(
|
|
254
252
|
worklist = [i for i in worklist if i["port"].lower() in ports_]
|
255
253
|
if boards and not is_auto(boards):
|
256
254
|
boards_ = [i.lower() for i in boards]
|
257
|
-
worklist = [
|
258
|
-
i
|
259
|
-
for i in worklist
|
260
|
-
if i["board"].lower() in boards_ or i["board"].lower().replace("generic_", "") in boards_
|
261
|
-
]
|
255
|
+
worklist = [i for i in worklist if i["board"].lower() in boards_ or i["board"].lower().replace("generic_", "") in boards_]
|
262
256
|
return worklist
|
stubber/publish/defaults.py
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
"""Build and packaging defaults for stubber"""
|
2
|
+
|
2
3
|
from typing import Dict, List
|
3
4
|
|
5
|
+
from mpflash.versions import V_PREVIEW, clean_version
|
4
6
|
from stubber.utils.config import CONFIG
|
5
|
-
from stubber.utils.versions import V_PREVIEW, clean_version
|
6
7
|
|
7
8
|
# The default board for the ports modules documented with base name only
|
8
9
|
# as the MicroPython BOARD naming convention has changed over time there are different options to try
|
@@ -29,15 +30,9 @@ def default_board(port: str, version=V_PREVIEW) -> str: # sourcery skip: assign
|
|
29
30
|
ver_flat = clean_version(version, flat=True)
|
30
31
|
if port in DEFAULT_BOARDS:
|
31
32
|
for board in DEFAULT_BOARDS[port]:
|
32
|
-
base =
|
33
|
-
f"micropython-{ver_flat}-{port}-{board}"
|
34
|
-
if board
|
35
|
-
else f"micropython-{ver_flat}-{port}"
|
36
|
-
)
|
33
|
+
base = f"micropython-{ver_flat}-{port}-{board}" if board else f"micropython-{ver_flat}-{port}"
|
37
34
|
# check if we have a (merged)stub for this version and port
|
38
|
-
if (CONFIG.stub_path / f"{base}-merged").exists() or (
|
39
|
-
CONFIG.stub_path / base
|
40
|
-
).exists():
|
35
|
+
if (CONFIG.stub_path / f"{base}-merged").exists() or (CONFIG.stub_path / base).exists():
|
41
36
|
return board
|
42
37
|
# fallback to first listed board
|
43
38
|
return DEFAULT_BOARDS[port][0]
|