micropython-stubber 1.20.6__py3-none-any.whl → 1.23.0__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.20.6.dist-info → micropython_stubber-1.23.0.dist-info}/METADATA +1 -1
- {micropython_stubber-1.20.6.dist-info → micropython_stubber-1.23.0.dist-info}/RECORD +45 -45
- mpflash/mpflash/cli_flash.py +1 -1
- mpflash/mpflash/cli_main.py +1 -1
- mpflash/mpflash/config.py +5 -9
- mpflash/mpflash/downloaded.py +3 -2
- mpflash/mpflash/flash.py +17 -14
- mpflash/mpflash/flash_stm32.py +4 -10
- mpflash/mpflash/flash_stm32_dfu.py +3 -0
- mpflash/mpflash/flash_uf2.py +38 -16
- mpflash/mpflash/flash_uf2_linux.py +10 -4
- mpflash/mpflash/flash_uf2_macos.py +5 -2
- mpflash/mpflash/flash_uf2_windows.py +7 -3
- mpflash/mpflash/mpremoteboard/__init__.py +8 -3
- mpflash/mpflash/worklist.py +3 -2
- mpflash/poetry.lock +1 -1
- mpflash/pyproject.toml +5 -1
- stubber/__init__.py +1 -1
- stubber/board/createstubs.py +3 -3
- stubber/board/createstubs_db.py +4 -4
- stubber/board/createstubs_db_min.py +1 -1
- stubber/board/createstubs_db_mpy.mpy +0 -0
- stubber/board/createstubs_mem.py +4 -4
- 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/commands/build_cmd.py +1 -1
- stubber/commands/cli.py +7 -3
- stubber/commands/clone_cmd.py +14 -3
- stubber/commands/enrich_folder_cmd.py +2 -1
- stubber/commands/get_core_cmd.py +5 -3
- stubber/commands/get_docstubs_cmd.py +5 -3
- stubber/commands/get_frozen_cmd.py +4 -2
- stubber/commands/get_mcu_cmd.py +8 -3
- stubber/commands/merge_cmd.py +2 -1
- stubber/commands/publish_cmd.py +1 -1
- stubber/commands/stub_cmd.py +2 -1
- stubber/commands/switch_cmd.py +12 -4
- stubber/commands/variants_cmd.py +2 -1
- stubber/tools/manifestfile.py +72 -27
- stubber/tools/readme.md +3 -2
- {micropython_stubber-1.20.6.dist-info → micropython_stubber-1.23.0.dist-info}/LICENSE +0 -0
- {micropython_stubber-1.20.6.dist-info → micropython_stubber-1.23.0.dist-info}/WHEEL +0 -0
- {micropython_stubber-1.20.6.dist-info → micropython_stubber-1.23.0.dist-info}/entry_points.txt +0 -0
@@ -8,26 +8,26 @@ mpflash/mpflash/bootloader/manual.py,sha256=tebIE2YBYvsWx2YmAcUcWnTnSjCqR1AwkXKV
|
|
8
8
|
mpflash/mpflash/bootloader/micropython.py,sha256=of9OuCchiGoczXPi6i0NT9LZHB9FgvigtZxWWvAcb2Q,399
|
9
9
|
mpflash/mpflash/bootloader/touch1200.py,sha256=D9yB1n2bSR-nyQDdQXJtCsNknSfHhI6hRziBqOv_HJI,1466
|
10
10
|
mpflash/mpflash/cli_download.py,sha256=qKZzHmuHazw5fhj_EGDu4DsqYCan41BK99nk1YWELFE,3527
|
11
|
-
mpflash/mpflash/cli_flash.py,sha256=
|
11
|
+
mpflash/mpflash/cli_flash.py,sha256=IQfloZM1UK4VO4bo-8OxQkwH-RTGUFs7IWb-m4gFJJg,7136
|
12
12
|
mpflash/mpflash/cli_group.py,sha256=s180-nyUVNEwA5bPlkIum4mZPEW0Udf6oBAElnrjsvQ,2236
|
13
13
|
mpflash/mpflash/cli_list.py,sha256=AvYq5_Z7l0Z4rkbr23TwFNzstuZsQgopFpdcrTLwUvs,1965
|
14
|
-
mpflash/mpflash/cli_main.py,sha256=
|
14
|
+
mpflash/mpflash/cli_main.py,sha256=mOkwtRAxiyZsgiG1QVQ71OaO4kL0D0REEkh-VMieC8E,1107
|
15
15
|
mpflash/mpflash/common.py,sha256=ZfJR8dKKUy4VDZUgnDTILzuaem2o1Ix2haLxHQ47Z0o,5765
|
16
|
-
mpflash/mpflash/config.py,sha256=
|
16
|
+
mpflash/mpflash/config.py,sha256=7-IL4R9oHeSh0jO-hppw8pDv990nEI31dwBzZFD50eY,1007
|
17
17
|
mpflash/mpflash/connected.py,sha256=vzQ6heV7w5Mnu76nR2dr9FiQ7Ja1x1Q_k0TGgdV1lT8,2955
|
18
18
|
mpflash/mpflash/download.py,sha256=EL17R88QO4TaiX-80GjjlEd6CNZ0vDOcWPuwewZ0_zs,13875
|
19
|
-
mpflash/mpflash/downloaded.py,sha256=
|
19
|
+
mpflash/mpflash/downloaded.py,sha256=n2iSVv3pS6rZmUr5ry8tOh-jSCZJdI-g_QJG8N5R1As,4815
|
20
20
|
mpflash/mpflash/errors.py,sha256=6lUhVtECY3syV2bBGKzegGH4pPKXhevvhYQZd74sy6o,238
|
21
|
-
mpflash/mpflash/flash.py,sha256=
|
21
|
+
mpflash/mpflash/flash.py,sha256=aC1z4Jq8b8a8O6rCTX1gdGcO5yM1vGoWlZGIWgKuHro,2059
|
22
22
|
mpflash/mpflash/flash_esp.py,sha256=j-VdSAKzNQZRVVO7oM9NcRAJWPDHsUianOien8rnYE8,2252
|
23
|
-
mpflash/mpflash/flash_stm32.py,sha256=
|
23
|
+
mpflash/mpflash/flash_stm32.py,sha256=JNY1bL-VNlnaQ6AhY9drKj8EgwpGwty0WAH1JD-Ecfs,584
|
24
24
|
mpflash/mpflash/flash_stm32_cube.py,sha256=TnLNqmJcdwRXWj_t0W4o-NmwBjd3z94qpjuyz77oP9o,3859
|
25
|
-
mpflash/mpflash/flash_stm32_dfu.py,sha256=
|
26
|
-
mpflash/mpflash/flash_uf2.py,sha256=
|
25
|
+
mpflash/mpflash/flash_stm32_dfu.py,sha256=GUJTU6bmxu4m9cK_wQKRCXPKSIf7F8BAxKMSDs59TwQ,2985
|
26
|
+
mpflash/mpflash/flash_uf2.py,sha256=f9CwUaBwnmgO9q7I5-Psbd0cStxyeiu0XDcu_OHlmVc,2796
|
27
27
|
mpflash/mpflash/flash_uf2_boardid.py,sha256=2s4K3QiKWK5HKFKWYsDV3hI8alfWSxEOMeurER3eZtM,408
|
28
|
-
mpflash/mpflash/flash_uf2_linux.py,sha256=
|
29
|
-
mpflash/mpflash/flash_uf2_macos.py,sha256=
|
30
|
-
mpflash/mpflash/flash_uf2_windows.py,sha256=
|
28
|
+
mpflash/mpflash/flash_uf2_linux.py,sha256=I6KYbLrnn6lFvzoG-LFETak86VHuMG3XKpdrjCGH2co,3945
|
29
|
+
mpflash/mpflash/flash_uf2_macos.py,sha256=HqQ2HjXlTYzCC5DzjNaoCOR4QKKi5UzjqJcfZVJLaKM,998
|
30
|
+
mpflash/mpflash/flash_uf2_windows.py,sha256=Pg2siQENEqLddM7KKl9PdXtP7HzBsPICxo8uVCgn57E,1050
|
31
31
|
mpflash/mpflash/list.py,sha256=pSV9WJozObPSnW-oYs2JPdmh2PtCPJUNgvrozclpnU4,2874
|
32
32
|
mpflash/mpflash/logger.py,sha256=BAVrSXMGZLfSDRFbtVBtvb7Rl0sTJxooCgBS5t-6bXo,1057
|
33
33
|
mpflash/mpflash/mpboard_id/__init__.py,sha256=yeSWAP1YJWYWB2i8KZlBK1l8loJRcDo-xdymuCv92nU,3723
|
@@ -36,7 +36,7 @@ mpflash/mpflash/mpboard_id/board.py,sha256=yQ8IDHQS09AelvTvmPhpmsL4oX3L7IXGqHork
|
|
36
36
|
mpflash/mpflash/mpboard_id/board_id.py,sha256=G5s-kMKAD-LGUAuU5eYnq25-MGIQPyB-zJojjcGawa4,2878
|
37
37
|
mpflash/mpflash/mpboard_id/board_info.zip,sha256=F6YowS96DAqjten4ySe4MXgZwPtE-saZOUfY5OQkqKk,19759
|
38
38
|
mpflash/mpflash/mpboard_id/store.py,sha256=lQQgHSxcaM_ZURcfZNSUv3-ZJjUKMC_xEOOSdpzVvBU,1493
|
39
|
-
mpflash/mpflash/mpremoteboard/__init__.py,sha256=
|
39
|
+
mpflash/mpflash/mpremoteboard/__init__.py,sha256=j-Cex6TlihDp125gjGB01S_zE9nIq4mdRfamWjnOJoA,7549
|
40
40
|
mpflash/mpflash/mpremoteboard/mpy_fw_info.py,sha256=BTupe4rZDTs3UHRqvs429XqWHCchSpwa05yACOiOt5U,4413
|
41
41
|
mpflash/mpflash/mpremoteboard/runner.py,sha256=YUmo5Y0aOgMaww8CXSdNdgXD-wRKncILuMZ0OB_2qRU,4646
|
42
42
|
mpflash/mpflash/uf2disk.py,sha256=dQ8_U6e3qkFOyfXZDpWAsvEBIlMr-ZzLkzTDD8SADqM,286
|
@@ -46,26 +46,26 @@ mpflash/mpflash/vendor/dfu.py,sha256=jGsiD3lbSV1Ar9qJubhoY_hy-L8FI-K55aow8vgwoYQ
|
|
46
46
|
mpflash/mpflash/vendor/pydfu.py,sha256=1ObubGsPFrQ7T9M3JRlIPNIG2xx8uYffaEe0Y6bdf_g,19937
|
47
47
|
mpflash/mpflash/vendor/readme.md,sha256=ZVg7kuUYyXcWcrWkaSJ0CunwebCqu2SiS2sqDadwrT8,84
|
48
48
|
mpflash/mpflash/vendor/versions.py,sha256=osv5yFyg47_BZ85k3LRrzjyPu6T4psx56rgBN3YXMyM,3885
|
49
|
-
mpflash/mpflash/worklist.py,sha256=
|
50
|
-
mpflash/poetry.lock,sha256=
|
51
|
-
mpflash/pyproject.toml,sha256=
|
49
|
+
mpflash/mpflash/worklist.py,sha256=j64PVJXm8jhLzPUQt3rnJXCbT1JEczTax46mRWID9bM,5809
|
50
|
+
mpflash/poetry.lock,sha256=XBX2OYxy1q5tBn9pzXQBErgOwssrx_tVhUl8p2DZwMw,117989
|
51
|
+
mpflash/pyproject.toml,sha256=sGxeBSd8LOo3l5DBlLypNW0B2kQLu-LpmdPG4ZI1lZw,1669
|
52
52
|
mpflash/stm32_udev_rules.md,sha256=LJelvFFA8w9mBcEUDA02SZ4yzNKfUFL_NWLNUb6geWY,2622
|
53
|
-
stubber/__init__.py,sha256=
|
53
|
+
stubber/__init__.py,sha256=xZBZxZVT_tkoW2-USEDpT7Ru9I5ySVZ0FERKX_Puvk0,46
|
54
54
|
stubber/basicgit.py,sha256=CkS4YrAP1pLwfoihUZB5Y39uQjkQu_n4ukyrvbrlExs,9440
|
55
55
|
stubber/board/board_info.csv,sha256=3BBwHOtKfq_U0Xl8iWgNsN3akhbNMjb-TIeusDwtTXQ,8434
|
56
56
|
stubber/board/boot.py,sha256=TEBSaKXY_TYJy9YrTRWv22m8jZRefaRNiwM8xNAlH5M,1086
|
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=ZgpiFhmDl9LrszoxqOG1SI22bpvR9NWmYFwhvCCVLhY,31936
|
58
|
+
stubber/board/createstubs_db.py,sha256=Gbi5LXqAorbFJ4qjb-jIAeBhE-niPr-_9scpNEXg-V8,29558
|
59
|
+
stubber/board/createstubs_db_min.py,sha256=q4CA7qs8t3dj_whlNCUrw_yebdNb_9my85snqdbiuyE,11142
|
60
|
+
stubber/board/createstubs_db_mpy.mpy,sha256=Uno7GVqRV6joDZ2UsITxv2y84Hjl75h_aqM1eRuK7MI,9536
|
61
61
|
stubber/board/createstubs_lvgl.py,sha256=LDlY2AxT5S_IZ5twi2wK9gm3SnHsDt9inrpCLOYmZIk,26476
|
62
62
|
stubber/board/createstubs_lvgl_min.py,sha256=9L9JsZUCY0E5x4F_Uyckkd8GjiB_49guU6DN-u7XhgU,26466
|
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=B23Xon0wm5K8hoTZWHx6j551Jqfg-zDR70_ckiEvc74,27953
|
65
|
+
stubber/board/createstubs_mem_min.py,sha256=EBMI05I-3D7f-6y6DQo5n2VfOkppKEqoJtt0huwo8v8,10713
|
66
|
+
stubber/board/createstubs_mem_mpy.mpy,sha256=cNPvlft3SH_R3Epl5Tg3zDLnlG4-YAl6neUO1wfEM34,9118
|
67
|
+
stubber/board/createstubs_min.py,sha256=mEo9F0ttyOeuhZ2bEeh4BKta4-yWfhbr20gATcaQx5g,13405
|
68
|
+
stubber/board/createstubs_mpy.mpy,sha256=eNos3gzTHQTGN_TyB2IshtTWt6iLo98hGAfaBLIBgoI,12388
|
69
69
|
stubber/board/fw_info.py,sha256=BTupe4rZDTs3UHRqvs429XqWHCchSpwa05yACOiOt5U,4413
|
70
70
|
stubber/board/info.py,sha256=0FCQZ5J3KFDbYe0D5iOuwhmZUUBVASPU7-L6fA7ZRGc,5446
|
71
71
|
stubber/board/main.py,sha256=l-5RCT-MMV93SkVwXh3guzx_kxFIJciSEgH1e4UrqT8,394
|
@@ -85,20 +85,20 @@ stubber/codemod/merge_docstub.py,sha256=-F2P9UAD98Xt8ArsNqQJ-AM6bz9H9V9E3S2d17Jk
|
|
85
85
|
stubber/codemod/modify_list.py,sha256=_YTj3E44dwb7QaRqKaIq0IWg-BzH69AZRqTr3QMkFnY,2064
|
86
86
|
stubber/codemod/utils.py,sha256=mE4Ks7-lqnxXbjQcftO_OkJGJDZyCOR4soNJSWRtMek,2402
|
87
87
|
stubber/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
88
|
-
stubber/commands/build_cmd.py,sha256=
|
89
|
-
stubber/commands/cli.py,sha256=
|
90
|
-
stubber/commands/clone_cmd.py,sha256=
|
88
|
+
stubber/commands/build_cmd.py,sha256=lZfbxPyduDkLDTCGWI_nBc_3lKwZjfWPvq4nVy2v944,2381
|
89
|
+
stubber/commands/cli.py,sha256=LXeSG8-EeEb0PvlKkaRS5bscgtUsDTBLfQnqS0O6M24,1836
|
90
|
+
stubber/commands/clone_cmd.py,sha256=D8rKyiuIvGDrxCgkjmiN60RzedMTLToHoRZnKc31Yh4,2663
|
91
91
|
stubber/commands/config_cmd.py,sha256=CMFe0IngKPJYrb3kcZ6BObBOh4dW_0Wf7etAuJthB18,964
|
92
|
-
stubber/commands/enrich_folder_cmd.py,sha256=
|
93
|
-
stubber/commands/get_core_cmd.py,sha256=
|
94
|
-
stubber/commands/get_docstubs_cmd.py,sha256=
|
95
|
-
stubber/commands/get_frozen_cmd.py,sha256=
|
96
|
-
stubber/commands/get_mcu_cmd.py,sha256=
|
97
|
-
stubber/commands/merge_cmd.py,sha256=
|
98
|
-
stubber/commands/publish_cmd.py,sha256=
|
99
|
-
stubber/commands/stub_cmd.py,sha256=
|
100
|
-
stubber/commands/switch_cmd.py,sha256=
|
101
|
-
stubber/commands/variants_cmd.py,sha256=
|
92
|
+
stubber/commands/enrich_folder_cmd.py,sha256=ysdd_CLdPCiEja4xuFOAX_a89telX4Da7cvkrpXP4lY,1798
|
93
|
+
stubber/commands/get_core_cmd.py,sha256=VwkZl9g81LvwWu4grrIb2Qo8M5-yXrDEX5mUWJ2uKFo,2240
|
94
|
+
stubber/commands/get_docstubs_cmd.py,sha256=93rWWKBKmt7D9UD0-c4mtVAH5hw5Z3PnWDpiKVfrWe8,2935
|
95
|
+
stubber/commands/get_frozen_cmd.py,sha256=I9Hde0n-k5e9LHrjaUp0d5WeaamntLjtEOJQ7GCLHgc,3857
|
96
|
+
stubber/commands/get_mcu_cmd.py,sha256=BzsOo1C046sRjYtS_9MM-epXF9UaElf1j23LM4aqpnI,2016
|
97
|
+
stubber/commands/merge_cmd.py,sha256=VxpYGaF7JduBr43POFviT15ZecbOW1o4vqTaKMCN0jU,1622
|
98
|
+
stubber/commands/publish_cmd.py,sha256=EiOYXVXyMru2lL6EOy7NSwHAS7TZXfehjvfY5r8gH3Y,2805
|
99
|
+
stubber/commands/stub_cmd.py,sha256=PzvCppuhY2vRJJEzKbdc87WnrVEd3jPJ7AdtQeUSpn8,1171
|
100
|
+
stubber/commands/switch_cmd.py,sha256=Aa4Q8LEc-mbHfO6h9orkIuR8wr9yOY-_bwL4HMPiWJ8,1825
|
101
|
+
stubber/commands/variants_cmd.py,sha256=IYDmR3JyPPQ8uSZURLWbCluCV85_S38F_JKZTzRE-Lg,1251
|
102
102
|
stubber/cst_transformer.py,sha256=Er9kww4hgdeQ9dARMx8lB5PLIvPaKjtKJMe8BofKOzY,6301
|
103
103
|
stubber/data/board_info.csv,sha256=3BBwHOtKfq_U0Xl8iWgNsN3akhbNMjb-TIeusDwtTXQ,8434
|
104
104
|
stubber/data/board_info.json,sha256=LbyNo3qeij8bY_PRTxWoS5nFuDv6VyaRTKGiXC_-zRQ,57210
|
@@ -138,8 +138,8 @@ stubber/rst/rst_utils.py,sha256=8wfodql00CnO57x8VeNh1yoz7yx_ONa330kWuR1JFoE,1727
|
|
138
138
|
stubber/stubber.py,sha256=sScRIAq7vvUZUS9Mzh4Ne6ny0qpsReGNqo0u8vtZXEc,1596
|
139
139
|
stubber/stubs_from_docs.py,sha256=jcNdbNFQ6qZiVOVzdD8nfBNTubD-jviL_KJDPqOfTxo,2743
|
140
140
|
stubber/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
141
|
-
stubber/tools/manifestfile.py,sha256=
|
142
|
-
stubber/tools/readme.md,sha256=
|
141
|
+
stubber/tools/manifestfile.py,sha256=hfv_bTDytZDSndKy2GuPScH9xz_YzihDY0QmrOY9RLQ,25094
|
142
|
+
stubber/tools/readme.md,sha256=NJ_g0oeeExhiRs2lMQVekccnR_c2lGLt-snu1RnUIx0,278
|
143
143
|
stubber/update_fallback.py,sha256=Wi0dj5dly1UFmjpzh7dksb-RuHsSRC0i-E9H-dZ5AQo,4804
|
144
144
|
stubber/update_module_list.py,sha256=smeu-xSeFgtr1piJNR1JqLzHd3HZ1K5_iaKNRea6dzk,3886
|
145
145
|
stubber/utils/__init__.py,sha256=i2OXAFcw6X1xSEwh2X355lGrM0xgmZZow9z9zRwtV5A,220
|
@@ -152,8 +152,8 @@ stubber/utils/stubmaker.py,sha256=1eMNpZZ-BWBtxLwBO-kz4CywjUe0JexN6QSyAVNICxM,50
|
|
152
152
|
stubber/utils/typed_config_toml.py,sha256=6nlFgHwdCcK_0MJICsstCFgm9M6TblvF-l0_2cpw_cY,2552
|
153
153
|
stubber/utils/versions.py,sha256=56UhB49F2647jY9eWtkjjRuYYfJLEjC9daQFhgckgZM,4161
|
154
154
|
stubber/variants.py,sha256=iS3sv8cT7czdI9x4KqzTCPT6hX1CKQ-bIlWnDG6gyoU,3688
|
155
|
-
micropython_stubber-1.
|
156
|
-
micropython_stubber-1.
|
157
|
-
micropython_stubber-1.
|
158
|
-
micropython_stubber-1.
|
159
|
-
micropython_stubber-1.
|
155
|
+
micropython_stubber-1.23.0.dist-info/LICENSE,sha256=2zsOXlYgl9W7_XGXcncAXIYfvSVlyNcVBycC6hhlKhA,1542
|
156
|
+
micropython_stubber-1.23.0.dist-info/METADATA,sha256=Km0C0eRnH4G_oYL9jOJekeNyKSDPbVfQr4rLmJm28OA,19158
|
157
|
+
micropython_stubber-1.23.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
158
|
+
micropython_stubber-1.23.0.dist-info/entry_points.txt,sha256=NQi_M36fgq5k6giSuASas3LrpF6CVdkzfvJC0ja73_g,55
|
159
|
+
micropython_stubber-1.23.0.dist-info/RECORD,,
|
mpflash/mpflash/cli_flash.py
CHANGED
mpflash/mpflash/cli_main.py
CHANGED
mpflash/mpflash/config.py
CHANGED
@@ -4,18 +4,15 @@ import os
|
|
4
4
|
from pathlib import Path
|
5
5
|
from typing import List
|
6
6
|
|
7
|
-
import pkg_resources
|
8
7
|
import platformdirs
|
8
|
+
from importlib.metadata import version
|
9
9
|
|
10
10
|
from mpflash.logger import log
|
11
11
|
|
12
12
|
|
13
13
|
def get_version():
|
14
14
|
name = __package__ or "mpflash"
|
15
|
-
|
16
|
-
return pkg_resources.get_distribution(name).version
|
17
|
-
except pkg_resources.DistributionNotFound:
|
18
|
-
return "Package not found"
|
15
|
+
return version(name)
|
19
16
|
|
20
17
|
|
21
18
|
class MPtoolConfig:
|
@@ -32,16 +29,15 @@ class MPtoolConfig:
|
|
32
29
|
@property
|
33
30
|
def interactive(self):
|
34
31
|
# No interactions in CI
|
35
|
-
if os.getenv(
|
32
|
+
if os.getenv("GITHUB_ACTIONS") == "true":
|
36
33
|
log.warning("Disabling interactive mode in CI")
|
37
34
|
return False
|
38
35
|
return self._interactive
|
39
|
-
|
36
|
+
|
40
37
|
@interactive.setter
|
41
|
-
def interactive(self, value:bool):
|
38
|
+
def interactive(self, value: bool):
|
42
39
|
self._interactive = value
|
43
40
|
|
44
41
|
|
45
|
-
|
46
42
|
config = MPtoolConfig()
|
47
43
|
__version__ = get_version()
|
mpflash/mpflash/downloaded.py
CHANGED
@@ -4,7 +4,7 @@ from typing import Dict, List, Optional
|
|
4
4
|
import jsonlines
|
5
5
|
from loguru import logger as log
|
6
6
|
|
7
|
-
from mpflash.common import FWInfo
|
7
|
+
from mpflash.common import PORT_FWTYPES, FWInfo
|
8
8
|
from mpflash.vendor.versions import clean_version
|
9
9
|
|
10
10
|
from .config import config
|
@@ -109,7 +109,7 @@ def filter_downloaded_fwlist(
|
|
109
109
|
log.trace(f"Filtering firmware for {version} : {len(fw_list)} found.")
|
110
110
|
# filter by port
|
111
111
|
if port:
|
112
|
-
fw_list = [fw for fw in fw_list if fw.port == port]
|
112
|
+
fw_list = [fw for fw in fw_list if fw.port == port and Path(fw.firmware).suffix in PORT_FWTYPES[port]]
|
113
113
|
log.trace(f"Filtering firmware for {port} : {len(fw_list)} found.")
|
114
114
|
|
115
115
|
if board_id:
|
@@ -120,6 +120,7 @@ def filter_downloaded_fwlist(
|
|
120
120
|
# the firmware variant should match exactly the board_id
|
121
121
|
fw_list = [fw for fw in fw_list if fw.variant == board_id]
|
122
122
|
log.trace(f"Filtering firmware for {board_id} : {len(fw_list)} found.")
|
123
|
+
|
123
124
|
if selector and port in selector:
|
124
125
|
fw_list = [fw for fw in fw_list if fw.filename.endswith(selector[port])]
|
125
126
|
return fw_list
|
mpflash/mpflash/flash.py
CHANGED
@@ -30,20 +30,23 @@ def flash_list(
|
|
30
30
|
continue
|
31
31
|
log.info(f"Updating {mcu.board} on {mcu.serialport} to {fw_info.version}")
|
32
32
|
updated = None
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
33
|
+
try:
|
34
|
+
if mcu.port in UF2_PORTS and fw_file.suffix == ".uf2":
|
35
|
+
if not enter_bootloader(mcu, bootloader):
|
36
|
+
continue
|
37
|
+
updated = flash_uf2(mcu, fw_file=fw_file, erase=erase)
|
38
|
+
elif mcu.port in ["stm32"]:
|
39
|
+
if not enter_bootloader(mcu, bootloader):
|
40
|
+
continue
|
41
|
+
updated = flash_stm32(mcu, fw_file, erase=erase)
|
42
|
+
elif mcu.port in ["esp32", "esp8266"]:
|
43
|
+
# bootloader is handled by esptool for esp32/esp8266
|
44
|
+
updated = flash_esp(mcu, fw_file=fw_file, erase=erase)
|
45
|
+
else:
|
46
|
+
log.error(f"Don't (yet) know how to flash {mcu.port}-{mcu.board} on {mcu.serialport}")
|
47
|
+
except Exception as e:
|
48
|
+
log.error(f"Failed to flash {mcu.board} on {mcu.serialport}")
|
49
|
+
log.exception(e)
|
47
50
|
|
48
51
|
if updated:
|
49
52
|
flashed.append(updated)
|
mpflash/mpflash/flash_stm32.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
"""Flash STM32 boards using
|
1
|
+
"""Flash STM32 boards using pydfu"""
|
2
2
|
|
3
3
|
from pathlib import Path
|
4
4
|
|
@@ -11,14 +11,8 @@ from mpflash.mpremoteboard import MPRemoteBoard
|
|
11
11
|
|
12
12
|
def flash_stm32(mcu: MPRemoteBoard, fw_file: Path, *, erase: bool, stm32_dfu: bool = True):
|
13
13
|
# sourcery skip: lift-return-into-if
|
14
|
-
log.info("Using dfu-util")
|
15
14
|
dfu_init()
|
16
|
-
updated
|
17
|
-
|
18
|
-
|
19
|
-
# log.info("Using STM32CubeProgrammer CLI")
|
20
|
-
# updated = flash_stm32_cubecli(mcu, fw_file=fw_file, erase=erase)
|
21
|
-
|
22
|
-
mcu.wait_for_restart()
|
23
|
-
log.success(f"Flashed {mcu.version} to {mcu.board}")
|
15
|
+
if updated := flash_stm32_dfu(mcu, fw_file=fw_file, erase=erase):
|
16
|
+
mcu.wait_for_restart()
|
17
|
+
log.success(f"Flashed {mcu.version} to {mcu.board}")
|
24
18
|
return updated
|
@@ -39,6 +39,7 @@ def dfu_init():
|
|
39
39
|
log.error("pydfu not found")
|
40
40
|
return None
|
41
41
|
if platform.system() == "Windows":
|
42
|
+
log.debug("Initializing libusb backend on Windows...")
|
42
43
|
init_libusb_windows()
|
43
44
|
|
44
45
|
|
@@ -59,6 +60,8 @@ def flash_stm32_dfu(
|
|
59
60
|
Returns:
|
60
61
|
Optional[MPRemoteBoard]: The flashed remote board if successful, None otherwise.
|
61
62
|
"""
|
63
|
+
log.info("Using pydfu to flash STM32 boards")
|
64
|
+
|
62
65
|
if not pydfu:
|
63
66
|
log.error("pydfu not found, please install it with 'pip install pydfu' if supported")
|
64
67
|
return None
|
mpflash/mpflash/flash_uf2.py
CHANGED
@@ -12,6 +12,8 @@ from loguru import logger as log
|
|
12
12
|
from rich.progress import track
|
13
13
|
|
14
14
|
from mpflash.mpremoteboard import MPRemoteBoard
|
15
|
+
import tenacity
|
16
|
+
from tenacity import stop_after_attempt, wait_fixed
|
15
17
|
|
16
18
|
from .common import PORT_FWTYPES
|
17
19
|
from .flash_uf2_boardid import get_board_id
|
@@ -37,31 +39,51 @@ def flash_uf2(mcu: MPRemoteBoard, fw_file: Path, erase: bool) -> Optional[MPRemo
|
|
37
39
|
log.error(f"UF2 not supported on {mcu.board} on {mcu.serialport}")
|
38
40
|
return None
|
39
41
|
if erase:
|
40
|
-
|
42
|
+
destination = waitfor_uf2()
|
41
43
|
|
44
|
+
if not destination or not destination.exists() or not (destination / "INFO_UF2.TXT").exists():
|
45
|
+
log.error("Board is not in bootloader mode")
|
46
|
+
return None
|
47
|
+
|
48
|
+
log.info("Board is in bootloader mode")
|
49
|
+
board_id = get_board_id(destination) # type: ignore
|
50
|
+
log.info(f"Board ID: {board_id}")
|
51
|
+
try:
|
52
|
+
cp_firmware_to_uf2(fw_file, destination)
|
53
|
+
log.success("Done copying, resetting the board and wait for it to restart")
|
54
|
+
except tenacity.RetryError:
|
55
|
+
log.error("Failed to copy the firmware file to the board.")
|
56
|
+
return None
|
57
|
+
|
58
|
+
if sys.platform in ["linux"]:
|
59
|
+
dismount_uf2_linux()
|
60
|
+
|
61
|
+
mcu.wait_for_restart()
|
62
|
+
# time.sleep(1) # 5 secs to short on linux
|
63
|
+
return mcu
|
64
|
+
|
65
|
+
|
66
|
+
def waitfor_uf2():
|
67
|
+
"""
|
68
|
+
Wait for the UF2 drive to mount
|
69
|
+
"""
|
42
70
|
if sys.platform == "linux":
|
43
|
-
|
71
|
+
return wait_for_UF2_linux()
|
44
72
|
elif sys.platform == "win32":
|
45
|
-
|
73
|
+
return wait_for_UF2_windows()
|
46
74
|
elif sys.platform == "darwin":
|
47
75
|
log.warning(f"OS {sys.platform} not tested/supported")
|
48
|
-
|
76
|
+
return wait_for_UF2_macos()
|
49
77
|
else:
|
50
78
|
log.warning(f"OS {sys.platform} not tested/supported")
|
51
79
|
return None
|
52
80
|
|
53
|
-
if not destination or not destination.exists() or not (destination / "INFO_UF2.TXT").exists():
|
54
|
-
log.error("Board is not in bootloader mode")
|
55
|
-
return None
|
56
81
|
|
57
|
-
|
58
|
-
|
59
|
-
|
82
|
+
@tenacity.retry(stop=stop_after_attempt(3), wait=wait_fixed(1), reraise=False)
|
83
|
+
def cp_firmware_to_uf2(fw_file, destination):
|
84
|
+
"""
|
85
|
+
Copy the firmware file to the destination,
|
86
|
+
Retry 3 times with 1s delay
|
87
|
+
"""
|
60
88
|
log.info(f"Copying {fw_file} to {destination}.")
|
61
89
|
shutil.copy(fw_file, destination)
|
62
|
-
log.success("Done copying, resetting the board and wait for it to restart")
|
63
|
-
if sys.platform in ["linux"]:
|
64
|
-
dismount_uf2_linux()
|
65
|
-
for _ in track(range(5 + 2), description="Waiting for the board to restart", transient=True, refresh_per_second=2):
|
66
|
-
time.sleep(1) # 5 secs to short on linux
|
67
|
-
return mcu
|
@@ -42,7 +42,10 @@ def get_uf2_drives():
|
|
42
42
|
uf2.mountpoint = uf2_part["mountpoint"]
|
43
43
|
yield uf2
|
44
44
|
elif disk["type"] == "disk" and disk.get("children") and len(disk.get("children")) > 0:
|
45
|
-
if
|
45
|
+
if (
|
46
|
+
disk.get("children")[0]["type"] == "part"
|
47
|
+
and disk.get("children")[0]["fstype"] == "vfat"
|
48
|
+
):
|
46
49
|
uf2_part = disk.get("children")[0]
|
47
50
|
# print( json.dumps(uf2_part, indent=4))
|
48
51
|
uf2 = UF2Disk()
|
@@ -70,7 +73,7 @@ def pmount(disk: UF2Disk):
|
|
70
73
|
log.debug(f"Mounted {disk.label} at {disk.mountpoint}")
|
71
74
|
glb_dismount_me.append(disk)
|
72
75
|
else:
|
73
|
-
log.
|
76
|
+
log.trace(f"\n{disk.label} already mounted at {disk.mountpoint}")
|
74
77
|
|
75
78
|
|
76
79
|
def pumount(disk: UF2Disk):
|
@@ -101,9 +104,12 @@ def wait_for_UF2_linux(s_max: int = 10):
|
|
101
104
|
uf2_drives = []
|
102
105
|
# while not destination and wait > 0:
|
103
106
|
for _ in track(
|
104
|
-
range(s_max),
|
107
|
+
range(s_max),
|
108
|
+
description="Waiting for mcu to mount as a drive",
|
109
|
+
transient=True,
|
110
|
+
refresh_per_second=2,
|
111
|
+
total=s_max,
|
105
112
|
):
|
106
|
-
# log.info(f"Waiting for mcu to mount as a drive : {wait} seconds left")
|
107
113
|
uf2_drives += list(get_uf2_drives())
|
108
114
|
for drive in get_uf2_drives():
|
109
115
|
pmount(drive)
|
@@ -10,14 +10,17 @@ from typing import Optional
|
|
10
10
|
from rich.progress import track
|
11
11
|
|
12
12
|
|
13
|
-
|
14
13
|
def wait_for_UF2_macos(s_max: int = 10) -> Optional[Path]:
|
15
14
|
"""Wait for the MCU to mount as a drive"""
|
16
15
|
if s_max < 1:
|
17
16
|
s_max = 10
|
18
17
|
destination = None
|
19
18
|
for _ in track(
|
20
|
-
range(s_max),
|
19
|
+
range(s_max),
|
20
|
+
description="Waiting for mcu to mount as a drive",
|
21
|
+
transient=True,
|
22
|
+
refresh_per_second=2,
|
23
|
+
total=s_max,
|
21
24
|
):
|
22
25
|
# log.info(f"Waiting for mcu to mount as a drive : {n} seconds left")
|
23
26
|
vol_mounts = Path("/Volumes").iterdir()
|
@@ -11,14 +11,18 @@ import psutil
|
|
11
11
|
from rich.progress import track
|
12
12
|
|
13
13
|
|
14
|
-
|
15
|
-
|
16
14
|
def wait_for_UF2_windows(s_max: int = 10) -> Optional[Path]:
|
17
15
|
"""Wait for the MCU to mount as a drive"""
|
18
16
|
if s_max < 1:
|
19
17
|
s_max = 10
|
20
18
|
destination = None
|
21
|
-
for _ in track(
|
19
|
+
for _ in track(
|
20
|
+
range(s_max),
|
21
|
+
description="Waiting for mcu to mount as a drive",
|
22
|
+
transient=True,
|
23
|
+
refresh_per_second=2,
|
24
|
+
total=s_max,
|
25
|
+
):
|
22
26
|
# log.info(f"Waiting for mcu to mount as a drive : {n} seconds left")
|
23
27
|
drives = [drive.device for drive in psutil.disk_partitions()]
|
24
28
|
for drive in drives:
|
@@ -91,7 +91,9 @@ class MPRemoteBoard:
|
|
91
91
|
|
92
92
|
if sys.platform == "win32":
|
93
93
|
# Windows sort of comports by number - but fallback to device name
|
94
|
-
return sorted(
|
94
|
+
return sorted(
|
95
|
+
output, key=lambda x: int(x.split()[0][3:]) if x.split()[0][3:].isdigit() else x
|
96
|
+
)
|
95
97
|
# sort by device name
|
96
98
|
return sorted(output)
|
97
99
|
|
@@ -127,7 +129,9 @@ class MPRemoteBoard:
|
|
127
129
|
self.description = descr = info["board"]
|
128
130
|
pos = descr.rfind(" with")
|
129
131
|
short_descr = descr[:pos].strip() if pos != -1 else ""
|
130
|
-
if board_name := find_board_id_by_description(
|
132
|
+
if board_name := find_board_id_by_description(
|
133
|
+
descr, short_descr, version=self.version
|
134
|
+
):
|
131
135
|
self.board = board_name
|
132
136
|
else:
|
133
137
|
self.board = "UNKNOWN_BOARD"
|
@@ -211,7 +215,8 @@ class MPRemoteBoard:
|
|
211
215
|
transient=True,
|
212
216
|
get_time=lambda: time.time(),
|
213
217
|
show_speed=False,
|
214
|
-
refresh_per_second=
|
218
|
+
refresh_per_second=2,
|
219
|
+
total=timeout,
|
215
220
|
):
|
216
221
|
time.sleep(1)
|
217
222
|
try:
|
mpflash/mpflash/worklist.py
CHANGED
@@ -3,7 +3,7 @@ from typing import Dict, List, Optional, Tuple
|
|
3
3
|
|
4
4
|
from loguru import logger as log
|
5
5
|
|
6
|
-
from mpflash.common import FWInfo, filtered_comports
|
6
|
+
from mpflash.common import FWInfo, filtered_comports, PORT_FWTYPES
|
7
7
|
from mpflash.errors import MPFlashError
|
8
8
|
|
9
9
|
from .downloaded import find_downloaded_firmware
|
@@ -54,8 +54,9 @@ def auto_update(
|
|
54
54
|
if not board_firmwares:
|
55
55
|
log.error(f"No {target_version} firmware found for {mcu.board} on {mcu.serialport}.")
|
56
56
|
continue
|
57
|
+
|
57
58
|
if len(board_firmwares) > 1:
|
58
|
-
log.
|
59
|
+
log.warning(f"Multiple {target_version} firmwares found for {mcu.board} on {mcu.serialport}.")
|
59
60
|
|
60
61
|
# just use the last firmware
|
61
62
|
fw_info = board_firmwares[-1]
|
mpflash/poetry.lock
CHANGED
@@ -1585,4 +1585,4 @@ files = [
|
|
1585
1585
|
[metadata]
|
1586
1586
|
lock-version = "2.0"
|
1587
1587
|
python-versions = ">=3.8.1,<4.0"
|
1588
|
-
content-hash = "
|
1588
|
+
content-hash = "99cc10bd15b033a47635e31676205b38443b15697fb189b01a8eb7f2f175acf8"
|
mpflash/pyproject.toml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "mpflash"
|
3
|
-
version = "0.
|
3
|
+
version = "0.9.0"
|
4
4
|
description = "Flash and download tool for MicroPython firmwares"
|
5
5
|
authors = ["Jos Verlinde <jos_verlinde@hotmail.com>"]
|
6
6
|
license = "MIT"
|
@@ -40,6 +40,10 @@ rich-click = "^1.8.1"
|
|
40
40
|
tenacity = "8.2.3"
|
41
41
|
|
42
42
|
|
43
|
+
[tool.poetry.group.dev]
|
44
|
+
optional = true
|
45
|
+
[tool.poetry.group.dev.dependencies]
|
46
|
+
|
43
47
|
[tool.poetry.group.test]
|
44
48
|
optional = true
|
45
49
|
[tool.poetry.group.test.dependencies]
|
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.23.0"
|
28
28
|
ENOENT = 2
|
29
29
|
_MAX_CLASS_LEVEL = 2 # Max class nesting
|
30
30
|
LIBS = ["lib", "/lib", "/sd/lib", "/flash/lib", "."]
|
@@ -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.
|
598
|
+
and info["version"] >= "1.10.0" # versions from 1.10.0 to 1.23.0 do not have a micro .0
|
599
599
|
and info["version"] <= "1.19.9"
|
600
600
|
):
|
601
|
-
# versions from 1.10.0 to 1.
|
601
|
+
# versions from 1.10.0 to 1.23.0 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.
|
21
|
+
This variant was generated from createstubs.py by micropython-stubber v1.23.0
|
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.23.0"
|
47
47
|
ENOENT = 2
|
48
48
|
_MAX_CLASS_LEVEL = 2 # Max class nesting
|
49
49
|
LIBS = ["lib", "/lib", "/sd/lib", "/flash/lib", "."]
|
@@ -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.
|
609
|
+
and info["version"] >= "1.10.0" # versions from 1.10.0 to 1.23.0 do not have a micro .0
|
610
610
|
and info["version"] <= "1.19.9"
|
611
611
|
):
|
612
|
-
# versions from 1.10.0 to 1.
|
612
|
+
# versions from 1.10.0 to 1.23.0 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.
|
54
|
+
__version__='v1.23.0'
|
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.
|
12
|
+
This variant was generated from createstubs.py by micropython-stubber v1.23.0
|
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.
|
37
|
+
__version__ = "v1.23.0"
|
38
38
|
ENOENT = 2
|
39
39
|
_MAX_CLASS_LEVEL = 2 # Max class nesting
|
40
40
|
LIBS = ["lib", "/lib", "/sd/lib", "/flash/lib", "."]
|
@@ -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.
|
600
|
+
and info["version"] >= "1.10.0" # versions from 1.10.0 to 1.23.0 do not have a micro .0
|
601
601
|
and info["version"] <= "1.19.9"
|
602
602
|
):
|
603
|
-
# versions from 1.10.0 to 1.
|
603
|
+
# versions from 1.10.0 to 1.23.0 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.
|
53
|
+
__version__='v1.23.0'
|
54
54
|
A0=2
|
55
55
|
A1=2
|
56
56
|
A5=['lib','/lib','/sd/lib','/flash/lib',J]
|
Binary file
|
stubber/commands/build_cmd.py
CHANGED
stubber/commands/cli.py
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
"""
|
2
2
|
command line interface - main group
|
3
3
|
"""
|
4
|
+
|
4
5
|
import sys
|
5
6
|
|
6
|
-
import click
|
7
|
+
import rich_click as click
|
7
8
|
from loguru import logger as log
|
8
9
|
from stubber import __version__
|
9
10
|
|
@@ -11,11 +12,12 @@ from stubber import __version__
|
|
11
12
|
@click.group(chain=True)
|
12
13
|
@click.version_option(package_name="micropython-stubber", prog_name="micropython-stubber✏️ ")
|
13
14
|
@click.option(
|
15
|
+
"-V",
|
14
16
|
"-v",
|
15
17
|
"--verbose",
|
16
18
|
count=True,
|
17
19
|
default=0,
|
18
|
-
help="-
|
20
|
+
help="-V for DEBUG, -VV for TRACE",
|
19
21
|
is_eager=True,
|
20
22
|
)
|
21
23
|
@click.pass_context
|
@@ -46,6 +48,8 @@ def set_loglevel(verbose: int) -> str:
|
|
46
48
|
else:
|
47
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>"
|
48
50
|
|
49
|
-
log.add(
|
51
|
+
log.add(
|
52
|
+
sys.stderr, level=level, backtrace=True, diagnose=True, colorize=True, format=format_str
|
53
|
+
)
|
50
54
|
log.info(f"micropython-stubber {__version__}")
|
51
55
|
return level
|
stubber/commands/clone_cmd.py
CHANGED
@@ -7,7 +7,7 @@ import os
|
|
7
7
|
from pathlib import Path
|
8
8
|
from typing import List, Tuple, Union
|
9
9
|
|
10
|
-
import click
|
10
|
+
import rich_click as click
|
11
11
|
import stubber.basicgit as git
|
12
12
|
from loguru import logger as log
|
13
13
|
from stubber.utils.config import CONFIG
|
@@ -20,8 +20,19 @@ from .cli import stubber_cli
|
|
20
20
|
|
21
21
|
|
22
22
|
@stubber_cli.command(name="clone")
|
23
|
-
@click.option(
|
24
|
-
|
23
|
+
@click.option(
|
24
|
+
"--path",
|
25
|
+
"-p",
|
26
|
+
default=CONFIG.repo_path.as_posix(),
|
27
|
+
type=click.Path(file_okay=False, dir_okay=True),
|
28
|
+
)
|
29
|
+
@click.option(
|
30
|
+
"--add-stubs/--no-stubs",
|
31
|
+
"stubs",
|
32
|
+
default=False,
|
33
|
+
is_flag=True,
|
34
|
+
help="Also clone the micropython-stubs repo",
|
35
|
+
)
|
25
36
|
def cli_clone(path: Union[str, Path], stubs: bool = False):
|
26
37
|
"""
|
27
38
|
Clone/fetch the micropython repos locally.
|
stubber/commands/get_core_cmd.py
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
from pathlib import Path
|
8
8
|
from typing import List
|
9
9
|
|
10
|
-
import click
|
10
|
+
import rich_click as click
|
11
11
|
from loguru import logger as log
|
12
12
|
|
13
13
|
import stubber.get_cpython as get_cpython
|
@@ -54,14 +54,16 @@ def cli_get_core(
|
|
54
54
|
"""
|
55
55
|
# default parameter values
|
56
56
|
stub_folder = stub_folder or CONFIG.stub_path.as_posix()
|
57
|
-
|
57
|
+
|
58
58
|
stub_paths: List[Path] = []
|
59
59
|
for core_type in ["pycopy", "micropython"]:
|
60
60
|
log.info(f"::group:: Get Cpython core :{core_type}")
|
61
61
|
req_filename = f"requirements-core-{core_type}.txt"
|
62
62
|
stub_path = Path(stub_folder) / f"cpython_core-{core_type}"
|
63
63
|
|
64
|
-
get_cpython.get_core(
|
64
|
+
get_cpython.get_core(
|
65
|
+
stub_path=stub_path.as_posix(), requirements=req_filename, family=core_type
|
66
|
+
)
|
65
67
|
stub_paths.append(stub_path)
|
66
68
|
|
67
69
|
log.info("::group:: start post processing of retrieved stubs")
|
@@ -6,7 +6,7 @@ get-docstubs
|
|
6
6
|
from pathlib import Path
|
7
7
|
from typing import Optional
|
8
8
|
|
9
|
-
import click
|
9
|
+
import rich_click as click
|
10
10
|
from loguru import logger as log
|
11
11
|
|
12
12
|
import stubber.basicgit as git
|
@@ -40,13 +40,15 @@ from .cli import stubber_cli
|
|
40
40
|
show_default=True,
|
41
41
|
)
|
42
42
|
# @click.option("--family", "-f", "basename", default="micropython", help="Micropython family.", show_default=True)
|
43
|
-
@click.option(
|
43
|
+
@click.option(
|
44
|
+
"--version", "--tag", default="", type=str, help="Version number to use. [default: Git tag]"
|
45
|
+
)
|
44
46
|
@click.option("--black/--no-black", "-b/-nb", default=True, help="Run black", show_default=True)
|
45
47
|
@click.pass_context
|
46
48
|
def cli_docstubs(
|
47
49
|
ctx: click.Context,
|
48
50
|
path: Optional[str] = None,
|
49
|
-
target:Optional[str] = None,
|
51
|
+
target: Optional[str] = None,
|
50
52
|
black: bool = True,
|
51
53
|
basename: Optional[str] = None,
|
52
54
|
version: str = "",
|
@@ -6,7 +6,7 @@
|
|
6
6
|
from pathlib import Path
|
7
7
|
from typing import List, Optional
|
8
8
|
|
9
|
-
import click
|
9
|
+
import rich_click as click
|
10
10
|
from loguru import logger as log
|
11
11
|
|
12
12
|
import stubber.utils as utils
|
@@ -85,7 +85,9 @@ def cli_get_frozen(
|
|
85
85
|
version = utils.checkedout_version(CONFIG.mpy_path)
|
86
86
|
log.info("MicroPython version : {}".format(version))
|
87
87
|
|
88
|
-
stub_path = freeze_any(
|
88
|
+
stub_path = freeze_any(
|
89
|
+
version=version, mpy_path=CONFIG.mpy_path, mpy_lib_path=CONFIG.mpy_lib_path
|
90
|
+
)
|
89
91
|
stub_paths.append(stub_path)
|
90
92
|
# Also enrich the frozen modules from the doc stubs if available
|
91
93
|
|
stubber/commands/get_mcu_cmd.py
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
##########################################################################################
|
6
6
|
|
7
7
|
|
8
|
-
import click
|
8
|
+
import rich_click as click
|
9
9
|
from loguru import logger as log
|
10
10
|
|
11
11
|
from stubber.bulk.mcu_stubber import stub_connected_mcus
|
@@ -37,7 +37,10 @@ from .cli import stubber_cli
|
|
37
37
|
)
|
38
38
|
@click.option("--debug/--no-debug", default=False, show_default=True, help="Debug mode.")
|
39
39
|
@click.option(
|
40
|
-
"--reset/--no-reset",
|
40
|
+
"--reset/--no-reset",
|
41
|
+
default=False,
|
42
|
+
show_default=True,
|
43
|
+
help="Reset the board before running createstubs.",
|
41
44
|
)
|
42
45
|
@click.option(
|
43
46
|
"--github/--local",
|
@@ -50,7 +53,9 @@ def cli_create_mcu_stubs(variant: str, format: str, debug: bool, reset: bool, gi
|
|
50
53
|
# check if all repos have been cloned
|
51
54
|
for repo in CONFIG.repos:
|
52
55
|
if not repo.exists():
|
53
|
-
log.error(
|
56
|
+
log.error(
|
57
|
+
f"Repo {repo} not found, use 'stubber clone --add-stubs' to clone the repos."
|
58
|
+
)
|
54
59
|
exit(1)
|
55
60
|
|
56
61
|
exit(stub_connected_mcus(variant=variant, format=format, debug=debug))
|
stubber/commands/merge_cmd.py
CHANGED
stubber/commands/publish_cmd.py
CHANGED
stubber/commands/stub_cmd.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
"""Create or update .pyi type hint files."""
|
2
|
+
|
2
3
|
##########################################################################################
|
3
4
|
# stub
|
4
5
|
##########################################################################################
|
@@ -7,7 +8,7 @@ from loguru import logger as log
|
|
7
8
|
from pathlib import Path
|
8
9
|
from typing import Union
|
9
10
|
|
10
|
-
import click
|
11
|
+
import rich_click as click
|
11
12
|
from stubber.utils import generate_pyi_files
|
12
13
|
from stubber.utils.post import do_post_processing
|
13
14
|
|
stubber/commands/switch_cmd.py
CHANGED
@@ -2,11 +2,10 @@
|
|
2
2
|
switch to a specific version of the micropython repos
|
3
3
|
"""
|
4
4
|
|
5
|
-
|
6
5
|
from pathlib import Path
|
7
6
|
from typing import Optional, Union
|
8
7
|
|
9
|
-
import click
|
8
|
+
import rich_click as click
|
10
9
|
|
11
10
|
import stubber.basicgit as git
|
12
11
|
from stubber.utils.config import CONFIG
|
@@ -23,7 +22,11 @@ from .cli import stubber_cli
|
|
23
22
|
# get version list from Git tags in the repo that is provided on the command line
|
24
23
|
|
25
24
|
try:
|
26
|
-
VERSION_LIST = git.get_tags("micropython/micropython", minver="v1.9.3") + [
|
25
|
+
VERSION_LIST = git.get_tags("micropython/micropython", minver="v1.9.3") + [
|
26
|
+
V_PREVIEW,
|
27
|
+
"latest",
|
28
|
+
"stable",
|
29
|
+
]
|
27
30
|
except Exception:
|
28
31
|
# offline fallback
|
29
32
|
VERSION_LIST = ["v1.91.1", "v1.20.1", "v1.21.0", "v1.22.1", "preview", "stable"]
|
@@ -31,7 +34,12 @@ except Exception:
|
|
31
34
|
|
32
35
|
@stubber_cli.command(name="switch")
|
33
36
|
@click.argument("tag", required=False, type=click.Choice(VERSION_LIST, case_sensitive=False))
|
34
|
-
@click.option(
|
37
|
+
@click.option(
|
38
|
+
"--path",
|
39
|
+
"-p",
|
40
|
+
default=CONFIG.repo_path.as_posix(),
|
41
|
+
type=click.Path(file_okay=False, dir_okay=True),
|
42
|
+
)
|
35
43
|
def cli_switch(path: Union[str, Path], tag: Optional[str] = None):
|
36
44
|
"""
|
37
45
|
Switch to a specific version of the micropython repos.
|
stubber/commands/variants_cmd.py
CHANGED
stubber/tools/manifestfile.py
CHANGED
@@ -26,10 +26,10 @@
|
|
26
26
|
# THE SOFTWARE.
|
27
27
|
|
28
28
|
from __future__ import print_function
|
29
|
-
|
30
29
|
import contextlib
|
31
30
|
import os
|
32
31
|
import sys
|
32
|
+
import glob
|
33
33
|
import tempfile
|
34
34
|
from collections import namedtuple
|
35
35
|
|
@@ -62,6 +62,9 @@ FILE_TYPE_LOCAL = 1
|
|
62
62
|
# URL to file. (TODO)
|
63
63
|
FILE_TYPE_HTTP = 2
|
64
64
|
|
65
|
+
# Default list of libraries in micropython-lib to search for library packages.
|
66
|
+
BASE_LIBRARY_NAMES = ("micropython", "python-stdlib", "python-ecosys")
|
67
|
+
|
65
68
|
|
66
69
|
class ManifestFileError(Exception):
|
67
70
|
pass
|
@@ -106,7 +109,7 @@ class ManifestPackageMetadata:
|
|
106
109
|
self.stdlib = False
|
107
110
|
|
108
111
|
# Allows a python-ecosys package to be annotated with the
|
109
|
-
# corresponding name in PyPI. e.g. micropython-lib/
|
112
|
+
# corresponding name in PyPI. e.g. micropython-lib/requests is based
|
110
113
|
# on pypi/requests.
|
111
114
|
self.pypi = None
|
112
115
|
# For a micropython package, this is the name that we will publish it
|
@@ -143,7 +146,7 @@ class ManifestPackageMetadata:
|
|
143
146
|
|
144
147
|
self.description = description
|
145
148
|
self.version = version
|
146
|
-
self.license =
|
149
|
+
self.license = license
|
147
150
|
self.author = author
|
148
151
|
self.pypi = pypi
|
149
152
|
self.pypi_publish = pypi_publish
|
@@ -194,6 +197,14 @@ class ManifestFile:
|
|
194
197
|
self._visited = set()
|
195
198
|
# Stack of metadata for each level.
|
196
199
|
self._metadata = [ManifestPackageMetadata()]
|
200
|
+
# Registered external libraries.
|
201
|
+
self._libraries = {}
|
202
|
+
# List of directories to search for packages.
|
203
|
+
self._library_dirs = []
|
204
|
+
# Add default micropython-lib libraries if $(MPY_LIB_DIR) has been specified.
|
205
|
+
if self._path_vars["MPY_LIB_DIR"]:
|
206
|
+
for lib in BASE_LIBRARY_NAMES:
|
207
|
+
self.add_library(lib, os.path.join("$(MPY_LIB_DIR)", lib))
|
197
208
|
|
198
209
|
def _resolve_path(self, path):
|
199
210
|
# Convert path to an absolute path, applying variable substitutions.
|
@@ -208,6 +219,7 @@ class ManifestFile:
|
|
208
219
|
"metadata": self.metadata,
|
209
220
|
"include": self.include,
|
210
221
|
"require": self.require,
|
222
|
+
"add_library": self.add_library,
|
211
223
|
"package": self.package,
|
212
224
|
"module": self.module,
|
213
225
|
"options": IncludeOptions(**kwargs),
|
@@ -271,13 +283,15 @@ class ManifestFile:
|
|
271
283
|
kind = KIND_COMPILE_AS_MPY
|
272
284
|
|
273
285
|
self._manifest_files.append(
|
274
|
-
ManifestOutput(
|
286
|
+
ManifestOutput(
|
287
|
+
FILE_TYPE_LOCAL, full_path, target_path, timestamp, kind, self._metadata[-1], opt
|
288
|
+
)
|
275
289
|
)
|
276
290
|
|
277
291
|
def _search(self, base_path, package_path, files, exts, kind, opt=None, strict=False):
|
278
292
|
base_path = self._resolve_path(base_path)
|
279
293
|
|
280
|
-
if files:
|
294
|
+
if files is not None:
|
281
295
|
# Use explicit list of files (relative to package_path).
|
282
296
|
for file in files:
|
283
297
|
if package_path:
|
@@ -386,14 +400,23 @@ class ManifestFile:
|
|
386
400
|
if is_require:
|
387
401
|
self._metadata.pop()
|
388
402
|
|
389
|
-
def
|
390
|
-
|
391
|
-
|
403
|
+
def _require_from_path(self, library_path, name, version, extra_kwargs):
|
404
|
+
for root, dirnames, filenames in os.walk(library_path):
|
405
|
+
if os.path.basename(root) == name and "manifest.py" in filenames:
|
406
|
+
self.include(root, is_require=True, **extra_kwargs)
|
407
|
+
return True
|
408
|
+
return False
|
392
409
|
|
393
|
-
|
410
|
+
def require(self, name, version=None, pypi=None, library=None, **kwargs):
|
411
|
+
"""
|
412
|
+
Require a package by name from micropython-lib.
|
394
413
|
|
395
414
|
Optionally specify pipy="package-name" to indicate that this should
|
396
415
|
use the named package from PyPI when building for CPython.
|
416
|
+
|
417
|
+
Optionally specify library="name" to reference a package from a
|
418
|
+
library that has been previously registered with add_library(). Otherwise
|
419
|
+
the list of library paths will be used.
|
397
420
|
"""
|
398
421
|
self._metadata[-1].check_initialised(self._mode)
|
399
422
|
|
@@ -404,24 +427,41 @@ class ManifestFile:
|
|
404
427
|
self._pypi_dependencies.append(pypi)
|
405
428
|
return
|
406
429
|
|
407
|
-
if
|
408
|
-
|
409
|
-
if
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
430
|
+
if library is not None:
|
431
|
+
# Find package in external library.
|
432
|
+
if library not in self._libraries:
|
433
|
+
raise ValueError("Unknown library '{}' for require('{}').".format(library, name))
|
434
|
+
library_path = self._libraries[library]
|
435
|
+
# Search for {library_path}/**/{name}/manifest.py.
|
436
|
+
if self._require_from_path(library_path, name, version, kwargs):
|
437
|
+
return
|
438
|
+
raise ValueError(
|
439
|
+
"Package '{}' not found in external library '{}' ({}).".format(
|
440
|
+
name, library, library_path
|
441
|
+
)
|
442
|
+
)
|
443
|
+
|
444
|
+
for lib_dir in self._library_dirs:
|
445
|
+
# Search for {lib_dir}/**/{name}/manifest.py.
|
446
|
+
if self._require_from_path(lib_dir, name, version, kwargs):
|
447
|
+
return
|
448
|
+
|
449
|
+
raise ValueError("Package '{}' not found in any known library.".format(name))
|
450
|
+
|
451
|
+
def add_library(self, library, library_path, prepend=False):
|
452
|
+
"""
|
453
|
+
Register the path to an external named library.
|
454
|
+
|
455
|
+
The path will be automatically searched when using require(). By default the
|
456
|
+
added library is added to the end of the list of libraries to search. Pass
|
457
|
+
`prepend=True` to add it to the start of the list.
|
458
|
+
|
459
|
+
Additionally, the added library can be explicitly requested by using
|
460
|
+
`require("name", library="library")`.
|
461
|
+
"""
|
462
|
+
library_path = self._resolve_path(library_path)
|
463
|
+
self._libraries[library] = library_path
|
464
|
+
self._library_dirs.insert(0 if prepend else len(self._library_dirs), library_path)
|
425
465
|
|
426
466
|
def package(self, package_path, files=None, base_path=".", opt=None):
|
427
467
|
"""
|
@@ -563,6 +603,9 @@ def main():
|
|
563
603
|
default=os.path.join(os.path.dirname(__file__), "../lib/micropython-lib"),
|
564
604
|
help="path to micropython-lib repo",
|
565
605
|
)
|
606
|
+
cmd_parser.add_argument(
|
607
|
+
"--unix-ffi", action="store_true", help="prepend unix-ffi to the library path"
|
608
|
+
)
|
566
609
|
cmd_parser.add_argument("--port", default=None, help="path to port dir")
|
567
610
|
cmd_parser.add_argument("--board", default=None, help="path to board dir")
|
568
611
|
cmd_parser.add_argument(
|
@@ -592,6 +635,8 @@ def main():
|
|
592
635
|
exit(1)
|
593
636
|
|
594
637
|
m = ManifestFile(mode, path_vars)
|
638
|
+
if args.unix_ffi:
|
639
|
+
m.add_library("unix-ffi", os.path.join("$(MPY_LIB_DIR)", "unix-ffi"), prepend=True)
|
595
640
|
for manifest_file in args.files:
|
596
641
|
try:
|
597
642
|
m.execute(manifest_file)
|
stubber/tools/readme.md
CHANGED
@@ -2,5 +2,6 @@ tools vendored from micropython
|
|
2
2
|
|
3
3
|
- manifestfile.py
|
4
4
|
- Micropython manifest file parser
|
5
|
-
-
|
6
|
-
-
|
5
|
+
- https://github.com/micropython/micropython/blob/master/tools/manifestfile.py
|
6
|
+
- v1.23.0
|
7
|
+
- https://raw.githubusercontent.com/micropython/micropython/v1.23.0/tools/manifestfile.py
|
File without changes
|
File without changes
|
{micropython_stubber-1.20.6.dist-info → micropython_stubber-1.23.0.dist-info}/entry_points.txt
RENAMED
File without changes
|