micropython-stubber 1.23.2__py3-none-any.whl → 1.23.3__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.2.dist-info → micropython_stubber-1.23.3.dist-info}/METADATA +3 -3
- {micropython_stubber-1.23.2.dist-info → micropython_stubber-1.23.3.dist-info}/RECORD +25 -25
- mpflash/mpflash/basicgit.py +27 -7
- mpflash/mpflash/common.py +2 -5
- mpflash/mpflash/mpboard_id/store.py +8 -3
- mpflash/mpflash/mpremoteboard/mpy_fw_info.py +27 -16
- mpflash/poetry.lock +576 -488
- mpflash/pyproject.toml +1 -1
- stubber/__init__.py +1 -1
- stubber/board/createstubs.py +17 -35
- stubber/board/createstubs_db.py +7 -8
- stubber/board/createstubs_db_min.py +116 -117
- stubber/board/createstubs_db_mpy.mpy +0 -0
- stubber/board/createstubs_mem.py +7 -8
- stubber/board/createstubs_mem_min.py +104 -105
- stubber/board/createstubs_mem_mpy.mpy +0 -0
- stubber/board/createstubs_min.py +116 -117
- stubber/board/createstubs_mpy.mpy +0 -0
- stubber/codemod/enrich.py +0 -6
- stubber/publish/merge_docstubs.py +4 -8
- stubber/publish/stubpackage.py +4 -8
- stubber/rst/lookup.py +0 -2
- {micropython_stubber-1.23.2.dist-info → micropython_stubber-1.23.3.dist-info}/LICENSE +0 -0
- {micropython_stubber-1.23.2.dist-info → micropython_stubber-1.23.3.dist-info}/WHEEL +0 -0
- {micropython_stubber-1.23.2.dist-info → micropython_stubber-1.23.3.dist-info}/entry_points.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: micropython-stubber
|
3
|
-
Version: 1.23.
|
3
|
+
Version: 1.23.3
|
4
4
|
Summary: Tooling to create and maintain stubs for MicroPython
|
5
5
|
Home-page: https://github.com/Josverl/micropython-stubber#readme
|
6
6
|
License: MIT
|
@@ -26,7 +26,7 @@ Requires-Dist: executing (>=2.0.1,<3.0.0)
|
|
26
26
|
Requires-Dist: importlib-metadata (>=1,<9) ; python_version < "3.8"
|
27
27
|
Requires-Dist: libcst (>=1.1.0,<2.0.0)
|
28
28
|
Requires-Dist: loguru (>=0.6,<0.8)
|
29
|
-
Requires-Dist: mpflash (>=1.0.
|
29
|
+
Requires-Dist: mpflash (>=1.0.5,<2.0.0)
|
30
30
|
Requires-Dist: mpremote (>=1.23.0,<2.0.0)
|
31
31
|
Requires-Dist: mypy (==1.10.1)
|
32
32
|
Requires-Dist: mypy-gitlab-code-quality (>=1.1.0,<2.0.0)
|
@@ -37,7 +37,7 @@ Requires-Dist: pypi-simple (>=1.0.0,<2.0.0)
|
|
37
37
|
Requires-Dist: pyright (>=1.1.341,<2.0.0)
|
38
38
|
Requires-Dist: pyserial (>=3.5,<4.0)
|
39
39
|
Requires-Dist: pysondb-v2 (>=2.1.0,<3.0.0)
|
40
|
-
Requires-Dist: python-minifier (>=2.7.0,<3.0.0) ; python_version < "3.
|
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
43
|
Requires-Dist: tabulate (>=0.9.0,<0.10.0)
|
@@ -2,7 +2,7 @@ mpflash/libusb_flash.ipynb,sha256=7RGtGg1mPPMWrfJOobOfYYwAAhsFpykpTJtfNwevY9o,66
|
|
2
2
|
mpflash/mpflash/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
3
|
mpflash/mpflash/add_firmware.py,sha256=1h0HsA-EVi3HXLmoEvzwY_a-GuWYzPwulTYHHBB8THg,3428
|
4
4
|
mpflash/mpflash/ask_input.py,sha256=RJHGGrhYniSu-bdoKnKptE3DtpiCREJGRTZmFazvG-E,8946
|
5
|
-
mpflash/mpflash/basicgit.py,sha256=
|
5
|
+
mpflash/mpflash/basicgit.py,sha256=6dKexwx844R55q6X39ZDCF4HDB3t94OHyDJuuicZvjw,9959
|
6
6
|
mpflash/mpflash/bootloader/__init__.py,sha256=Qy3E6tETPnzMga9LgD5UgOvJ0zZIBEqhtEVb4v8CTWQ,107
|
7
7
|
mpflash/mpflash/bootloader/activate.py,sha256=FlO4XQlKyoOuvmDdj_0u_mjNPhjGwB_K17jQ-8nSXRA,2361
|
8
8
|
mpflash/mpflash/bootloader/detect.py,sha256=fBrILi7-ICRaregqms3PYqwiQVAJC0rXVhpyzDkoPQI,2690
|
@@ -14,7 +14,7 @@ mpflash/mpflash/cli_flash.py,sha256=pVqEsDocDT3KmIMTpXdym-ZlzThLSIp6oVtYib65dys,
|
|
14
14
|
mpflash/mpflash/cli_group.py,sha256=VWwYHiPVV19sQEr5lL8LlcPyZ-A6Gs79eMDJy8LLt90,2615
|
15
15
|
mpflash/mpflash/cli_list.py,sha256=ja21AZ4yghGTtOHkEtV1EOmT6EYxOiU2gzJc-mZaDto,2427
|
16
16
|
mpflash/mpflash/cli_main.py,sha256=5EkvzsqOUDXvNaW814oSUcPWeNhnwh78Sg0MteDv_fk,1133
|
17
|
-
mpflash/mpflash/common.py,sha256=
|
17
|
+
mpflash/mpflash/common.py,sha256=dyVpCUzBnL1GLbTDHND-C9w6oMmj3fl2oW_cO3zXn3Q,7376
|
18
18
|
mpflash/mpflash/config.py,sha256=tdpvAvAlpco1GfeG2evn5tAKYluLEanqwrrvkir7QcQ,1073
|
19
19
|
mpflash/mpflash/connected.py,sha256=woYhuXoWpfzRMDUpBLVQZbVTGtMsKWNd5z1rsR1ELXA,3578
|
20
20
|
mpflash/mpflash/download.py,sha256=wE4uBSFFMAKOBH4jwHweL0wVYh4vi74t1673ku_IeoA,14305
|
@@ -38,34 +38,34 @@ mpflash/mpflash/mpboard_id/add_boards.py,sha256=47TtN98FVc6PvuOr-3-g3LacYW8JvXpM
|
|
38
38
|
mpflash/mpflash/mpboard_id/board.py,sha256=CwtBux8y7GDUe7CADVxL8YefGRl9Fg8OAJBUhgaBYCI,1151
|
39
39
|
mpflash/mpflash/mpboard_id/board_id.py,sha256=3Qeo9cQOfn6EQ0gr5MHsl0Nk7is_piYrz0mMbV2LC-Q,2957
|
40
40
|
mpflash/mpflash/mpboard_id/board_info.zip,sha256=F6YowS96DAqjten4ySe4MXgZwPtE-saZOUfY5OQkqKk,19759
|
41
|
-
mpflash/mpflash/mpboard_id/store.py,sha256=
|
41
|
+
mpflash/mpflash/mpboard_id/store.py,sha256=n85vnUAxGKv1C23wkm22ZFAFGK6AZZiCFvc1lGJJjis,1703
|
42
42
|
mpflash/mpflash/mpremoteboard/__init__.py,sha256=3F6vZHM1znUOnAo0ne-FalApM6vwbTNYg4kJwkS1gNI,9521
|
43
|
-
mpflash/mpflash/mpremoteboard/mpy_fw_info.py,sha256=
|
43
|
+
mpflash/mpflash/mpremoteboard/mpy_fw_info.py,sha256=eRjhqN7MpmYE9TiS4iukquZZs3QE_lD5zv_vOPSjNrk,4821
|
44
44
|
mpflash/mpflash/mpremoteboard/runner.py,sha256=-PgzAeBGbyXaAUlwyiw4mcINsP2U1XRRjP1_QdBrxpg,4786
|
45
45
|
mpflash/mpflash/vendor/click_aliases.py,sha256=c853EHSlkE2DvFqeFvFpwXKuJj3_jsXDP7iotVOKaAw,3156
|
46
46
|
mpflash/mpflash/vendor/dfu.py,sha256=ZXMcE6aH4-43Wh4tbQT4U-q-BU3RUiL3JAxmP_QAK2s,5755
|
47
47
|
mpflash/mpflash/vendor/pydfu.py,sha256=_MdBRo1EeNeKDqFPSTB5tNL1jGSBJgsVeVjE5e7Pb8s,20542
|
48
48
|
mpflash/mpflash/vendor/readme.md,sha256=iIIZxuLUIGHQ0KODzYVtMezsztvyxCXcNJp_AzwTIPk,86
|
49
49
|
mpflash/mpflash/versions.py,sha256=EZtIe2RdBobhZaRIN7I-zZVNJ38CD_H8s3W8gXX9-IY,4627
|
50
|
-
mpflash/poetry.lock,sha256=
|
51
|
-
mpflash/pyproject.toml,sha256=
|
50
|
+
mpflash/poetry.lock,sha256=zOLAtagNYGcgRSE2aWBoL3l1LTslG7rqfQz7oruZvFI,131499
|
51
|
+
mpflash/pyproject.toml,sha256=k_JU0rtCWuyLhGYSwHjHyIz0SO48ErkT9jDP0QeUrzA,1760
|
52
52
|
mpflash/README.md,sha256=YnLwTC0U1o_k_V927SZlzBLQfe-YVazl_WL-DU2_DaQ,16044
|
53
53
|
mpflash/stm32_udev_rules.md,sha256=uxvC8FvU7K0R1QQUqCIvVfW9yfWYlIHhIVtirAjQVHE,2684
|
54
|
-
stubber/__init__.py,sha256=
|
54
|
+
stubber/__init__.py,sha256=ypu8seItScO6IJbfUEi99Fk8HGltlWLutElb_jfqPBY,49
|
55
55
|
stubber/board/board_info.csv,sha256=K2VSmfR013fN-oJWkQUmiQ19w09dVwJHDquPy6QmMhY,8627
|
56
56
|
stubber/board/boot.py,sha256=XjWlKErU5nI1HJSugXIP_3hlwgRQboE6sJrpcbSygnk,1120
|
57
|
-
stubber/board/createstubs.py,sha256=
|
58
|
-
stubber/board/createstubs_db.py,sha256=
|
59
|
-
stubber/board/createstubs_db_min.py,sha256=
|
60
|
-
stubber/board/createstubs_db_mpy.mpy,sha256=
|
57
|
+
stubber/board/createstubs.py,sha256=7UsDfpOm_lIN4KSJiMrpvQItqJMX77pi5FEbPSGgLPk,32922
|
58
|
+
stubber/board/createstubs_db.py,sha256=3wjypz4bbPAoik4gzabRJXZfVRCiM5_z4BpifpZhlLw,30383
|
59
|
+
stubber/board/createstubs_db_min.py,sha256=lDSOaw3HjKjh0ASmHtRnXX_HzX3RBituCMl2sTBj9lE,11473
|
60
|
+
stubber/board/createstubs_db_mpy.mpy,sha256=oHZUyh-iTIzMN_hUFyDauX8WL8ghj-YKFpTfOQRReDM,9536
|
61
61
|
stubber/board/createstubs_lvgl.py,sha256=CTe7eq1ACRK_JJxavaqDD8znn29nSWJiHHTZ_ps6EhM,27217
|
62
62
|
stubber/board/createstubs_lvgl_min.py,sha256=jLkWYmeboI2A8feMC7pT7cYWttLejQTuX7WAEZCylhw,27207
|
63
63
|
stubber/board/createstubs_lvgl_mpy.mpy,sha256=ex-nlq2V5e8anQBJvRWEEc-FzU7nlwg5NSrZ8vOadIA,9267
|
64
|
-
stubber/board/createstubs_mem.py,sha256=
|
65
|
-
stubber/board/createstubs_mem_min.py,sha256=
|
66
|
-
stubber/board/createstubs_mem_mpy.mpy,sha256=
|
67
|
-
stubber/board/createstubs_min.py,sha256=
|
68
|
-
stubber/board/createstubs_mpy.mpy,sha256=
|
64
|
+
stubber/board/createstubs_mem.py,sha256=pFNbemccszMc8NgMi0SGdbut5_mi74tzGNSBQVCMs18,28719
|
65
|
+
stubber/board/createstubs_mem_min.py,sha256=QOcaEsq6D60sYYyJHKrQK90zuPZ3duvh1xztseP9rLE,11019
|
66
|
+
stubber/board/createstubs_mem_mpy.mpy,sha256=QpuonHENnSzxDYQTOhxo9f8D8YV84KlzSLzjzUh9AOI,9118
|
67
|
+
stubber/board/createstubs_min.py,sha256=XlZCYZxhW7g428CJzj8u8ZYUjFI70fW0OIWPNZjdv2U,13699
|
68
|
+
stubber/board/createstubs_mpy.mpy,sha256=Nj0rwiGFEkCiaQcs-AiYcDp3NvPY2Hr-1xPRBBf9HwM,12388
|
69
69
|
stubber/board/fw_info.py,sha256=6AQbN3jtQgllqWQYl4e-63KeEtV08EXk8_JnM6XBkvo,4554
|
70
70
|
stubber/board/info.py,sha256=b7SOPZHVsVhaayKCwVkFZlYu0BW-UFI7LuG1Eop9480,5629
|
71
71
|
stubber/board/main.py,sha256=f6V3tdt6sPZVLuwemT-NLuK9GySfW2c2J6PJMOOWQQw,413
|
@@ -80,7 +80,7 @@ stubber/codemod/_partials/modules_reader.py,sha256=dJj-H0ncUWVtilSyohQ-dyiUZOjQO
|
|
80
80
|
stubber/codemod/add_comment.py,sha256=CZMjtKO9aarZo1E60QXo80CLJAH05z_ylK6Vvjvb0ls,1965
|
81
81
|
stubber/codemod/add_method.py,sha256=fZH-RGi_pzFpi3tF_0AMDbA9A94dlgXMrc3ItpY3Ylw,2609
|
82
82
|
stubber/codemod/board.py,sha256=HDNS8saQIdoPH74MNG9mte0MRBqCOcy3d6f_I0H9J2I,11881
|
83
|
-
stubber/codemod/enrich.py,sha256=
|
83
|
+
stubber/codemod/enrich.py,sha256=Qh-Yb4Rkfu6XX91kFkhSnwJsmqXDxpMmsffzDmGQx4E,5436
|
84
84
|
stubber/codemod/merge_docstub.py,sha256=rPTQGYQY-nPIhKxkEnnS77kIaZsmfW5TZ5f-mvpToj0,12679
|
85
85
|
stubber/codemod/modify_list.py,sha256=xrpFBKug273D9E02owUheZD418BvsIHIZCFj4YDjTxU,2118
|
86
86
|
stubber/codemod/utils.py,sha256=3hk7pwyS4KZxewrWLwbOrdA5ympbum-kfL0ZN-M7rlo,2459
|
@@ -121,16 +121,16 @@ stubber/publish/database.py,sha256=CLy5oiLasA-YzTTXi9d01qLAyk7NpugCDUOa5R9Ac2g,6
|
|
121
121
|
stubber/publish/defaults.py,sha256=naAyHN_k8OFQfqRnXlPU3HNA0IZll-NA5GuJEvDEG_k,1532
|
122
122
|
stubber/publish/enums.py,sha256=Z_x798ArtxyjQIRRY43GDGNB9BD4uPfpeGsXYdj31w0,780
|
123
123
|
stubber/publish/helpers.py,sha256=909umfKUHBMBoVnAanop1vKx8loCrWntlfiiG6z89lY,716
|
124
|
-
stubber/publish/merge_docstubs.py,sha256=
|
124
|
+
stubber/publish/merge_docstubs.py,sha256=M0QoJ9sUsgXH9FXPIvqX3v8mbqzHQY8uFXNdZZY0vZ8,5349
|
125
125
|
stubber/publish/missing_class_methods.py,sha256=2ZbUsH57NkwAPk4vI8H3VVIFPz5O7kmVewybShvPbL0,1833
|
126
126
|
stubber/publish/package.py,sha256=-6Q4cBzISAHngHXDloLzVMSC2qTCCuMH_Xa9hSYRi0E,5290
|
127
127
|
stubber/publish/pathnames.py,sha256=vORgygaOJJAjlI3cLhNTHfowdewSDsv7zck5evPe1cY,1803
|
128
128
|
stubber/publish/publish.py,sha256=EwniPNZc1VHsfIGtcVG_UxM6pOg0W1uaPIDOI8V1a74,3945
|
129
129
|
stubber/publish/pypi.py,sha256=LdvwLfjkkSFBTI4MHyl7Ko_ZWn1SflWxJ9uo2mtPKtc,1272
|
130
|
-
stubber/publish/stubpackage.py,sha256=
|
130
|
+
stubber/publish/stubpackage.py,sha256=jZ92mI68uergqSoOL26Ka3dqN0QD8Csx256INM6qqWY,45111
|
131
131
|
stubber/rst/__init__.py,sha256=5VcbDCotIICa2xnJDs_gw2sFXpjjGOZZbwCrNKXy1OE,293
|
132
132
|
stubber/rst/classsort.py,sha256=-Uji6LzBbX6voKmiXSuexJXyoQ3fmSDQ7Fuz4j1Kk8E,2655
|
133
|
-
stubber/rst/lookup.py,sha256=
|
133
|
+
stubber/rst/lookup.py,sha256=_8dhAuybPC-Pt9R6hrzR1Rxck-bAsak4lvagRsTFAAo,20281
|
134
134
|
stubber/rst/output_dict.py,sha256=cpBXRtUD-uh0EgjWIBiRrMLBmIAEXjoJFSOAg-qJQiU,14755
|
135
135
|
stubber/rst/reader.py,sha256=b-yAN-OjCkBZUY1FYICXckO4m81zrr5jMqX1eatITck,33609
|
136
136
|
stubber/rst/report_return.py,sha256=p0JfJs_WTWTtRZREcQeqUgDW-_TP2VuuX7k7-c49y5E,3024
|
@@ -151,8 +151,8 @@ stubber/utils/repos.py,sha256=piUZwtHBXXJ-XPhvw_qXYqO-fy1ktZsb9-7CAwNo2YQ,5896
|
|
151
151
|
stubber/utils/stubmaker.py,sha256=pO8Bo9JuHo6eeJGJz4hO2PzVJojNYFdJPdVtlgjKkBI,5236
|
152
152
|
stubber/utils/typed_config_toml.py,sha256=ZR7eo-whyL4nhFXj6xs7E121sLuE-ivlUDevII4K2xg,2653
|
153
153
|
stubber/variants.py,sha256=NnwUP-aiGUPAn15BeRRFcBWQUOzAFFnN2oL4u9zio-s,3792
|
154
|
-
micropython_stubber-1.23.
|
155
|
-
micropython_stubber-1.23.
|
156
|
-
micropython_stubber-1.23.
|
157
|
-
micropython_stubber-1.23.
|
158
|
-
micropython_stubber-1.23.
|
154
|
+
micropython_stubber-1.23.3.dist-info/entry_points.txt,sha256=JoR8NWh8t6pbDyn0WOMCIfRfDQAOGxqbOgJWuxv3Cxw,116
|
155
|
+
micropython_stubber-1.23.3.dist-info/LICENSE,sha256=Fx9qrL45ayRXgH6QzttboqZEjKXms0w1t_b_nkOqYCU,1572
|
156
|
+
micropython_stubber-1.23.3.dist-info/METADATA,sha256=zBAoZ9f6jJbauGM-6tXtasJV_DWRnN_9uYc8J8C21BA,23887
|
157
|
+
micropython_stubber-1.23.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
158
|
+
micropython_stubber-1.23.3.dist-info/RECORD,,
|
mpflash/mpflash/basicgit.py
CHANGED
@@ -10,7 +10,7 @@ from pathlib import Path
|
|
10
10
|
from typing import List, Optional, Union
|
11
11
|
|
12
12
|
import cachetools.func
|
13
|
-
from github import Auth, Github
|
13
|
+
from github import Auth, BadCredentialsException, Github
|
14
14
|
from loguru import logger as log
|
15
15
|
from packaging.version import parse
|
16
16
|
|
@@ -18,7 +18,11 @@ from packaging.version import parse
|
|
18
18
|
|
19
19
|
# Token with no permissions to avoid throttling
|
20
20
|
# https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28#getting-a-higher-rate-limit
|
21
|
-
PAT_NO_ACCESS =
|
21
|
+
PAT_NO_ACCESS = (
|
22
|
+
"github_pat_"
|
23
|
+
+ "11AAHPVFQ0G4NTaQ73Bw5J"
|
24
|
+
+ "_fAp7K9sZ1qL8VFnI9g78eUlCdmOXHB3WzSdj2jtEYb4XF3N7PDJBl32qIxq"
|
25
|
+
)
|
22
26
|
PAT = os.environ.get("GITHUB_TOKEN") or PAT_NO_ACCESS
|
23
27
|
GH_CLIENT = Github(auth=Auth.Token(PAT))
|
24
28
|
|
@@ -35,9 +39,17 @@ def _run_local_git(
|
|
35
39
|
if repo:
|
36
40
|
if isinstance(repo, str):
|
37
41
|
repo = Path(repo)
|
38
|
-
result = subprocess.run(
|
42
|
+
result = subprocess.run(
|
43
|
+
cmd,
|
44
|
+
capture_output=capture_output,
|
45
|
+
check=True,
|
46
|
+
cwd=repo.absolute().as_posix(),
|
47
|
+
encoding="utf-8",
|
48
|
+
)
|
39
49
|
else:
|
40
|
-
result = subprocess.run(
|
50
|
+
result = subprocess.run(
|
51
|
+
cmd, capture_output=capture_output, check=True, encoding="utf-8"
|
52
|
+
)
|
41
53
|
except (NotADirectoryError, FileNotFoundError) as e: # pragma: no cover
|
42
54
|
return None
|
43
55
|
except subprocess.CalledProcessError as e: # pragma: no cover
|
@@ -76,7 +88,9 @@ def clone(remote_repo: str, path: Path, shallow: bool = False, tag: Optional[str
|
|
76
88
|
return False
|
77
89
|
|
78
90
|
|
79
|
-
def get_local_tag(
|
91
|
+
def get_local_tag(
|
92
|
+
repo: Optional[Union[str, Path]] = None, abbreviate: bool = True
|
93
|
+
) -> Union[str, None]:
|
80
94
|
"""
|
81
95
|
get the most recent git version tag of a local repo
|
82
96
|
repo Path should be in the form of : repo = "./repo/micropython"
|
@@ -125,12 +139,16 @@ def get_local_tags(repo: Optional[Path] = None, minver: Optional[str] = None) ->
|
|
125
139
|
@cachetools.func.ttl_cache(maxsize=16, ttl=60) # 60 seconds
|
126
140
|
def get_tags(repo: str, minver: Optional[str] = None) -> List[str]:
|
127
141
|
"""
|
128
|
-
Get list of tag of a repote github repo
|
142
|
+
Get list of tag of a repote github repo.
|
143
|
+
only the last -preview tag is kept
|
129
144
|
"""
|
130
145
|
if not repo or not isinstance(repo, str) or "/" not in repo: # type: ignore
|
131
146
|
return []
|
132
147
|
try:
|
133
148
|
gh_repo = GH_CLIENT.get_repo(repo)
|
149
|
+
except BadCredentialsException as e:
|
150
|
+
log.error(f"Github authentication error - {e}")
|
151
|
+
return []
|
134
152
|
except ConnectionError as e:
|
135
153
|
# TODO: unable to capture the exeption
|
136
154
|
log.warning(f"Unable to get tags - {e}")
|
@@ -138,7 +156,9 @@ def get_tags(repo: str, minver: Optional[str] = None) -> List[str]:
|
|
138
156
|
tags = [tag.name for tag in gh_repo.get_tags()]
|
139
157
|
if minver:
|
140
158
|
tags = [tag for tag in tags if parse(tag) >= parse(minver)]
|
141
|
-
|
159
|
+
# remove all but the last preview
|
160
|
+
tags = [t for t in sorted(tags[:-1]) if "-preview" not in t] + sorted(tags)[-1:]
|
161
|
+
return tags
|
142
162
|
|
143
163
|
|
144
164
|
def checkout_tag(tag: str, repo: Optional[Union[str, Path]] = None) -> bool:
|
mpflash/mpflash/common.py
CHANGED
@@ -30,11 +30,8 @@ PORT_FWTYPES = {
|
|
30
30
|
|
31
31
|
# Token with no permissions to avoid throttling
|
32
32
|
# https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28#getting-a-higher-rate-limit
|
33
|
-
PAT_NO_ACCESS =
|
34
|
-
|
35
|
-
+ "_11AAHPVFQ0qAkDnSUaMKSp"
|
36
|
-
+ "_ZkDl5NRRwBsUN6EYg9ahp1Dvj4FDDONnXVgimxC2EtpY7Q7BUKBoQ0Jq72X"
|
37
|
-
)
|
33
|
+
PAT_NO_ACCESS = "github_pat_"+"11AAHPVFQ0G4NTaQ73Bw5J"+"_fAp7K9sZ1qL8VFnI9g78eUlCdmOXHB3WzSdj2jtEYb4XF3N7PDJBl32qIxq"
|
34
|
+
|
38
35
|
PAT = os.environ.get("GITHUB_TOKEN") or PAT_NO_ACCESS
|
39
36
|
GH_CLIENT = Github(auth=Auth.Token(PAT))
|
40
37
|
|
@@ -1,18 +1,18 @@
|
|
1
1
|
import functools
|
2
2
|
import zipfile
|
3
3
|
from pathlib import Path
|
4
|
-
from typing import List, Optional
|
4
|
+
from typing import Final, List, Optional
|
5
5
|
|
6
6
|
import jsons
|
7
7
|
|
8
8
|
from mpflash.mpboard_id.board import Board
|
9
9
|
|
10
10
|
###############################################################################################
|
11
|
-
HERE = Path(__file__).parent
|
11
|
+
HERE: Final = Path(__file__).parent
|
12
12
|
###############################################################################################
|
13
13
|
|
14
14
|
|
15
|
-
def write_boardinfo_json(board_list: List[Board], *, folder: Path):
|
15
|
+
def write_boardinfo_json(board_list: List[Board], *, folder: Optional[Path] = None):
|
16
16
|
"""Writes the board information to a JSON file.
|
17
17
|
|
18
18
|
Args:
|
@@ -21,6 +21,8 @@ def write_boardinfo_json(board_list: List[Board], *, folder: Path):
|
|
21
21
|
"""
|
22
22
|
import zipfile
|
23
23
|
|
24
|
+
if not folder:
|
25
|
+
folder = HERE
|
24
26
|
# create a zip file with the json file
|
25
27
|
with zipfile.ZipFile(folder / "board_info.zip", "w", compression=zipfile.ZIP_DEFLATED) as zipf:
|
26
28
|
# write the list to json file inside the zip
|
@@ -30,6 +32,9 @@ def write_boardinfo_json(board_list: List[Board], *, folder: Path):
|
|
30
32
|
|
31
33
|
@functools.lru_cache(maxsize=20)
|
32
34
|
def read_known_boardinfo(board_info: Optional[Path] = None) -> List[Board]:
|
35
|
+
"""Reads the board information from a JSON file in a zip file."""
|
36
|
+
|
37
|
+
import zipfile
|
33
38
|
|
34
39
|
if not board_info:
|
35
40
|
board_info = HERE / "board_info.zip"
|
@@ -36,7 +36,9 @@ def _info(): # type:() -> dict[str, str]
|
|
36
36
|
"version": "",
|
37
37
|
"build": "",
|
38
38
|
"ver": "",
|
39
|
-
"port":
|
39
|
+
"port": (
|
40
|
+
"stm32" if sys.platform.startswith("pyb") else sys.platform
|
41
|
+
), # port: esp32 / win32 / linux / stm32
|
40
42
|
"board": "GENERIC",
|
41
43
|
"cpu": "",
|
42
44
|
"mpy": "",
|
@@ -48,7 +50,11 @@ def _info(): # type:() -> dict[str, str]
|
|
48
50
|
except AttributeError:
|
49
51
|
pass
|
50
52
|
try:
|
51
|
-
machine =
|
53
|
+
machine = (
|
54
|
+
sys.implementation._machine
|
55
|
+
if "_machine" in dir(sys.implementation)
|
56
|
+
else os.uname().machine
|
57
|
+
)
|
52
58
|
info["board"] = machine.strip()
|
53
59
|
info["cpu"] = machine.split("with")[-1].strip() if "with" in machine else ""
|
54
60
|
info["mpy"] = (
|
@@ -100,7 +106,8 @@ def _info(): # type:() -> dict[str, str]
|
|
100
106
|
if (
|
101
107
|
info["version"]
|
102
108
|
and info["version"].endswith(".0")
|
103
|
-
and info["version"]
|
109
|
+
and info["version"]
|
110
|
+
>= "1.10.0" # versions from 1.10.0 to 1.20.0 do not have a micro .0
|
104
111
|
and info["version"] <= "1.19.9"
|
105
112
|
):
|
106
113
|
# drop the .0 for newer releases
|
@@ -110,19 +117,23 @@ def _info(): # type:() -> dict[str, str]
|
|
110
117
|
if "mpy" in info and info["mpy"]: # mpy on some v1.11+ builds
|
111
118
|
sys_mpy = int(info["mpy"])
|
112
119
|
# .mpy architecture
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
120
|
+
try:
|
121
|
+
arch = [
|
122
|
+
None,
|
123
|
+
"x86",
|
124
|
+
"x64",
|
125
|
+
"armv6",
|
126
|
+
"armv6m",
|
127
|
+
"armv7m",
|
128
|
+
"armv7em",
|
129
|
+
"armv7emsp",
|
130
|
+
"armv7emdp",
|
131
|
+
"xtensa",
|
132
|
+
"xtensawin",
|
133
|
+
"hazard3riscv", # assumed
|
134
|
+
][sys_mpy >> 10]
|
135
|
+
except IndexError:
|
136
|
+
arch = "unknown"
|
126
137
|
if arch:
|
127
138
|
info["arch"] = arch
|
128
139
|
# .mpy version.minor
|