micropython-stubber 1.24.4__py3-none-any.whl → 1.25.0.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.24.4.dist-info → micropython_stubber-1.25.0.post1.dist-info}/METADATA +3 -3
- {micropython_stubber-1.24.4.dist-info → micropython_stubber-1.25.0.post1.dist-info}/RECORD +31 -28
- stubber/__init__.py +1 -1
- stubber/board/createstubs.py +22 -12
- stubber/board/createstubs_db.py +24 -14
- stubber/board/createstubs_db_min.py +205 -200
- stubber/board/createstubs_db_mpy.mpy +0 -0
- stubber/board/createstubs_mem.py +23 -13
- stubber/board/createstubs_mem_min.py +192 -186
- stubber/board/createstubs_mem_mpy.mpy +0 -0
- stubber/board/createstubs_min.py +194 -188
- stubber/board/createstubs_mpy.mpy +0 -0
- stubber/board/pkg_full.json +22 -0
- stubber/board/pkg_minified.json +22 -0
- stubber/board/pkg_mpy.json +22 -0
- stubber/bulk/mcu_stubber.py +62 -102
- stubber/codemod/_partials/db_main.py +1 -1
- stubber/codemod/merge_docstub.py +99 -18
- stubber/commands/clone_cmd.py +1 -1
- stubber/commands/get_core_cmd.py +1 -1
- stubber/commands/get_docstubs_cmd.py +3 -3
- stubber/commands/get_frozen_cmd.py +3 -3
- stubber/commands/stub_cmd.py +1 -1
- stubber/stubs_from_docs.py +2 -2
- stubber/typing_collector.py +6 -2
- stubber/utils/post.py +2 -2
- stubber/utils/repos.py +42 -6
- stubber/utils/stubmaker.py +1 -1
- {micropython_stubber-1.24.4.dist-info → micropython_stubber-1.25.0.post1.dist-info}/LICENSE +0 -0
- {micropython_stubber-1.24.4.dist-info → micropython_stubber-1.25.0.post1.dist-info}/WHEEL +0 -0
- {micropython_stubber-1.24.4.dist-info → micropython_stubber-1.25.0.post1.dist-info}/entry_points.txt +0 -0
{micropython_stubber-1.24.4.dist-info → micropython_stubber-1.25.0.post1.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: micropython-stubber
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.25.0.post1
|
4
4
|
Summary: Tooling to create and maintain stubs for MicroPython
|
5
5
|
License: MIT
|
6
6
|
Keywords: MicroPython,stubs,vscode,pyright,linting,static type check
|
@@ -25,7 +25,7 @@ Requires-Dist: executing (>=2.0.1,<3.0.0)
|
|
25
25
|
Requires-Dist: importlib-metadata (>=1,<9) ; python_version < "3.8"
|
26
26
|
Requires-Dist: libcst (>=1.1.0,<2.0.0)
|
27
27
|
Requires-Dist: loguru (>=0.6,<0.8)
|
28
|
-
Requires-Dist: mpflash (>=1.
|
28
|
+
Requires-Dist: mpflash (>=1.25.0)
|
29
29
|
Requires-Dist: mpremote (>=1.24.1)
|
30
30
|
Requires-Dist: mypy (>=1.10)
|
31
31
|
Requires-Dist: mypy-gitlab-code-quality (>=1.1.0,<2.0.0)
|
@@ -40,7 +40,7 @@ Requires-Dist: pyserial (>=3.5)
|
|
40
40
|
Requires-Dist: python-minifier (>=2.7.0,<3.0.0) ; python_version < "3.14"
|
41
41
|
Requires-Dist: requests (>=2.32.3,<3.0.0)
|
42
42
|
Requires-Dist: rich-click (>=1.8.3,<2.0.0)
|
43
|
-
Requires-Dist: tenacity (
|
43
|
+
Requires-Dist: tenacity (==9.0.0)
|
44
44
|
Requires-Dist: tomli (>=2.0.1,<3.0.0) ; python_version < "3.11"
|
45
45
|
Requires-Dist: tomli-w (>=1.0.0,<2.0.0)
|
46
46
|
Requires-Dist: typed-config (>=1.3.0,<2.0.0)
|
@@ -1,50 +1,53 @@
|
|
1
|
-
stubber/__init__.py,sha256=
|
1
|
+
stubber/__init__.py,sha256=q4tl_y-ozEZWasPZc629KNxNxqjSDsNSSTfceSkf2rY,49
|
2
2
|
stubber/board/board_info.csv,sha256=K2VSmfR013fN-oJWkQUmiQ19w09dVwJHDquPy6QmMhY,8627
|
3
3
|
stubber/board/boot.py,sha256=XjWlKErU5nI1HJSugXIP_3hlwgRQboE6sJrpcbSygnk,1120
|
4
|
-
stubber/board/createstubs.py,sha256=
|
5
|
-
stubber/board/createstubs_db.py,sha256=
|
6
|
-
stubber/board/createstubs_db_min.py,sha256=
|
7
|
-
stubber/board/createstubs_db_mpy.mpy,sha256=
|
4
|
+
stubber/board/createstubs.py,sha256=357lczMPGvACb52bLWLu1gXx6ZVAZzITSeYDrKVsEgA,34715
|
5
|
+
stubber/board/createstubs_db.py,sha256=b1SWgurkDOu7DG4OuyD_Pm0-EorJBLM9Dij0KQOi9zI,31621
|
6
|
+
stubber/board/createstubs_db_min.py,sha256=WgoDwL90NYJMlnccvgsVnG9LO6CqjIUHnvTpRG0qKYc,12189
|
7
|
+
stubber/board/createstubs_db_mpy.mpy,sha256=NN-oJsfgnZzlFEwvHYbpAKjXz-YsI5tbmaD7K8Jupz0,10148
|
8
8
|
stubber/board/createstubs_lvgl.py,sha256=CTe7eq1ACRK_JJxavaqDD8znn29nSWJiHHTZ_ps6EhM,27217
|
9
9
|
stubber/board/createstubs_lvgl_min.py,sha256=jLkWYmeboI2A8feMC7pT7cYWttLejQTuX7WAEZCylhw,27207
|
10
10
|
stubber/board/createstubs_lvgl_mpy.mpy,sha256=ex-nlq2V5e8anQBJvRWEEc-FzU7nlwg5NSrZ8vOadIA,9267
|
11
|
-
stubber/board/createstubs_mem.py,sha256=
|
12
|
-
stubber/board/createstubs_mem_min.py,sha256=
|
13
|
-
stubber/board/createstubs_mem_mpy.mpy,sha256=
|
14
|
-
stubber/board/createstubs_min.py,sha256=
|
15
|
-
stubber/board/createstubs_mpy.mpy,sha256=
|
11
|
+
stubber/board/createstubs_mem.py,sha256=ZR46eQ3_XqvIrpzrNavYR9Gfd5-EBcn3I6i8RvmpjYw,29939
|
12
|
+
stubber/board/createstubs_mem_min.py,sha256=IpobaEWuzvBdKYaOrx33UtZn59HfiyVTkRobc-XLpvg,11719
|
13
|
+
stubber/board/createstubs_mem_mpy.mpy,sha256=NhivvWh-0uGyry2QmbpWsppRx3-rCamhNR3s0SItgLQ,9735
|
14
|
+
stubber/board/createstubs_min.py,sha256=0cbZJeNjQBbHXcF462JsfQqTG718BaLa46Cln-a32Qc,14463
|
15
|
+
stubber/board/createstubs_mpy.mpy,sha256=xonRZtK_23kymK5Q7Gzpjh6nBgy5HPVWs9ol2x2XLn8,13071
|
16
16
|
stubber/board/fw_info.py,sha256=6AQbN3jtQgllqWQYl4e-63KeEtV08EXk8_JnM6XBkvo,4554
|
17
17
|
stubber/board/info.py,sha256=b7SOPZHVsVhaayKCwVkFZlYu0BW-UFI7LuG1Eop9480,5629
|
18
18
|
stubber/board/main.py,sha256=f6V3tdt6sPZVLuwemT-NLuK9GySfW2c2J6PJMOOWQQw,413
|
19
19
|
stubber/board/modulelist.txt,sha256=rZ6sn8CXjVYRKCcM0rlurfiIwsDuWhzSPOleAmoxCCI,2945
|
20
|
+
stubber/board/pkg_full.json,sha256=XvlpWpX8x1NxNQLDipkJWm66gz9YpDY4hJYtl-hMK9s,544
|
21
|
+
stubber/board/pkg_minified.json,sha256=JlrQdWXzgomiOXJP6iTSzSK-8NgojLIzqiXjFFreM18,430
|
22
|
+
stubber/board/pkg_mpy.json,sha256=gsBLJBRHhfWvYsb0Ux2am539v8nXIKikZ98ezYFRu5I,436
|
20
23
|
stubber/board/pyrightconfig.json,sha256=6oHS4aDOfwKBAFeUPsCGJzEXpUgBZsPaF0M4P-N26D4,1376
|
21
|
-
stubber/bulk/mcu_stubber.py,sha256=
|
24
|
+
stubber/bulk/mcu_stubber.py,sha256=kVhVESmi5FcWAdk1OCsMyZRGaraGELMYO1WuMsfFbuY,14524
|
22
25
|
stubber/codemod/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
23
26
|
stubber/codemod/_partials/__init__.py,sha256=LVJ-QkEKlc5IqOZ-bYrNXWRd9J5eolsTR_kRTyS9p6w,1430
|
24
|
-
stubber/codemod/_partials/db_main.py,sha256=
|
27
|
+
stubber/codemod/_partials/db_main.py,sha256=w4RF6s1T75EwN6-RFmdBP0uhWD-e1W1EZDBbmyoZex0,4021
|
25
28
|
stubber/codemod/_partials/lvgl_main.py,sha256=9BAJP6P1R2SQVbNya2ujes35eATa56D_Ri2_PjeRBq0,1964
|
26
29
|
stubber/codemod/_partials/modules_reader.py,sha256=dJj-H0ncUWVtilSyohQ-dyiUZOjQObds_-llwy_LkYU,2046
|
27
30
|
stubber/codemod/add_comment.py,sha256=CZMjtKO9aarZo1E60QXo80CLJAH05z_ylK6Vvjvb0ls,1965
|
28
31
|
stubber/codemod/add_method.py,sha256=fZH-RGi_pzFpi3tF_0AMDbA9A94dlgXMrc3ItpY3Ylw,2609
|
29
32
|
stubber/codemod/board.py,sha256=dP24t9RO_klQZS7Yqiwt7Rh85B76s6GC2r4B7tVzEn0,11882
|
30
33
|
stubber/codemod/enrich.py,sha256=YB-tXo_UjeVboG2uPAG8d1g81STdhWL4NvCfZ6YPduk,12928
|
31
|
-
stubber/codemod/merge_docstub.py,sha256=
|
34
|
+
stubber/codemod/merge_docstub.py,sha256=XTvsw4BetCRU1-dJlQisVdDx03ldBh7Yc7aREmLiJPs,27956
|
32
35
|
stubber/codemod/modify_list.py,sha256=xrpFBKug273D9E02owUheZD418BvsIHIZCFj4YDjTxU,2118
|
33
36
|
stubber/codemod/utils.py,sha256=3hk7pwyS4KZxewrWLwbOrdA5ympbum-kfL0ZN-M7rlo,2459
|
34
37
|
stubber/codemod/visitors/type_helpers.py,sha256=UdYKsKDTqzHmPNBuWK1lY0sboXrm7RIY0B4FHLtWo3s,10572
|
35
38
|
stubber/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
36
39
|
stubber/commands/build_cmd.py,sha256=Zseci4EHxJuiiy7YS-ucmMokDrVLe4j6fPs-PSbwq1k,2813
|
37
40
|
stubber/commands/cli.py,sha256=HY4CqB0PPTmzew2sABNsHeNKDPblcGzzbmvtF46oVsU,1556
|
38
|
-
stubber/commands/clone_cmd.py,sha256=
|
41
|
+
stubber/commands/clone_cmd.py,sha256=WZnQIqsnkdddXz32riLUw9zhNXHAgk_LODnwbtQlpbo,2714
|
39
42
|
stubber/commands/config_cmd.py,sha256=e8heX27MXfazLxMVtgjK4dsLCWhsoCfdeYGVoH3rqtA,1211
|
40
43
|
stubber/commands/enrich_folder_cmd.py,sha256=LDdSAfDlsAQAddYT9Rp3bFiF6maqA457AmMyWNXdXtg,2236
|
41
|
-
stubber/commands/get_core_cmd.py,sha256=
|
42
|
-
stubber/commands/get_docstubs_cmd.py,sha256=
|
43
|
-
stubber/commands/get_frozen_cmd.py,sha256=
|
44
|
+
stubber/commands/get_core_cmd.py,sha256=PSjBJz4F8FlT3c_4E-XFo6Xw0dRQzQl0TxsxCoLwIPY,2324
|
45
|
+
stubber/commands/get_docstubs_cmd.py,sha256=04h41BCQxXtvm193jJTj0VEaxJWgvk7SZFJMU4DTt7M,5180
|
46
|
+
stubber/commands/get_frozen_cmd.py,sha256=gutYwHdz7XO8CLxutEFiQOUGgKInrKViEKvV8I5eVJU,4253
|
44
47
|
stubber/commands/get_mcu_cmd.py,sha256=CTQVIoGqBx6gwUp1aH1gOysVFEZbeqMvpPb2WJA4EVQ,2807
|
45
48
|
stubber/commands/merge_cmd.py,sha256=0tKgvBiYjleXac0z5vDMxzvAgiZQUF0DafPqoIueKS8,1641
|
46
49
|
stubber/commands/publish_cmd.py,sha256=eo052T3k0YW6m0gJJ3hoZbchd0whMr74z3MudHKthIQ,3275
|
47
|
-
stubber/commands/stub_cmd.py,sha256=
|
50
|
+
stubber/commands/stub_cmd.py,sha256=BJZwpjTQjNEtrBjtUZmvmVb96LuSmg0rwQfgQ3ghHrg,1217
|
48
51
|
stubber/commands/switch_cmd.py,sha256=yeK9rNkIl8WicheUGHnK5u7YrV5iR1KBEILVUfbOQtA,1866
|
49
52
|
stubber/commands/variants_cmd.py,sha256=Q7DjPElEfSHhDxAlvtiGHWv9e47QPSLYMIs0ScfI7AA,1296
|
50
53
|
stubber/data/board_info.csv,sha256=K2VSmfR013fN-oJWkQUmiQ19w09dVwJHDquPy6QmMhY,8627
|
@@ -84,24 +87,24 @@ stubber/rst/reader.py,sha256=sNZwEpSG8esBrPvD-gVjtku828XfLNst-earA3XBN1c,35426
|
|
84
87
|
stubber/rst/report_return.py,sha256=p0JfJs_WTWTtRZREcQeqUgDW-_TP2VuuX7k7-c49y5E,3024
|
85
88
|
stubber/rst/rst_utils.py,sha256=-F6J09-WQBzI5419ItzOlm4gUKxF4BMru2OyXx-M6ko,18314
|
86
89
|
stubber/stubber.py,sha256=GxLfHIzDyfFvgiTqMj9DB3tq7I3EnEUNbdoCtYr8gHM,1640
|
87
|
-
stubber/stubs_from_docs.py,sha256=
|
90
|
+
stubber/stubs_from_docs.py,sha256=c19yVRAu7Kv0Vlpoa15obGIzhekisJuIyYwX1lug6-c,3563
|
88
91
|
stubber/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
89
92
|
stubber/tools/manifestfile.py,sha256=YzPMc7PNciLOBpoc4xgUZ38t88C1C8b4fjG0qfWd6K8,25749
|
90
93
|
stubber/tools/readme.md,sha256=uI0higcFUtjSLKobn7NK2LoqZ0BqcbftXSDgNjbsnzo,284
|
91
|
-
stubber/typing_collector.py,sha256=
|
94
|
+
stubber/typing_collector.py,sha256=c3e3sX-q-xg8q-DAoNl7Yi6qMnMH9I2RCv37c-wkzXs,9510
|
92
95
|
stubber/update_fallback.py,sha256=mFxFvcLWl-5IX9BdRuo_WMa538Wtomo2sE14jKbW7-0,4913
|
93
96
|
stubber/update_module_list.py,sha256=OEAOnFxB8Ywakw0pxiiTrIplWmoJ9r3Cdn07EpVDmNY,4038
|
94
97
|
stubber/utils/__init__.py,sha256=73LiuTInDABhDhnDixU8ojlkVUjR5e3Uv8QNaeBMG0E,234
|
95
98
|
stubber/utils/config.py,sha256=wPmSSut9PWjLFzr_8jj7IwkrVsL4mq17X8DGOeRqXGw,5544
|
96
99
|
stubber/utils/makeversionhdr.py,sha256=dO8sWLAY_ifT1IJJ1-JJ2z_thvfqJnK3c1_bHF_UI28,1953
|
97
100
|
stubber/utils/manifest.py,sha256=KEeFwVCke2XlUv8-g9S10DaoHzISZDxZn0G4LrHn2vA,3239
|
98
|
-
stubber/utils/post.py,sha256=
|
99
|
-
stubber/utils/repos.py,sha256=
|
100
|
-
stubber/utils/stubmaker.py,sha256=
|
101
|
+
stubber/utils/post.py,sha256=1yv5RNQnvHbgTGJ97nYFAh7imzg8NUtyPRDqQMqE3jo,2928
|
102
|
+
stubber/utils/repos.py,sha256=kI2VcbKS1sNzFRr8mUDMdKYOYRvxpFIwy7JRyQ5Nxuk,7147
|
103
|
+
stubber/utils/stubmaker.py,sha256=gB6n41o13WcShnSzc_lyoTFplotaPSQ3hekoLJvd2BU,5236
|
101
104
|
stubber/utils/typed_config_toml.py,sha256=ZR7eo-whyL4nhFXj6xs7E121sLuE-ivlUDevII4K2xg,2653
|
102
105
|
stubber/variants.py,sha256=NnwUP-aiGUPAn15BeRRFcBWQUOzAFFnN2oL4u9zio-s,3792
|
103
|
-
micropython_stubber-1.
|
104
|
-
micropython_stubber-1.
|
105
|
-
micropython_stubber-1.
|
106
|
-
micropython_stubber-1.
|
107
|
-
micropython_stubber-1.
|
106
|
+
micropython_stubber-1.25.0.post1.dist-info/entry_points.txt,sha256=JoR8NWh8t6pbDyn0WOMCIfRfDQAOGxqbOgJWuxv3Cxw,116
|
107
|
+
micropython_stubber-1.25.0.post1.dist-info/LICENSE,sha256=Fx9qrL45ayRXgH6QzttboqZEjKXms0w1t_b_nkOqYCU,1572
|
108
|
+
micropython_stubber-1.25.0.post1.dist-info/METADATA,sha256=d1eFvb-pYR0v0yNKdiVj7FwzSRryX5zzHRl6d8OwdU8,19978
|
109
|
+
micropython_stubber-1.25.0.post1.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
110
|
+
micropython_stubber-1.25.0.post1.dist-info/RECORD,,
|
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.
|
27
|
+
__version__ = "v1.25.0"
|
28
28
|
ENOENT = 2 # on most ports
|
29
29
|
ENOMESSAGE = 44 # on pyscript
|
30
30
|
_MAX_CLASS_LEVEL = 2 # Max class nesting
|
@@ -82,12 +82,13 @@ class Stubber:
|
|
82
82
|
self.info = _info()
|
83
83
|
log.info("Port: {}".format(self.info["port"]))
|
84
84
|
log.info("Board: {}".format(self.info["board"]))
|
85
|
+
log.info("Board_ID: {}".format(self.info["board_id"]))
|
85
86
|
gc.collect()
|
86
87
|
if firmware_id:
|
87
88
|
self._fwid = firmware_id.lower()
|
88
89
|
else:
|
89
90
|
if self.info["family"] == "micropython":
|
90
|
-
self._fwid = "{family}-v{version}-{port}-{
|
91
|
+
self._fwid = "{family}-v{version}-{port}-{board_id}".format(**self.info).rstrip("-")
|
91
92
|
else:
|
92
93
|
self._fwid = "{family}-v{version}-{port}".format(**self.info)
|
93
94
|
self._start_free = gc.mem_free() # type: ignore
|
@@ -545,6 +546,8 @@ def _info(): # type:() -> dict[str, str]
|
|
545
546
|
"ver": "",
|
546
547
|
"port": sys.platform, # port: esp32 / win32 / linux / stm32
|
547
548
|
"board": "UNKNOWN",
|
549
|
+
"board_id": "",
|
550
|
+
"variant": "",
|
548
551
|
"cpu": "",
|
549
552
|
"mpy": "",
|
550
553
|
"arch": "",
|
@@ -565,8 +568,12 @@ def _info(): # type:() -> dict[str, str]
|
|
565
568
|
_machine = (
|
566
569
|
sys.implementation._machine if "_machine" in dir(sys.implementation) else os.uname().machine # type: ignore
|
567
570
|
)
|
568
|
-
|
569
|
-
|
571
|
+
info["board"] = _machine.strip()
|
572
|
+
si_build = sys.implementation._build if "_build" in dir(sys.implementation) else ""
|
573
|
+
if si_build:
|
574
|
+
info["board"] = si_build.split("-")[0]
|
575
|
+
info["variant"] = si_build.split("-")[1] if "-" in si_build else ""
|
576
|
+
info["board_id"] = si_build
|
570
577
|
info["cpu"] = _machine.split("with")[-1].strip()
|
571
578
|
info["mpy"] = (
|
572
579
|
sys.implementation._mpy # type: ignore
|
@@ -575,7 +582,8 @@ def _info(): # type:() -> dict[str, str]
|
|
575
582
|
)
|
576
583
|
except (AttributeError, IndexError):
|
577
584
|
pass
|
578
|
-
info["
|
585
|
+
if not info["board_id"]:
|
586
|
+
get_boardname(info)
|
579
587
|
|
580
588
|
try:
|
581
589
|
if "uname" in dir(os): # old
|
@@ -668,16 +676,18 @@ def version_str(version: tuple): # -> str:
|
|
668
676
|
return v_str
|
669
677
|
|
670
678
|
|
671
|
-
def get_boardname() -> str:
|
672
|
-
"Read the
|
679
|
+
def get_boardname(info: dict) -> str:
|
680
|
+
"Read the board_id from the boardname.py file that may have been created upfront"
|
673
681
|
try:
|
674
|
-
from boardname import
|
682
|
+
from boardname import BOARD_ID # type: ignore
|
675
683
|
|
676
|
-
log.info("Found
|
684
|
+
log.info("Found BOARD_ID: {}".format(BOARD_ID))
|
677
685
|
except ImportError:
|
678
|
-
log.warning("
|
679
|
-
|
680
|
-
|
686
|
+
log.warning("BOARD_ID not found")
|
687
|
+
BOARD_ID = ""
|
688
|
+
info["board_id"] = BOARD_ID
|
689
|
+
info["board"] = BOARD_ID.split("-")[0] if "-" in BOARD_ID else BOARD_ID
|
690
|
+
info["variant"] == BOARD_ID.split("-")[1] if "-" in BOARD_ID else ""
|
681
691
|
|
682
692
|
|
683
693
|
def get_root() -> str: # sourcery skip: use-assigned-variable
|
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.24.
|
21
|
+
This variant was generated from createstubs.py by micropython-stubber v1.24.4
|
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.
|
46
|
+
__version__ = "v1.25.0"
|
47
47
|
ENOENT = 2 # on most ports
|
48
48
|
ENOMESSAGE = 44 # on pyscript
|
49
49
|
_MAX_CLASS_LEVEL = 2 # Max class nesting
|
@@ -101,12 +101,13 @@ class Stubber:
|
|
101
101
|
self.info = _info()
|
102
102
|
log.info("Port: {}".format(self.info["port"]))
|
103
103
|
log.info("Board: {}".format(self.info["board"]))
|
104
|
+
log.info("Board_ID: {}".format(self.info["board_id"]))
|
104
105
|
gc.collect()
|
105
106
|
if firmware_id:
|
106
107
|
self._fwid = firmware_id.lower()
|
107
108
|
else:
|
108
109
|
if self.info["family"] == "micropython":
|
109
|
-
self._fwid = "{family}-v{version}-{port}-{
|
110
|
+
self._fwid = "{family}-v{version}-{port}-{board_id}".format(**self.info).rstrip("-")
|
110
111
|
else:
|
111
112
|
self._fwid = "{family}-v{version}-{port}".format(**self.info)
|
112
113
|
self._start_free = gc.mem_free() # type: ignore
|
@@ -541,6 +542,8 @@ def _info(): # type:() -> dict[str, str]
|
|
541
542
|
"ver": "",
|
542
543
|
"port": sys.platform, # port: esp32 / win32 / linux / stm32
|
543
544
|
"board": "UNKNOWN",
|
545
|
+
"board_id": "",
|
546
|
+
"variant": "",
|
544
547
|
"cpu": "",
|
545
548
|
"mpy": "",
|
546
549
|
"arch": "",
|
@@ -559,8 +562,12 @@ def _info(): # type:() -> dict[str, str]
|
|
559
562
|
pass
|
560
563
|
try:
|
561
564
|
_machine = sys.implementation._machine if "_machine" in dir(sys.implementation) else os.uname().machine # type: ignore
|
562
|
-
|
563
|
-
|
565
|
+
info["board"] = _machine.strip()
|
566
|
+
si_build = sys.implementation._build if "_build" in dir(sys.implementation) else ""
|
567
|
+
if si_build:
|
568
|
+
info["board"] = si_build.split("-")[0]
|
569
|
+
info["variant"] = si_build.split("-")[1] if "-" in si_build else ""
|
570
|
+
info["board_id"] = si_build
|
564
571
|
info["cpu"] = _machine.split("with")[-1].strip()
|
565
572
|
info["mpy"] = (
|
566
573
|
sys.implementation._mpy # type: ignore
|
@@ -569,7 +576,8 @@ def _info(): # type:() -> dict[str, str]
|
|
569
576
|
)
|
570
577
|
except (AttributeError, IndexError):
|
571
578
|
pass
|
572
|
-
info["
|
579
|
+
if not info["board_id"]:
|
580
|
+
get_boardname(info)
|
573
581
|
|
574
582
|
try:
|
575
583
|
if "uname" in dir(os): # old
|
@@ -661,16 +669,18 @@ def version_str(version: tuple): # -> str:
|
|
661
669
|
return v_str
|
662
670
|
|
663
671
|
|
664
|
-
def get_boardname() -> str:
|
665
|
-
"Read the
|
672
|
+
def get_boardname(info: dict) -> str:
|
673
|
+
"Read the board_id from the boardname.py file that may have been created upfront"
|
666
674
|
try:
|
667
|
-
from boardname import
|
675
|
+
from boardname import BOARD_ID # type: ignore
|
668
676
|
|
669
|
-
log.info("Found
|
677
|
+
log.info("Found BOARD_ID: {}".format(BOARD_ID))
|
670
678
|
except ImportError:
|
671
|
-
log.warning("
|
672
|
-
|
673
|
-
|
679
|
+
log.warning("BOARD_ID not found")
|
680
|
+
BOARD_ID = ""
|
681
|
+
info["board_id"] = BOARD_ID
|
682
|
+
info["board"] = BOARD_ID.split("-")[0] if "-" in BOARD_ID else BOARD_ID
|
683
|
+
info["variant"] == BOARD_ID.split("-")[1] if "-" in BOARD_ID else ""
|
674
684
|
|
675
685
|
|
676
686
|
def get_root() -> str: # sourcery skip: use-assigned-variable
|
@@ -746,7 +756,7 @@ def get_modules(skip=0):
|
|
746
756
|
if not file_exists(fname):
|
747
757
|
continue
|
748
758
|
try:
|
749
|
-
with open(fname) as f:
|
759
|
+
with open(fname, encoding="utf-8") as f:
|
750
760
|
i = 0
|
751
761
|
while True:
|
752
762
|
line = f.readline().strip()
|