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
@@ -8,10 +8,10 @@ from pathlib import Path
|
|
8
8
|
import libcst as cst
|
9
9
|
from loguru import logger as log
|
10
10
|
|
11
|
+
from mpflash.versions import clean_version
|
11
12
|
from stubber.codemod.add_method import CallAdder, CallFinder
|
12
13
|
from stubber.utils.config import CONFIG
|
13
14
|
from stubber.utils.post import run_black
|
14
|
-
from stubber.utils.versions import clean_version
|
15
15
|
|
16
16
|
|
17
17
|
def add_machine_pin_call(merged_path: Path, version: str):
|
stubber/publish/package.py
CHANGED
@@ -11,11 +11,11 @@ from loguru import logger as log
|
|
11
11
|
from packaging.version import parse
|
12
12
|
from pysondb import PysonDB
|
13
13
|
|
14
|
+
from mpflash.versions import clean_version
|
14
15
|
from stubber.publish.defaults import GENERIC, GENERIC_L, default_board
|
15
16
|
from stubber.publish.enums import StubSource
|
16
17
|
from stubber.publish.stubpackage import StubPackage, StubSources
|
17
18
|
from stubber.utils.config import CONFIG
|
18
|
-
from stubber.utils.versions import clean_version
|
19
19
|
|
20
20
|
# replace std log handler with a custom one capped on INFO level
|
21
21
|
log.remove()
|
stubber/publish/pathnames.py
CHANGED
@@ -8,10 +8,10 @@ from typing import Dict, Optional
|
|
8
8
|
|
9
9
|
from loguru import logger as log
|
10
10
|
|
11
|
+
from mpflash.versions import V_PREVIEW, clean_version
|
11
12
|
from stubber.publish.defaults import default_board
|
12
13
|
from stubber.publish.package import GENERIC
|
13
14
|
from stubber.utils.config import CONFIG
|
14
|
-
from stubber.utils.versions import V_PREVIEW, clean_version
|
15
15
|
|
16
16
|
|
17
17
|
## Helper functions
|
stubber/publish/publish.py
CHANGED
@@ -8,12 +8,12 @@ from typing import Any, Dict, List, Optional, Union
|
|
8
8
|
|
9
9
|
from loguru import logger as log
|
10
10
|
|
11
|
+
from mpflash.versions import V_PREVIEW
|
11
12
|
from stubber.publish.candidates import board_candidates, filter_list
|
12
13
|
from stubber.publish.database import get_database
|
13
14
|
from stubber.publish.defaults import GENERIC_U
|
14
15
|
from stubber.publish.package import get_package
|
15
16
|
from stubber.utils.config import CONFIG
|
16
|
-
from stubber.utils.versions import V_PREVIEW
|
17
17
|
|
18
18
|
|
19
19
|
def build_multiple(
|
stubber/publish/stubpackage.py
CHANGED
@@ -9,7 +9,7 @@ from typing import Any, Dict, List, Optional, Tuple, Union
|
|
9
9
|
|
10
10
|
import tenacity
|
11
11
|
|
12
|
-
from
|
12
|
+
from mpflash.basicgit import get_git_describe
|
13
13
|
from stubber.publish.helpers import get_module_docstring
|
14
14
|
|
15
15
|
try:
|
@@ -24,12 +24,12 @@ from loguru import logger as log
|
|
24
24
|
from packaging.version import Version, parse
|
25
25
|
from pysondb import PysonDB
|
26
26
|
|
27
|
+
from mpflash.versions import SET_PREVIEW, V_PREVIEW, clean_version
|
27
28
|
from stubber.publish.bump import bump_version
|
28
29
|
from stubber.publish.defaults import GENERIC_U, default_board
|
29
30
|
from stubber.publish.enums import StubSource
|
30
31
|
from stubber.publish.pypi import Version, get_pypi_versions
|
31
32
|
from stubber.utils.config import CONFIG
|
32
|
-
from stubber.utils.versions import SET_PREVIEW, V_PREVIEW, clean_version
|
33
33
|
|
34
34
|
Status = NewType("Status", Dict[str, Union[str, None]])
|
35
35
|
StubSources = List[Tuple[StubSource, Path]]
|
@@ -906,9 +906,7 @@ class StubPackage(PoetryBuilder):
|
|
906
906
|
self.pkg_version = self.next_package_version(production)
|
907
907
|
self.status["version"] = self.pkg_version
|
908
908
|
# to get the next version
|
909
|
-
log.debug(
|
910
|
-
f"{self.package_name}: bump version for {old_ver} to {self.pkg_version } {'production' if production else 'test'}"
|
911
|
-
)
|
909
|
+
log.debug(f"{self.package_name}: bump version for {old_ver} to {self.pkg_version } {'production' if production else 'test'}")
|
912
910
|
self.write_package_json()
|
913
911
|
log.trace(f"New hash: {self.package_name} {self.pkg_version} {self.hash}")
|
914
912
|
if self.poetry_build():
|
stubber/rst/reader.py
CHANGED
@@ -69,6 +69,7 @@ from typing import List, Optional, Tuple
|
|
69
69
|
|
70
70
|
from loguru import logger as log
|
71
71
|
|
72
|
+
from mpflash.versions import V_PREVIEW
|
72
73
|
from stubber.rst import (
|
73
74
|
CHILD_PARENT_CLASS,
|
74
75
|
MODULE_GLUE,
|
@@ -82,7 +83,6 @@ from stubber.rst import (
|
|
82
83
|
)
|
83
84
|
from stubber.rst.lookup import Fix
|
84
85
|
from stubber.utils.config import CONFIG
|
85
|
-
from stubber.utils.versions import V_PREVIEW
|
86
86
|
|
87
87
|
SEPERATOR = "::"
|
88
88
|
|
@@ -369,9 +369,7 @@ class RSTParser(RSTReader):
|
|
369
369
|
PARAM_RE_FIXES = [
|
370
370
|
Fix(r"\[angle, time=0\]", "[angle], time=0", is_re=True), # fix: method:: Servo.angle([angle, time=0])
|
371
371
|
Fix(r"\[speed, time=0\]", "[speed], time=0", is_re=True), # fix: .. method:: Servo.speed([speed, time=0])
|
372
|
-
Fix(
|
373
|
-
r"\[service_id, key=None, \*, \.\.\.\]", "[service_id], [key], *, ...", is_re=True
|
374
|
-
), # fix: network - AbstractNIC.connect
|
372
|
+
Fix(r"\[service_id, key=None, \*, \.\.\.\]", "[service_id], [key], *, ...", is_re=True), # fix: network - AbstractNIC.connect
|
375
373
|
]
|
376
374
|
|
377
375
|
def __init__(self, v_tag: str) -> None:
|
@@ -497,9 +495,7 @@ class RSTParser(RSTReader):
|
|
497
495
|
version = V_PREVIEW
|
498
496
|
else:
|
499
497
|
version = self.source_tag.replace("_", ".") # TODO Use clean_version(self.source_tag)
|
500
|
-
docstr[0] =
|
501
|
-
f"{docstr[0]}.\n\nMicroPython module: https://docs.micropython.org/en/{version}/library/{module_name}.html"
|
502
|
-
)
|
498
|
+
docstr[0] = f"{docstr[0]}.\n\nMicroPython module: https://docs.micropython.org/en/{version}/library/{module_name}.html"
|
503
499
|
|
504
500
|
self.output_dict.name = module_name
|
505
501
|
self.output_dict.add_comment(f"# source version: {self.source_tag}")
|
@@ -637,9 +633,7 @@ class RSTParser(RSTReader):
|
|
637
633
|
params = self.fix_parameters(params, f"{class_name}.{name}")
|
638
634
|
|
639
635
|
# parse return type from docstring
|
640
|
-
ret_type = return_type_from_context(
|
641
|
-
docstring=docstr, signature=f"{class_name}.{name}", module=self.current_module
|
642
|
-
)
|
636
|
+
ret_type = return_type_from_context(docstring=docstr, signature=f"{class_name}.{name}", module=self.current_module)
|
643
637
|
# methods have 4 flavours
|
644
638
|
# - __init__ (self, <params>) -> None:
|
645
639
|
# - classmethod (cls, <params>) -> <ret_type>:
|
@@ -759,9 +753,7 @@ class RSTParser(RSTReader):
|
|
759
753
|
|
760
754
|
# deal with documentation wildcards
|
761
755
|
for name in names:
|
762
|
-
r_type = return_type_from_context(
|
763
|
-
docstring=docstr, signature=name, module=self.current_module, literal=True
|
764
|
-
)
|
756
|
+
r_type = return_type_from_context(docstring=docstr, signature=name, module=self.current_module, literal=True)
|
765
757
|
if r_type in ["None"]: # None does not make sense
|
766
758
|
r_type = "Incomplete" # Default to Incomplete/ Unknown / int
|
767
759
|
name = self.strip_prefixes(name)
|
stubber/tools/manifestfile.py
CHANGED
stubber/update_fallback.py
CHANGED
stubber/utils/__init__.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# type: ignore
|
2
|
+
from mpflash.versions import checkedout_version, clean_version
|
3
|
+
|
2
4
|
from .manifest import make_manifest, manifest
|
3
5
|
from .post import do_post_processing
|
4
6
|
from .stubmaker import generate_pyi_files, generate_pyi_from_file
|
5
|
-
from .versions import checkedout_version, clean_version
|
stubber/utils/config.py
CHANGED
@@ -7,8 +7,8 @@ from loguru import logger as log
|
|
7
7
|
from typedconfig.config import Config, key, section
|
8
8
|
from typedconfig.source import EnvironmentConfigSource
|
9
9
|
|
10
|
-
import
|
11
|
-
from
|
10
|
+
import mpflash.basicgit as git
|
11
|
+
from mpflash.versions import V_PREVIEW
|
12
12
|
|
13
13
|
from .typed_config_toml import TomlConfigSource
|
14
14
|
|
@@ -113,9 +113,7 @@ def readconfig(filename: str = "pyproject.toml", prefix: str = "tool.", must_exi
|
|
113
113
|
# add provider sources to the config
|
114
114
|
config.add_source(EnvironmentConfigSource())
|
115
115
|
if use_toml:
|
116
|
-
config.add_source(
|
117
|
-
TomlConfigSource(filename, prefix=prefix, must_exist=must_exist)
|
118
|
-
) # ,"tools.micropython-stubber"))
|
116
|
+
config.add_source(TomlConfigSource(filename, prefix=prefix, must_exist=must_exist)) # ,"tools.micropython-stubber"))
|
119
117
|
config.read()
|
120
118
|
return config
|
121
119
|
|
stubber/utils/manifest.py
CHANGED
@@ -6,7 +6,7 @@ from pathlib import Path
|
|
6
6
|
from typing import Optional
|
7
7
|
|
8
8
|
from .. import __version__
|
9
|
-
from .versions import clean_version
|
9
|
+
from mpflash.versions import clean_version
|
10
10
|
|
11
11
|
# # log = logging.getLogger(__name__)
|
12
12
|
# # logging.basicConfig(level=logging.INFO)
|
@@ -65,9 +65,7 @@ def make_manifest(folder: Path, family: str, port: str, version: str, release: s
|
|
65
65
|
mod_manifest = manifest(family=family, port=port, machine=board, sysname=family, version=version, release=release, stubtype=stubtype)
|
66
66
|
try:
|
67
67
|
# list all *.py files, not strictly modules but decent enough for documentation
|
68
|
-
files = list(folder.glob("**/*.py"))
|
69
|
-
if not files:
|
70
|
-
files = list(folder.glob("**/*.pyi"))
|
68
|
+
files = list(folder.glob("**/*.py")) or list(folder.glob("**/*.pyi"))
|
71
69
|
|
72
70
|
# sort the list
|
73
71
|
for file in sorted(files):
|
stubber/utils/repos.py
CHANGED
@@ -11,10 +11,9 @@ from typing import Tuple
|
|
11
11
|
from loguru import logger as log
|
12
12
|
from packaging.version import Version
|
13
13
|
|
14
|
-
import
|
15
|
-
from mpflash.
|
14
|
+
import mpflash.basicgit as git
|
15
|
+
from mpflash.versions import SET_PREVIEW, V_PREVIEW, get_stable_mp_version
|
16
16
|
from stubber.utils.config import CONFIG
|
17
|
-
from stubber.utils.versions import SET_PREVIEW, V_PREVIEW
|
18
17
|
|
19
18
|
# # log = logging.getLogger(__name__)
|
20
19
|
|
@@ -64,11 +63,7 @@ def read_micropython_lib_commits(filename: str = "data/micropython_tags.csv"):
|
|
64
63
|
reader = csv.DictReader(ntf.file, skipinitialspace=True) # dialect="excel",
|
65
64
|
rows = list(reader)
|
66
65
|
# create a dict version --> commit_hash
|
67
|
-
version_commit = {
|
68
|
-
row["version"].split("/")[-1]: row["lib_commit_hash"]
|
69
|
-
for row in rows
|
70
|
-
if row["version"].startswith("refs/tags/")
|
71
|
-
}
|
66
|
+
version_commit = {row["version"].split("/")[-1]: row["lib_commit_hash"] for row in rows if row["version"].startswith("refs/tags/")}
|
72
67
|
# add default
|
73
68
|
version_commit = defaultdict(lambda: "master", version_commit)
|
74
69
|
return version_commit
|
@@ -96,9 +91,7 @@ def match_lib_with_mpy(version_tag: str, mpy_path: Path, lib_path: Path) -> bool
|
|
96
91
|
return False
|
97
92
|
return git.sync_submodules(mpy_path)
|
98
93
|
else:
|
99
|
-
log.info(
|
100
|
-
f"Matching repo's: Micropython {version_tag} needs micropython-lib:{micropython_lib_commits[version_tag]}"
|
101
|
-
)
|
94
|
+
log.info(f"Matching repo's: Micropython {version_tag} needs micropython-lib:{micropython_lib_commits[version_tag]}")
|
102
95
|
return git.checkout_commit(micropython_lib_commits[version_tag], lib_path)
|
103
96
|
|
104
97
|
|
@@ -120,7 +113,7 @@ def fetch_repos(tag: str, mpy_path: Path, mpy_lib_path: Path):
|
|
120
113
|
git.switch_branch(repo=mpy_path, branch="master")
|
121
114
|
else:
|
122
115
|
if tag == "stable":
|
123
|
-
tag = get_stable_mp_version()
|
116
|
+
tag = get_stable_mp_version()
|
124
117
|
git.switch_tag(tag, repo=mpy_path)
|
125
118
|
result = match_lib_with_mpy(version_tag=tag, mpy_path=mpy_path, lib_path=mpy_lib_path)
|
126
119
|
|
@@ -1,111 +0,0 @@
|
|
1
|
-
# """
|
2
|
-
# Flash STM32 using STM32CubeProgrammer
|
3
|
-
# needs to be installed independenty from https://www.st.com/en/development-tools/stm32cubeprog.html
|
4
|
-
|
5
|
-
# On Linux needs to be run with sudo - unless udev rules are set to allow access to the device as a regular user
|
6
|
-
# """
|
7
|
-
|
8
|
-
# import subprocess
|
9
|
-
# import sys
|
10
|
-
# import time
|
11
|
-
# from pathlib import Path
|
12
|
-
# from typing import Optional
|
13
|
-
|
14
|
-
# import bincopy
|
15
|
-
# from loguru import logger as log
|
16
|
-
# from rich.progress import track
|
17
|
-
# from strip_ansi import strip_ansi
|
18
|
-
|
19
|
-
# from .mpremoteboard.mpremoteboard import MPRemoteBoard
|
20
|
-
|
21
|
-
# STM32_CLI_WIN = "C:\\Program Files\\STMicroelectronics\\STM32Cube\\STM32CubeProgrammer\\bin\\STM32_Programmer_CLI.exe"
|
22
|
-
# STM32_CLI_LINUX = "~/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/STM32_Programmer_CLI"
|
23
|
-
|
24
|
-
|
25
|
-
# def get_stm32_start_address(fw_file: Path):
|
26
|
-
# """
|
27
|
-
# Get the start address of the firmware file, to allow automatic restart from that address after flashing
|
28
|
-
# """
|
29
|
-
# try:
|
30
|
-
# fw_hex = bincopy.BinFile(str(fw_file))
|
31
|
-
# return f"0x{fw_hex.execution_start_address:08X}"
|
32
|
-
# except Exception:
|
33
|
-
|
34
|
-
# return ""
|
35
|
-
|
36
|
-
|
37
|
-
# def flash_stm32_cubecli(mcu: MPRemoteBoard, fw_file: Path, *, erase: bool = True) -> Optional[MPRemoteBoard]:
|
38
|
-
# """
|
39
|
-
# Flash STM32 devices using STM32CubeProgrammer CLI
|
40
|
-
# - Enter bootloader mode
|
41
|
-
# - wait 2s for the device to be detected
|
42
|
-
# - list the connected DFU devices
|
43
|
-
|
44
|
-
# On Linux: requires udev rules to allow access to the device as a regular user
|
45
|
-
# """
|
46
|
-
# if sys.platform == "linux":
|
47
|
-
# STM32_CLI = Path(STM32_CLI_LINUX).expanduser().as_posix()
|
48
|
-
# elif sys.platform == "win32":
|
49
|
-
# STM32_CLI = str(Path(STM32_CLI_WIN).expanduser())
|
50
|
-
# else:
|
51
|
-
# log.error(f"OS {sys.platform} not supported")
|
52
|
-
# return None
|
53
|
-
|
54
|
-
# if not Path(STM32_CLI).exists():
|
55
|
-
# log.error(
|
56
|
-
# f"STM32CubeProgrammer not found at {STM32_CLI}\nPlease install it from https://www.st.com/en/development-tools/stm32cubeprog.html"
|
57
|
-
# )
|
58
|
-
# return None
|
59
|
-
|
60
|
-
# # run STM32_Programmer_CLI.exe --list
|
61
|
-
# cmd = [
|
62
|
-
# STM32_CLI,
|
63
|
-
# "--list",
|
64
|
-
# ]
|
65
|
-
# results = subprocess.run(cmd, capture_output=True, text=True).stdout.splitlines()
|
66
|
-
# results = [strip_ansi(line) for line in results]
|
67
|
-
# if not any(["Product ID : STM32 BOOTLOADER" in l for l in results]):
|
68
|
-
# log.error("No STM32 BOOTLOADER detected")
|
69
|
-
# return None
|
70
|
-
# echo = False
|
71
|
-
# for line in results:
|
72
|
-
# if line.startswith("===== DFU Interface"):
|
73
|
-
# echo = True
|
74
|
-
# if line.startswith("===== STLink"):
|
75
|
-
# echo = False
|
76
|
-
# if echo:
|
77
|
-
# print(line)
|
78
|
-
# # Try to connect - no action
|
79
|
-
# cmd = [
|
80
|
-
# STM32_CLI,
|
81
|
-
# "--connect",
|
82
|
-
# "port=USB1",
|
83
|
-
# ]
|
84
|
-
# results = subprocess.run(cmd, capture_output=True, text=True).stdout.splitlines()
|
85
|
-
# if erase:
|
86
|
-
# log.info("Erasing flash")
|
87
|
-
# cmd = [
|
88
|
-
# STM32_CLI,
|
89
|
-
# "--connect",
|
90
|
-
# "port=USB1",
|
91
|
-
# "--erase",
|
92
|
-
# "all",
|
93
|
-
# ]
|
94
|
-
# results = subprocess.run(cmd, capture_output=True, text=True).stdout.splitlines()
|
95
|
-
# results = [strip_ansi(line) for line in results]
|
96
|
-
# log.info(f"Flashing {fw_file.name} using STM32CubeProgrammer CLI")
|
97
|
-
# start_address = get_stm32_start_address(fw_file)
|
98
|
-
|
99
|
-
# log.trace(f"STM32_Programmer_CLI --connect port=USB1 --write {str(fw_file)} --go {start_address}")
|
100
|
-
# cmd = [
|
101
|
-
# STM32_CLI,
|
102
|
-
# "--connect",
|
103
|
-
# "port=USB1",
|
104
|
-
# "--write",
|
105
|
-
# str(fw_file),
|
106
|
-
# "--go",
|
107
|
-
# start_address,
|
108
|
-
# ]
|
109
|
-
# results = subprocess.run(cmd, capture_output=True, text=True).stdout.splitlines()
|
110
|
-
# log.success("Done flashing, resetting the board and wait for it to restart")
|
111
|
-
# return mcu
|
@@ -1,119 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
#############################################################
|
3
|
-
# Version handling copied from stubber/utils/versions.py
|
4
|
-
#############################################################
|
5
|
-
"""
|
6
|
-
|
7
|
-
from functools import lru_cache
|
8
|
-
|
9
|
-
from loguru import logger as log
|
10
|
-
from packaging.version import parse
|
11
|
-
|
12
|
-
from mpflash.common import GH_CLIENT
|
13
|
-
OLDEST_VERSION = "1.16"
|
14
|
-
"This is the oldest MicroPython version to build the stubs on"
|
15
|
-
|
16
|
-
V_PREVIEW = "preview"
|
17
|
-
"Latest preview version"
|
18
|
-
|
19
|
-
SET_PREVIEW = {"preview", "latest", "master"}
|
20
|
-
|
21
|
-
|
22
|
-
def clean_version(
|
23
|
-
version: str,
|
24
|
-
*,
|
25
|
-
build: bool = False,
|
26
|
-
patch: bool = False,
|
27
|
-
commit: bool = False,
|
28
|
-
drop_v: bool = False,
|
29
|
-
flat: bool = False,
|
30
|
-
):
|
31
|
-
"Clean up and transform the many flavours of versions"
|
32
|
-
# 'v1.13.0-103-gb137d064e' --> 'v1.13-103'
|
33
|
-
if version in {"", "-"}:
|
34
|
-
return version
|
35
|
-
if version.lower() == "stable":
|
36
|
-
_v = get_stable_mp_version()
|
37
|
-
if not _v:
|
38
|
-
log.warning("Could not determine the latest stable version")
|
39
|
-
return "stable"
|
40
|
-
version = _v
|
41
|
-
log.trace(f"Using latest stable version: {version}")
|
42
|
-
is_preview = "-preview" in version
|
43
|
-
nibbles = version.split("-")
|
44
|
-
ver_ = nibbles[0].lower().lstrip("v")
|
45
|
-
if not patch and ver_ >= "1.10.0" and ver_ < "1.20.0" and ver_.endswith(".0"):
|
46
|
-
# remove the last ".0" - but only for versions between 1.10 and 1.20 (because)
|
47
|
-
nibbles[0] = nibbles[0][:-2]
|
48
|
-
if len(nibbles) == 1:
|
49
|
-
version = nibbles[0]
|
50
|
-
elif build and not is_preview:
|
51
|
-
version = "-".join(nibbles) if commit else "-".join(nibbles[:-1])
|
52
|
-
else:
|
53
|
-
# version = "-".join((nibbles[0], LATEST))
|
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
|
-
if flat:
|
60
|
-
version = version.strip().replace(".", "_").replace("-", "_")
|
61
|
-
else:
|
62
|
-
version = version.strip().replace("_preview", "-preview").replace("_", ".")
|
63
|
-
|
64
|
-
if drop_v:
|
65
|
-
version = version.lstrip("v")
|
66
|
-
elif not version.startswith("v") and version.lower() not in SET_PREVIEW:
|
67
|
-
version = "v" + version
|
68
|
-
if version in SET_PREVIEW:
|
69
|
-
version = V_PREVIEW
|
70
|
-
return version
|
71
|
-
|
72
|
-
|
73
|
-
@lru_cache(maxsize=10)
|
74
|
-
def micropython_versions(minver: str = "v1.20", reverse: bool = False):
|
75
|
-
"""Get the list of micropython versions from github tags"""
|
76
|
-
try:
|
77
|
-
gh_client = GH_CLIENT
|
78
|
-
repo = gh_client.get_repo("micropython/micropython")
|
79
|
-
versions = [tag.name for tag in repo.get_tags() if parse(tag.name) >= parse(minver)]
|
80
|
-
# Only keep the last preview
|
81
|
-
versions = [v for v in versions if not v.endswith(V_PREVIEW) or v == versions[-1]]
|
82
|
-
except Exception:
|
83
|
-
versions = [
|
84
|
-
"v9.99.9-preview",
|
85
|
-
"v1.22.2",
|
86
|
-
"v1.22.1",
|
87
|
-
"v1.22.0",
|
88
|
-
"v1.21.1",
|
89
|
-
"v1.21.0",
|
90
|
-
"v1.20.0",
|
91
|
-
"v1.19.1",
|
92
|
-
"v1.19",
|
93
|
-
"v1.18",
|
94
|
-
"v1.17",
|
95
|
-
"v1.16",
|
96
|
-
"v1.15",
|
97
|
-
"v1.14",
|
98
|
-
"v1.13",
|
99
|
-
"v1.12",
|
100
|
-
"v1.11",
|
101
|
-
"v1.10",
|
102
|
-
]
|
103
|
-
versions = [v for v in versions if parse(v) >= parse(minver)]
|
104
|
-
# remove all but the most recent (preview) version
|
105
|
-
versions = versions[:1] + [v for v in versions if "preview" not in v]
|
106
|
-
return sorted(versions, reverse=reverse)
|
107
|
-
|
108
|
-
|
109
|
-
def get_stable_mp_version() -> str:
|
110
|
-
# read the versions from the git tags
|
111
|
-
all_versions = micropython_versions(minver=OLDEST_VERSION)
|
112
|
-
return [v for v in all_versions if not v.endswith(V_PREVIEW)][-1]
|
113
|
-
|
114
|
-
|
115
|
-
def get_preview_mp_version() -> str:
|
116
|
-
# read the versions from the git tags
|
117
|
-
all_versions = micropython_versions(minver=OLDEST_VERSION)
|
118
|
-
return [v for v in all_versions if v.endswith(V_PREVIEW)][-1]
|
119
|
-
|
File without changes
|
File without changes
|
{micropython_stubber-1.23.0.dist-info → micropython_stubber-1.23.1.dist-info}/entry_points.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|