micropython-stubber 1.23.0__py3-none-any.whl → 1.23.1.post1__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.post1.dist-info}/METADATA +32 -14
- micropython_stubber-1.23.1.post1.dist-info/RECORD +159 -0
- micropython_stubber-1.23.1.post1.dist-info/entry_points.txt +5 -0
- mpflash/README.md +40 -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 +2 -2
- mpflash/mpflash/cli_flash.py +13 -16
- mpflash/mpflash/cli_group.py +18 -5
- mpflash/mpflash/cli_list.py +8 -2
- mpflash/mpflash/cli_main.py +3 -5
- mpflash/mpflash/common.py +3 -1
- mpflash/mpflash/config.py +2 -1
- mpflash/mpflash/connected.py +11 -8
- 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 +26 -9
- 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 +57 -17
- {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/bulk/mcu_stubber.py +28 -45
- stubber/codemod/enrich.py +1 -1
- stubber/codemod/merge_docstub.py +1 -1
- stubber/codemod/utils.py +2 -3
- stubber/commands/build_cmd.py +1 -1
- stubber/commands/cli.py +6 -12
- stubber/commands/clone_cmd.py +3 -2
- stubber/commands/config_cmd.py +1 -1
- stubber/commands/enrich_folder_cmd.py +1 -1
- stubber/commands/get_core_cmd.py +1 -1
- stubber/commands/get_docstubs_cmd.py +6 -3
- stubber/commands/get_frozen_cmd.py +6 -3
- stubber/commands/get_mcu_cmd.py +53 -12
- stubber/commands/merge_cmd.py +2 -3
- stubber/commands/publish_cmd.py +2 -3
- stubber/commands/stub_cmd.py +1 -1
- stubber/commands/switch_cmd.py +2 -2
- stubber/commands/variants_cmd.py +2 -3
- stubber/downloader.py +2 -1
- stubber/freeze/common.py +7 -3
- stubber/freeze/freeze_folder.py +2 -2
- stubber/freeze/freeze_manifest_2.py +19 -6
- stubber/freeze/get_frozen.py +8 -4
- stubber/get_cpython.py +15 -4
- stubber/minify.py +11 -6
- stubber/publish/candidates.py +20 -7
- stubber/publish/defaults.py +4 -9
- stubber/publish/merge_docstubs.py +4 -2
- stubber/publish/missing_class_methods.py +5 -3
- stubber/publish/package.py +8 -4
- stubber/publish/pathnames.py +2 -2
- stubber/publish/publish.py +2 -2
- stubber/publish/pypi.py +6 -2
- stubber/publish/stubpackage.py +39 -17
- stubber/rst/classsort.py +2 -1
- stubber/rst/lookup.py +1 -0
- stubber/rst/reader.py +12 -20
- stubber/rst/report_return.py +12 -4
- stubber/rst/rst_utils.py +2 -1
- stubber/stubs_from_docs.py +1 -1
- stubber/tools/manifestfile.py +1 -2
- stubber/update_fallback.py +2 -2
- stubber/update_module_list.py +1 -1
- stubber/utils/__init__.py +2 -1
- stubber/utils/config.py +18 -8
- stubber/utils/manifest.py +2 -4
- stubber/utils/post.py +2 -1
- stubber/utils/repos.py +4 -5
- stubber/utils/stubmaker.py +1 -1
- stubber/utils/typed_config_toml.py +5 -2
- stubber/variants.py +1 -1
- micropython_stubber-1.23.0.dist-info/RECORD +0 -159
- micropython_stubber-1.23.0.dist-info/entry_points.txt +0 -3
- 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.post1.dist-info}/LICENSE +0 -0
- {micropython_stubber-1.23.0.dist-info → micropython_stubber-1.23.1.post1.dist-info}/WHEEL +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
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/bulk/mcu_stubber.py
CHANGED
@@ -11,11 +11,13 @@ from pathlib import Path
|
|
11
11
|
from tempfile import mkdtemp
|
12
12
|
from typing import List, Optional, Tuple
|
13
13
|
|
14
|
-
from loguru import logger as log
|
15
14
|
from rich.console import Console
|
16
15
|
from rich.table import Table
|
17
16
|
from tenacity import retry, stop_after_attempt, wait_fixed
|
18
17
|
|
18
|
+
from mpflash.connected import list_mcus
|
19
|
+
from mpflash.list import show_mcus
|
20
|
+
from mpflash.logger import log
|
19
21
|
from mpflash.mpremoteboard import ERROR, OK, MPRemoteBoard
|
20
22
|
from stubber import utils
|
21
23
|
from stubber.publish.merge_docstubs import merge_all_docstubs
|
@@ -250,7 +252,10 @@ def copy_boardname_to_board(mcu: MPRemoteBoard):
|
|
250
252
|
None
|
251
253
|
"""
|
252
254
|
if mcu.board:
|
253
|
-
cmd = [
|
255
|
+
cmd = [
|
256
|
+
"exec",
|
257
|
+
f"with open('lib/boardname.py', 'w') as f: f.write('BOARDNAME=\"{mcu.board}\"')",
|
258
|
+
]
|
254
259
|
log.info(f"Writing BOARDNAME='{mcu.board}' to boardname.py")
|
255
260
|
else:
|
256
261
|
cmd = ["rm", "boardname.py"]
|
@@ -284,30 +289,7 @@ def copy_scripts_to_board(mcu: MPRemoteBoard, variant: Variant, form: Form):
|
|
284
289
|
|
285
290
|
|
286
291
|
def get_stubfolder(out: List[str]):
|
287
|
-
return (
|
288
|
-
lines[-1].split("/remote/")[-1].strip() if (lines := [l for l in out if l.startswith("INFO : Path: ")]) else ""
|
289
|
-
)
|
290
|
-
|
291
|
-
|
292
|
-
def scan_boards(optimistic: bool = False) -> List[MPRemoteBoard]:
|
293
|
-
"""
|
294
|
-
This function scans for boards and returns a list of MPRemoteBoard objects.
|
295
|
-
:return: list of MPRemoteBoard objects
|
296
|
-
"""
|
297
|
-
boards = []
|
298
|
-
for mpr_port in MPRemoteBoard.connected_boards():
|
299
|
-
board = MPRemoteBoard(mpr_port)
|
300
|
-
log.debug(f"Attempt to connect to: {board.serialport}")
|
301
|
-
try:
|
302
|
-
board.get_mcu_info()
|
303
|
-
log.success(f"Detected board {board.description} {board.version}")
|
304
|
-
boards.append(board)
|
305
|
-
except Exception:
|
306
|
-
log.error(f"Failed to get mcu_info for {board.serialport}")
|
307
|
-
if optimistic:
|
308
|
-
boards.append(board)
|
309
|
-
continue
|
310
|
-
return boards
|
292
|
+
return lines[-1].split("/remote/")[-1].strip() if (lines := [l for l in out if l.startswith("INFO : Path: ")]) else ""
|
311
293
|
|
312
294
|
|
313
295
|
def set_loglevel(verbose: int) -> str:
|
@@ -347,7 +329,14 @@ def copy_to_repo(source: Path, fw: dict) -> Optional[Path]:
|
|
347
329
|
return None
|
348
330
|
|
349
331
|
|
350
|
-
def stub_connected_mcus(
|
332
|
+
def stub_connected_mcus(
|
333
|
+
variant: str,
|
334
|
+
format: str,
|
335
|
+
debug: bool,
|
336
|
+
serial: List[str],
|
337
|
+
ignore: List[str],
|
338
|
+
bluetooth: bool,
|
339
|
+
) -> int:
|
351
340
|
"""
|
352
341
|
Runs the stubber to generate stubs for connected MicroPython boards.
|
353
342
|
|
@@ -372,27 +361,19 @@ def stub_connected_mcus(variant: str, format: str, debug: bool) -> int:
|
|
372
361
|
all_built = []
|
373
362
|
|
374
363
|
# scan boards and just work with the ones that respond with understandable data
|
375
|
-
|
376
|
-
|
364
|
+
connected_mcus = list_mcus(ignore=ignore, include=serial, bluetooth=bluetooth)
|
365
|
+
# ignore boards that have the [micropython-stubber] ignore flag set
|
366
|
+
connected_mcus = [item for item in connected_mcus if not (item.toml.get("micropython-stubber", {}).get("ignore", False))]
|
367
|
+
|
368
|
+
if not connected_mcus:
|
377
369
|
log.error("No micropython boards were found")
|
378
370
|
return ERROR
|
379
371
|
|
380
|
-
|
381
|
-
table.add_column("Serial Port")
|
382
|
-
table.add_column("Port")
|
383
|
-
table.add_column("Description")
|
384
|
-
table.add_column("Version")
|
385
|
-
|
386
|
-
for b in connected_boards:
|
387
|
-
table.add_row(b.serialport, b.port, b.description, b.version)
|
388
|
-
console = Console()
|
389
|
-
console.print(table)
|
372
|
+
show_mcus(connected_mcus, refresh=False)
|
390
373
|
|
391
374
|
# scan boards and generate stubs
|
392
|
-
for board in
|
393
|
-
log.info(
|
394
|
-
f"Connecting using {board.serialport} to {board.port} {board.board} {board.version}: {board.description}"
|
395
|
-
)
|
375
|
+
for board in connected_mcus:
|
376
|
+
log.info(f"Connecting using {board.serialport} to {board.port} {board.board} {board.version}: {board.description}")
|
396
377
|
# remove the modulelist.done file before starting createstubs on each board
|
397
378
|
(temp_path / "modulelist.done").unlink(missing_ok=True)
|
398
379
|
|
@@ -428,14 +409,16 @@ def stub_connected_mcus(variant: str, format: str, debug: bool) -> int:
|
|
428
409
|
all_built.extend(built)
|
429
410
|
|
430
411
|
if all_built:
|
431
|
-
print_result_table(all_built
|
412
|
+
print_result_table(all_built)
|
432
413
|
log.success("Done")
|
433
414
|
return OK
|
434
415
|
log.error(f"Failed to generate stubs for {board.serialport}")
|
435
416
|
return ERROR
|
436
417
|
|
437
418
|
|
438
|
-
def print_result_table(all_built: List, console: Console):
|
419
|
+
def print_result_table(all_built: List, console: Optional[Console] = None):
|
420
|
+
if not console:
|
421
|
+
console = Console()
|
439
422
|
# create a rich table of the results and print it'
|
440
423
|
table = Table(title="Results")
|
441
424
|
|
stubber/codemod/enrich.py
CHANGED
@@ -8,7 +8,7 @@ from typing import Any, Dict, Optional
|
|
8
8
|
|
9
9
|
from libcst.codemod import CodemodContext, diff_code, exec_transform_with_prettyprint
|
10
10
|
from libcst.tool import _default_config # type: ignore
|
11
|
-
from
|
11
|
+
from mpflash.logger import log
|
12
12
|
|
13
13
|
import stubber.codemod.merge_docstub as merge_docstub
|
14
14
|
from stubber.utils.post import run_black
|
stubber/codemod/merge_docstub.py
CHANGED
@@ -13,7 +13,7 @@ import libcst as cst
|
|
13
13
|
from libcst.codemod import CodemodContext, VisitorBasedCodemodCommand
|
14
14
|
from libcst.codemod.visitors import AddImportsVisitor, GatherImportsVisitor, ImportItem
|
15
15
|
from libcst.helpers.module import insert_header_comments
|
16
|
-
from
|
16
|
+
from mpflash.logger import log
|
17
17
|
|
18
18
|
from stubber.cst_transformer import (
|
19
19
|
MODULE_KEY,
|
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/build_cmd.py
CHANGED
stubber/commands/cli.py
CHANGED
@@ -4,16 +4,17 @@ command line interface - main group
|
|
4
4
|
|
5
5
|
import sys
|
6
6
|
|
7
|
+
from mpflash.vendor.click_aliases import ClickAliasedGroup
|
7
8
|
import rich_click as click
|
8
|
-
from
|
9
|
+
from mpflash.logger import log, set_loglevel as mpf_set_loglevel
|
9
10
|
from stubber import __version__
|
10
11
|
|
11
12
|
|
12
|
-
@click.group(chain=True)
|
13
|
+
@click.group(chain=True, cls=ClickAliasedGroup)
|
13
14
|
@click.version_option(package_name="micropython-stubber", prog_name="micropython-stubber✏️ ")
|
14
15
|
@click.option(
|
15
16
|
"-V",
|
16
|
-
"-
|
17
|
+
"-V",
|
17
18
|
"--verbose",
|
18
19
|
count=True,
|
19
20
|
default=0,
|
@@ -41,15 +42,8 @@ def set_loglevel(verbose: int) -> str:
|
|
41
42
|
Add the handler to the logger, with the level and format string.
|
42
43
|
Return the level
|
43
44
|
"""
|
44
|
-
log.remove()
|
45
45
|
level = {0: "INFO", 1: "DEBUG", 2: "TRACE"}.get(verbose, "TRACE")
|
46
|
-
|
47
|
-
|
48
|
-
else:
|
49
|
-
format_str = "<green>{time:YYYY-MM-DD HH:mm:ss.SSS}</green> | <level>{level: <8}</level> | <cyan>{name}</cyan>:<cyan>{function}</cyan>:<cyan>{line}</cyan> - <level>{message}</level>"
|
50
|
-
|
51
|
-
log.add(
|
52
|
-
sys.stderr, level=level, backtrace=True, diagnose=True, colorize=True, format=format_str
|
53
|
-
)
|
46
|
+
# reuse mpflash logger
|
47
|
+
mpf_set_loglevel(level)
|
54
48
|
log.info(f"micropython-stubber {__version__}")
|
55
49
|
return level
|
stubber/commands/clone_cmd.py
CHANGED
@@ -8,8 +8,8 @@ from pathlib import Path
|
|
8
8
|
from typing import List, Tuple, Union
|
9
9
|
|
10
10
|
import rich_click as click
|
11
|
-
import
|
12
|
-
from
|
11
|
+
import mpflash.basicgit as git
|
12
|
+
from mpflash.logger import log
|
13
13
|
from stubber.utils.config import CONFIG
|
14
14
|
|
15
15
|
from .cli import stubber_cli
|
@@ -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,
|
stubber/commands/config_cmd.py
CHANGED
stubber/commands/get_core_cmd.py
CHANGED
@@ -7,9 +7,9 @@ from pathlib import Path
|
|
7
7
|
from typing import Optional
|
8
8
|
|
9
9
|
import rich_click as click
|
10
|
-
from
|
10
|
+
from mpflash.logger import 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
|
@@ -22,7 +22,10 @@ from .cli import stubber_cli
|
|
22
22
|
#########################################################################################
|
23
23
|
|
24
24
|
|
25
|
-
@stubber_cli.command(
|
25
|
+
@stubber_cli.command(
|
26
|
+
name="get-docstubs",
|
27
|
+
aliases=["get-doc-stubs", "docstubs"],
|
28
|
+
)
|
26
29
|
@click.option(
|
27
30
|
"--path",
|
28
31
|
"-p",
|
@@ -7,7 +7,7 @@ from pathlib import Path
|
|
7
7
|
from typing import List, Optional
|
8
8
|
|
9
9
|
import rich_click as click
|
10
|
-
from
|
10
|
+
from mpflash.logger import log
|
11
11
|
|
12
12
|
import stubber.utils as utils
|
13
13
|
from stubber.codemod.enrich import enrich_folder
|
@@ -20,7 +20,10 @@ from .cli import stubber_cli
|
|
20
20
|
##########################################################################################
|
21
21
|
|
22
22
|
|
23
|
-
@stubber_cli.command(
|
23
|
+
@stubber_cli.command(
|
24
|
+
name="get-frozen",
|
25
|
+
aliases=["get-frozen-stubs", "frozen"],
|
26
|
+
)
|
24
27
|
@click.option(
|
25
28
|
"--stub-folder",
|
26
29
|
"-stubs",
|
@@ -31,7 +34,7 @@ from .cli import stubber_cli
|
|
31
34
|
@click.option(
|
32
35
|
"--version",
|
33
36
|
"--Version",
|
34
|
-
"-
|
37
|
+
"-v",
|
35
38
|
"version",
|
36
39
|
default="",
|
37
40
|
# default=[CONFIG.stable_version],
|
stubber/commands/get_mcu_cmd.py
CHANGED
@@ -5,8 +5,9 @@
|
|
5
5
|
##########################################################################################
|
6
6
|
|
7
7
|
|
8
|
+
from typing import List
|
8
9
|
import rich_click as click
|
9
|
-
from
|
10
|
+
from mpflash.logger import log
|
10
11
|
|
11
12
|
from stubber.bulk.mcu_stubber import stub_connected_mcus
|
12
13
|
from stubber.utils.config import CONFIG
|
@@ -18,10 +19,13 @@ from .cli import stubber_cli
|
|
18
19
|
#########################################################################################
|
19
20
|
|
20
21
|
|
21
|
-
@stubber_cli.command(
|
22
|
+
@stubber_cli.command(
|
23
|
+
name="get-mcu-stubs",
|
24
|
+
aliases=["get-mcu-stubs", "mcu-stubs", "mcu"],
|
25
|
+
)
|
22
26
|
@click.option(
|
23
27
|
"--variant",
|
24
|
-
"-v",
|
28
|
+
# "-v",
|
25
29
|
type=click.Choice(["Full", "Mem", "DB"], case_sensitive=False),
|
26
30
|
default="DB",
|
27
31
|
show_default=True,
|
@@ -35,22 +39,50 @@ from .cli import stubber_cli
|
|
35
39
|
show_default=True,
|
36
40
|
help="Python source or pre-compiled.",
|
37
41
|
)
|
38
|
-
@click.option("--debug/--no-debug", default=False, show_default=True, help="Debug mode.")
|
39
42
|
@click.option(
|
40
|
-
"--
|
41
|
-
|
43
|
+
"--serial",
|
44
|
+
"--serial-port",
|
45
|
+
"-s",
|
46
|
+
"serial",
|
47
|
+
default=["*"],
|
48
|
+
multiple=True,
|
42
49
|
show_default=True,
|
43
|
-
help="
|
50
|
+
help="Which serial port(s) (or globs) to list. ",
|
51
|
+
metavar="SERIALPORT",
|
44
52
|
)
|
45
53
|
@click.option(
|
46
|
-
"--
|
47
|
-
|
54
|
+
"--ignore",
|
55
|
+
"-i",
|
56
|
+
is_eager=True,
|
57
|
+
help="Serial port(s) (or globs) to ignore. Defaults to MPFLASH_IGNORE.",
|
58
|
+
multiple=True,
|
59
|
+
default=[],
|
60
|
+
envvar="MPFLASH_IGNORE",
|
48
61
|
show_default=True,
|
49
|
-
|
62
|
+
metavar="SERIALPORT",
|
50
63
|
)
|
51
|
-
|
64
|
+
@click.option(
|
65
|
+
"--bluetooth/--no-bluetooth",
|
66
|
+
"-b/-nb",
|
67
|
+
is_flag=True,
|
68
|
+
default=False,
|
69
|
+
show_default=True,
|
70
|
+
help="""Include bluetooth ports in the list""",
|
71
|
+
)
|
72
|
+
@click.option("--debug/--no-debug", default=False, show_default=True, help="Debug mode.")
|
73
|
+
def cli_create_mcu_stubs(
|
74
|
+
variant: str,
|
75
|
+
format: str,
|
76
|
+
debug: bool,
|
77
|
+
serial: List[str],
|
78
|
+
ignore: List[str],
|
79
|
+
bluetooth: bool,
|
80
|
+
) -> int:
|
52
81
|
"""Run createstubs on one or more MCUs, and add the stubs to the micropython-stub repo."""
|
53
82
|
# check if all repos have been cloned
|
83
|
+
serial = list(serial)
|
84
|
+
ignore = list(ignore)
|
85
|
+
|
54
86
|
for repo in CONFIG.repos:
|
55
87
|
if not repo.exists():
|
56
88
|
log.error(
|
@@ -58,4 +90,13 @@ def cli_create_mcu_stubs(variant: str, format: str, debug: bool, reset: bool, gi
|
|
58
90
|
)
|
59
91
|
exit(1)
|
60
92
|
|
61
|
-
exit(
|
93
|
+
exit(
|
94
|
+
stub_connected_mcus(
|
95
|
+
variant=variant,
|
96
|
+
format=format,
|
97
|
+
debug=debug,
|
98
|
+
serial=serial,
|
99
|
+
ignore=ignore,
|
100
|
+
bluetooth=bluetooth,
|
101
|
+
)
|
102
|
+
)
|
stubber/commands/merge_cmd.py
CHANGED
@@ -5,7 +5,7 @@ enrich machinestubs with docstubs
|
|
5
5
|
from typing import List, Union
|
6
6
|
|
7
7
|
import rich_click as click
|
8
|
-
from
|
8
|
+
from mpflash.logger import log
|
9
9
|
|
10
10
|
from stubber.publish.merge_docstubs import merge_all_docstubs
|
11
11
|
from stubber.publish.package import GENERIC_L
|
@@ -18,8 +18,7 @@ from .cli import stubber_cli
|
|
18
18
|
@click.option("--family", default="micropython", type=str, show_default=True)
|
19
19
|
@click.option(
|
20
20
|
"--version",
|
21
|
-
"
|
22
|
-
"-V",
|
21
|
+
"-v",
|
23
22
|
"versions",
|
24
23
|
multiple=True,
|
25
24
|
default=["all"],
|
stubber/commands/publish_cmd.py
CHANGED
@@ -5,7 +5,7 @@ Commandline interface to publish stubs.
|
|
5
5
|
from typing import List, Union
|
6
6
|
|
7
7
|
import rich_click as click
|
8
|
-
from
|
8
|
+
from mpflash.logger import log
|
9
9
|
from tabulate import tabulate
|
10
10
|
|
11
11
|
from stubber.commands.cli import stubber_cli
|
@@ -18,8 +18,7 @@ from stubber.utils.config import CONFIG
|
|
18
18
|
@click.option("--family", default="micropython", type=str, show_default=True)
|
19
19
|
@click.option(
|
20
20
|
"--version",
|
21
|
-
"
|
22
|
-
"-V",
|
21
|
+
"-v",
|
23
22
|
"versions",
|
24
23
|
multiple=True,
|
25
24
|
default=[CONFIG.stable_version],
|
stubber/commands/stub_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
@@ -3,7 +3,7 @@
|
|
3
3
|
from pathlib import Path
|
4
4
|
|
5
5
|
import rich_click as click
|
6
|
-
from
|
6
|
+
from mpflash.logger import log
|
7
7
|
from stubber.utils.config import CONFIG
|
8
8
|
from stubber.variants import create_variants
|
9
9
|
import stubber
|
@@ -13,8 +13,7 @@ from .cli import stubber_cli
|
|
13
13
|
|
14
14
|
@click.option(
|
15
15
|
"--version",
|
16
|
-
"
|
17
|
-
"-V",
|
16
|
+
"-v",
|
18
17
|
"version",
|
19
18
|
default=CONFIG.stable_version,
|
20
19
|
show_default=True,
|
stubber/downloader.py
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
"""Download files from a public github repo"""
|
2
|
+
|
2
3
|
# Copyright (c) 2020 Jos Verlinde
|
3
4
|
# MIT license
|
4
5
|
# pylint: disable= invalid-name
|
5
6
|
import os
|
6
7
|
|
7
8
|
import requests
|
8
|
-
from
|
9
|
+
from mpflash.logger import log
|
9
10
|
|
10
11
|
# # log = logging.getLogger(__name__)
|
11
12
|
# log.setLevel(level=logging.INFO)
|