mposcli 0.5.0__tar.gz → 0.7.0__tar.gz
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.
- {mposcli-0.5.0 → mposcli-0.7.0}/PKG-INFO +56 -15
- {mposcli-0.5.0 → mposcli-0.7.0}/README.md +55 -14
- {mposcli-0.5.0 → mposcli-0.7.0}/mposcli/__init__.py +1 -1
- {mposcli-0.5.0 → mposcli-0.7.0}/mposcli/cli_app/copy_mpos.py +12 -19
- mposcli-0.7.0/mposcli/cli_app/shell.py +45 -0
- mposcli-0.7.0/mposcli/cli_app/update.py +102 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/mposcli/mpos_utils.py +1 -1
- {mposcli-0.5.0 → mposcli-0.7.0}/mposcli/tests/test_readme.py +13 -1
- {mposcli-0.5.0 → mposcli-0.7.0}/mposcli/utilities/mpremote.py +13 -8
- mposcli-0.5.0/mposcli/cli_app/update.py +0 -61
- {mposcli-0.5.0 → mposcli-0.7.0}/.editorconfig +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/.github/workflows/tests.yml +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/.gitignore +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/.idea/.gitignore +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/.pre-commit-config.yaml +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/.pre-commit-hooks.yaml +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/.run/Template Python tests.run.xml +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/.run/Template Python.run.xml +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/.run/Unittests __all__.run.xml +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/.run/cli --help.run.xml +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/.run/dev-cli --help.run.xml +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/.run/dev-cli test.run.xml +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/.venv-app/.gitignore +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/.venv-app/lib/python3.14/site-packages/cli_base/tests/shell_complete_snapshots/.gitignore +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/cli.py +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/dev-cli.py +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/dist/.gitignore +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/mposcli/__main__.py +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/mposcli/cli_app/__init__.py +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/mposcli/cli_app/build.py +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/mposcli/cli_app/flash.py +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/mposcli/cli_app/run_deskop.py +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/mposcli/cli_dev/__init__.py +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/mposcli/cli_dev/__main__.py +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/mposcli/cli_dev/code_style.py +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/mposcli/cli_dev/packaging.py +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/mposcli/cli_dev/shell_completion.py +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/mposcli/cli_dev/testing.py +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/mposcli/cli_dev/update_readme_history.py +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/mposcli/constants.py +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/mposcli/fs_utils.py +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/mposcli/tests/__init__.py +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/mposcli/tests/test_doctests.py +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/mposcli/tests/test_mpremote_cp_utils.py +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/mposcli/tests/test_project_setup.py +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/mposcli/tests/test_readme_history.py +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/mposcli/tools.py +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/mposcli/user_input.py +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/mposcli/utilities/__init__.py +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/noxfile.py +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/pyproject.toml +0 -0
- {mposcli-0.5.0 → mposcli-0.7.0}/uv.lock +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mposcli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.0
|
|
4
4
|
Summary: CLI helper for MicroPythonOS: https://github.com/MicroPythonOS/MicroPythonOS
|
|
5
5
|
Project-URL: Documentation, https://github.com/jedie/mposcli
|
|
6
6
|
Project-URL: Source, https://github.com/jedie/mposcli
|
|
@@ -47,7 +47,8 @@ cd ~/MicroPythonOS
|
|
|
47
47
|
|
|
48
48
|
[comment]: <> (✂✂✂ auto generated main help start ✂✂✂)
|
|
49
49
|
```
|
|
50
|
-
usage: mposcli [-h] {build,cp,cp-app,flash,run-desktop,update,update-
|
|
50
|
+
usage: mposcli [-h] {build,cp,cp-app,flash,run-desktop,shell,update,update-
|
|
51
|
+
submodules,version}
|
|
51
52
|
|
|
52
53
|
|
|
53
54
|
|
|
@@ -74,6 +75,9 @@ usage: mposcli [-h] {build,cp,cp-app,flash,run-desktop,update,update-submodules,
|
|
|
74
75
|
│ opythonos.com/os-development/installing-on-esp32/ │
|
|
75
76
|
│ • run-desktop Run MicroPythonOS on desktop. see: https://docs.micropythonos.c │
|
|
76
77
|
│ om/getting-started/running/#running-on-desktop │
|
|
78
|
+
│ • shell Start a REPL shell connected to the device using mpremote. │
|
|
79
|
+
│ Optional reset before starting the REPL. The goal it to try to │
|
|
80
|
+
│ get a REPL in a loop until it works. │
|
|
77
81
|
│ • update Update MicroPythonOS repository. Assume that there is a │
|
|
78
82
|
│ "origin" and/or "upstream" remote configured. Will also ask if │
|
|
79
83
|
│ you want to update the submodules as well, which is │
|
|
@@ -215,21 +219,47 @@ started/running/#running-on-desktop
|
|
|
215
219
|
|
|
216
220
|
|
|
217
221
|
|
|
222
|
+
## mposcli shell
|
|
223
|
+
|
|
224
|
+
[comment]: <> (✂✂✂ auto generated shell start ✂✂✂)
|
|
225
|
+
```
|
|
226
|
+
usage: mposcli shell [-h] [--reset | --no-reset] [-v]
|
|
227
|
+
|
|
228
|
+
Start a REPL shell connected to the device using mpremote. Optional reset before starting
|
|
229
|
+
the REPL. The goal it to try to get a REPL in a loop until it works.
|
|
230
|
+
|
|
231
|
+
╭─ options ────────────────────────────────────────────────────────────────────────╮
|
|
232
|
+
│ -h, --help show this help message and exit │
|
|
233
|
+
│ --reset, --no-reset Reset the device before starting the REPL? (default: False) │
|
|
234
|
+
│ -v, --verbosity Verbosity level; e.g.: -v, -vv, -vvv, etc. (repeatable) │
|
|
235
|
+
╰──────────────────────────────────────────────────────────────────────────────────╯
|
|
236
|
+
```
|
|
237
|
+
[comment]: <> (✂✂✂ auto generated shell end ✂✂✂)
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
218
242
|
## mposcli update
|
|
219
243
|
|
|
220
244
|
|
|
221
245
|
[comment]: <> (✂✂✂ auto generated update start ✂✂✂)
|
|
222
246
|
```
|
|
223
|
-
usage: mposcli update [-h] [-
|
|
247
|
+
usage: mposcli update [-h] [--cleanup | --no-cleanup] [--shallow-clone | --no-shallow-
|
|
248
|
+
clone] [-v]
|
|
224
249
|
|
|
225
250
|
Update MicroPythonOS repository. Assume that there is a "origin" and/or "upstream" remote
|
|
226
251
|
configured. Will also ask if you want to update the submodules as well, which is
|
|
227
252
|
recommended.
|
|
228
253
|
|
|
229
|
-
╭─ options
|
|
230
|
-
│ -h, --help show this help message and exit
|
|
231
|
-
│
|
|
232
|
-
|
|
254
|
+
╭─ options ──────────────────────────────────────────────────────────────────────────────╮
|
|
255
|
+
│ -h, --help show this help message and exit │
|
|
256
|
+
│ --cleanup, --no-cleanup │
|
|
257
|
+
│ Cleanup unnecessary files and optimize the local repository, too? │
|
|
258
|
+
│ (default: True) │
|
|
259
|
+
│ --shallow-clone, --no-shallow-clone │
|
|
260
|
+
│ Submodules only a shallow clone with --depth=1? (default: False) │
|
|
261
|
+
│ -v, --verbosity Verbosity level; e.g.: -v, -vv, -vvv, etc. (repeatable) │
|
|
262
|
+
╰────────────────────────────────────────────────────────────────────────────────────────╯
|
|
233
263
|
```
|
|
234
264
|
[comment]: <> (✂✂✂ auto generated update end ✂✂✂)
|
|
235
265
|
|
|
@@ -241,16 +271,22 @@ recommended.
|
|
|
241
271
|
|
|
242
272
|
[comment]: <> (✂✂✂ auto generated update-submodules start ✂✂✂)
|
|
243
273
|
```
|
|
244
|
-
usage: mposcli update-submodules [-h] [-
|
|
274
|
+
usage: mposcli update-submodules [-h] [--cleanup | --no-cleanup] [--shallow-clone | --no-
|
|
275
|
+
shallow-clone] [-v]
|
|
245
276
|
|
|
246
277
|
Updates MicroPythonOS git submodules only. Use "mposcli update" to update the main
|
|
247
278
|
repository and optionally the submodules as well. see: https://docs.micropythonos.com/os-
|
|
248
279
|
development/linux/#optional-updating-the-code
|
|
249
280
|
|
|
250
|
-
╭─ options
|
|
251
|
-
│ -h, --help show this help message and exit
|
|
252
|
-
│
|
|
253
|
-
|
|
281
|
+
╭─ options ──────────────────────────────────────────────────────────────────────────────╮
|
|
282
|
+
│ -h, --help show this help message and exit │
|
|
283
|
+
│ --cleanup, --no-cleanup │
|
|
284
|
+
│ Cleanup unnecessary files and optimize the local repository, too? │
|
|
285
|
+
│ (default: True) │
|
|
286
|
+
│ --shallow-clone, --no-shallow-clone │
|
|
287
|
+
│ Submodules only a shallow clone with --depth=1? (default: False) │
|
|
288
|
+
│ -v, --verbosity Verbosity level; e.g.: -v, -vv, -vvv, etc. (repeatable) │
|
|
289
|
+
╰────────────────────────────────────────────────────────────────────────────────────────╯
|
|
254
290
|
```
|
|
255
291
|
[comment]: <> (✂✂✂ auto generated update-submodules end ✂✂✂)
|
|
256
292
|
|
|
@@ -319,6 +355,11 @@ completion,test,update,update-readme-history,update-test-snapshot-files,version}
|
|
|
319
355
|
|
|
320
356
|
[comment]: <> (✂✂✂ auto generated history start ✂✂✂)
|
|
321
357
|
|
|
358
|
+
* [v0.7.0](https://github.com/jedie/mposcli/compare/v0.6.0...v0.7.0)
|
|
359
|
+
* 2026-03-24 - Safe diskspace in mposcli update / update-submodules
|
|
360
|
+
* 2026-03-22 - Use "retry loop" for copy, too
|
|
361
|
+
* [v0.6.0](https://github.com/jedie/mposcli/compare/v0.5.0...v0.6.0)
|
|
362
|
+
* 2026-03-21 - NEW: "shell" to start the REPL
|
|
322
363
|
* [v0.5.0](https://github.com/jedie/mposcli/compare/v0.4.1...v0.5.0)
|
|
323
364
|
* 2026-03-08 - update README
|
|
324
365
|
* 2026-03-05 - Enhance "cp" command and auto restart "mpremote repl"
|
|
@@ -326,6 +367,9 @@ completion,test,update,update-readme-history,update-test-snapshot-files,version}
|
|
|
326
367
|
* 2026-03-03 - flash command: use port auto detection as default
|
|
327
368
|
* [v0.4.1](https://github.com/jedie/mposcli/compare/v0.4.0...v0.4.1)
|
|
328
369
|
* 2026-02-27 - Use "--force" for pulling submodules to overwrite local changes
|
|
370
|
+
|
|
371
|
+
<details><summary>Expand older history entries ...</summary>
|
|
372
|
+
|
|
329
373
|
* [v0.4.0](https://github.com/jedie/mposcli/compare/v0.3.0...v0.4.0)
|
|
330
374
|
* 2026-02-24 - NEW command: "cp-app" to install/update internal_filesystem/apps
|
|
331
375
|
* 2026-02-24 - Log skipped files
|
|
@@ -336,9 +380,6 @@ completion,test,update,update-readme-history,update-test-snapshot-files,version}
|
|
|
336
380
|
* 2026-02-18 - Add "update" beside "update-submodules"
|
|
337
381
|
* 2026-02-17 - Update requirements
|
|
338
382
|
* 2026-02-16 - update README
|
|
339
|
-
|
|
340
|
-
<details><summary>Expand older history entries ...</summary>
|
|
341
|
-
|
|
342
383
|
* [v0.2.0](https://github.com/jedie/mposcli/compare/v0.1.0...v0.2.0)
|
|
343
384
|
* 2026-02-16 - New CLI command: "cp" with convenience features.
|
|
344
385
|
* 2026-02-16 - New command: "flash" with file selector
|
|
@@ -32,7 +32,8 @@ cd ~/MicroPythonOS
|
|
|
32
32
|
|
|
33
33
|
[comment]: <> (✂✂✂ auto generated main help start ✂✂✂)
|
|
34
34
|
```
|
|
35
|
-
usage: mposcli [-h] {build,cp,cp-app,flash,run-desktop,update,update-
|
|
35
|
+
usage: mposcli [-h] {build,cp,cp-app,flash,run-desktop,shell,update,update-
|
|
36
|
+
submodules,version}
|
|
36
37
|
|
|
37
38
|
|
|
38
39
|
|
|
@@ -59,6 +60,9 @@ usage: mposcli [-h] {build,cp,cp-app,flash,run-desktop,update,update-submodules,
|
|
|
59
60
|
│ opythonos.com/os-development/installing-on-esp32/ │
|
|
60
61
|
│ • run-desktop Run MicroPythonOS on desktop. see: https://docs.micropythonos.c │
|
|
61
62
|
│ om/getting-started/running/#running-on-desktop │
|
|
63
|
+
│ • shell Start a REPL shell connected to the device using mpremote. │
|
|
64
|
+
│ Optional reset before starting the REPL. The goal it to try to │
|
|
65
|
+
│ get a REPL in a loop until it works. │
|
|
62
66
|
│ • update Update MicroPythonOS repository. Assume that there is a │
|
|
63
67
|
│ "origin" and/or "upstream" remote configured. Will also ask if │
|
|
64
68
|
│ you want to update the submodules as well, which is │
|
|
@@ -200,21 +204,47 @@ started/running/#running-on-desktop
|
|
|
200
204
|
|
|
201
205
|
|
|
202
206
|
|
|
207
|
+
## mposcli shell
|
|
208
|
+
|
|
209
|
+
[comment]: <> (✂✂✂ auto generated shell start ✂✂✂)
|
|
210
|
+
```
|
|
211
|
+
usage: mposcli shell [-h] [--reset | --no-reset] [-v]
|
|
212
|
+
|
|
213
|
+
Start a REPL shell connected to the device using mpremote. Optional reset before starting
|
|
214
|
+
the REPL. The goal it to try to get a REPL in a loop until it works.
|
|
215
|
+
|
|
216
|
+
╭─ options ────────────────────────────────────────────────────────────────────────╮
|
|
217
|
+
│ -h, --help show this help message and exit │
|
|
218
|
+
│ --reset, --no-reset Reset the device before starting the REPL? (default: False) │
|
|
219
|
+
│ -v, --verbosity Verbosity level; e.g.: -v, -vv, -vvv, etc. (repeatable) │
|
|
220
|
+
╰──────────────────────────────────────────────────────────────────────────────────╯
|
|
221
|
+
```
|
|
222
|
+
[comment]: <> (✂✂✂ auto generated shell end ✂✂✂)
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
|
|
203
227
|
## mposcli update
|
|
204
228
|
|
|
205
229
|
|
|
206
230
|
[comment]: <> (✂✂✂ auto generated update start ✂✂✂)
|
|
207
231
|
```
|
|
208
|
-
usage: mposcli update [-h] [-
|
|
232
|
+
usage: mposcli update [-h] [--cleanup | --no-cleanup] [--shallow-clone | --no-shallow-
|
|
233
|
+
clone] [-v]
|
|
209
234
|
|
|
210
235
|
Update MicroPythonOS repository. Assume that there is a "origin" and/or "upstream" remote
|
|
211
236
|
configured. Will also ask if you want to update the submodules as well, which is
|
|
212
237
|
recommended.
|
|
213
238
|
|
|
214
|
-
╭─ options
|
|
215
|
-
│ -h, --help show this help message and exit
|
|
216
|
-
│
|
|
217
|
-
|
|
239
|
+
╭─ options ──────────────────────────────────────────────────────────────────────────────╮
|
|
240
|
+
│ -h, --help show this help message and exit │
|
|
241
|
+
│ --cleanup, --no-cleanup │
|
|
242
|
+
│ Cleanup unnecessary files and optimize the local repository, too? │
|
|
243
|
+
│ (default: True) │
|
|
244
|
+
│ --shallow-clone, --no-shallow-clone │
|
|
245
|
+
│ Submodules only a shallow clone with --depth=1? (default: False) │
|
|
246
|
+
│ -v, --verbosity Verbosity level; e.g.: -v, -vv, -vvv, etc. (repeatable) │
|
|
247
|
+
╰────────────────────────────────────────────────────────────────────────────────────────╯
|
|
218
248
|
```
|
|
219
249
|
[comment]: <> (✂✂✂ auto generated update end ✂✂✂)
|
|
220
250
|
|
|
@@ -226,16 +256,22 @@ recommended.
|
|
|
226
256
|
|
|
227
257
|
[comment]: <> (✂✂✂ auto generated update-submodules start ✂✂✂)
|
|
228
258
|
```
|
|
229
|
-
usage: mposcli update-submodules [-h] [-
|
|
259
|
+
usage: mposcli update-submodules [-h] [--cleanup | --no-cleanup] [--shallow-clone | --no-
|
|
260
|
+
shallow-clone] [-v]
|
|
230
261
|
|
|
231
262
|
Updates MicroPythonOS git submodules only. Use "mposcli update" to update the main
|
|
232
263
|
repository and optionally the submodules as well. see: https://docs.micropythonos.com/os-
|
|
233
264
|
development/linux/#optional-updating-the-code
|
|
234
265
|
|
|
235
|
-
╭─ options
|
|
236
|
-
│ -h, --help show this help message and exit
|
|
237
|
-
│
|
|
238
|
-
|
|
266
|
+
╭─ options ──────────────────────────────────────────────────────────────────────────────╮
|
|
267
|
+
│ -h, --help show this help message and exit │
|
|
268
|
+
│ --cleanup, --no-cleanup │
|
|
269
|
+
│ Cleanup unnecessary files and optimize the local repository, too? │
|
|
270
|
+
│ (default: True) │
|
|
271
|
+
│ --shallow-clone, --no-shallow-clone │
|
|
272
|
+
│ Submodules only a shallow clone with --depth=1? (default: False) │
|
|
273
|
+
│ -v, --verbosity Verbosity level; e.g.: -v, -vv, -vvv, etc. (repeatable) │
|
|
274
|
+
╰────────────────────────────────────────────────────────────────────────────────────────╯
|
|
239
275
|
```
|
|
240
276
|
[comment]: <> (✂✂✂ auto generated update-submodules end ✂✂✂)
|
|
241
277
|
|
|
@@ -304,6 +340,11 @@ completion,test,update,update-readme-history,update-test-snapshot-files,version}
|
|
|
304
340
|
|
|
305
341
|
[comment]: <> (✂✂✂ auto generated history start ✂✂✂)
|
|
306
342
|
|
|
343
|
+
* [v0.7.0](https://github.com/jedie/mposcli/compare/v0.6.0...v0.7.0)
|
|
344
|
+
* 2026-03-24 - Safe diskspace in mposcli update / update-submodules
|
|
345
|
+
* 2026-03-22 - Use "retry loop" for copy, too
|
|
346
|
+
* [v0.6.0](https://github.com/jedie/mposcli/compare/v0.5.0...v0.6.0)
|
|
347
|
+
* 2026-03-21 - NEW: "shell" to start the REPL
|
|
307
348
|
* [v0.5.0](https://github.com/jedie/mposcli/compare/v0.4.1...v0.5.0)
|
|
308
349
|
* 2026-03-08 - update README
|
|
309
350
|
* 2026-03-05 - Enhance "cp" command and auto restart "mpremote repl"
|
|
@@ -311,6 +352,9 @@ completion,test,update,update-readme-history,update-test-snapshot-files,version}
|
|
|
311
352
|
* 2026-03-03 - flash command: use port auto detection as default
|
|
312
353
|
* [v0.4.1](https://github.com/jedie/mposcli/compare/v0.4.0...v0.4.1)
|
|
313
354
|
* 2026-02-27 - Use "--force" for pulling submodules to overwrite local changes
|
|
355
|
+
|
|
356
|
+
<details><summary>Expand older history entries ...</summary>
|
|
357
|
+
|
|
314
358
|
* [v0.4.0](https://github.com/jedie/mposcli/compare/v0.3.0...v0.4.0)
|
|
315
359
|
* 2026-02-24 - NEW command: "cp-app" to install/update internal_filesystem/apps
|
|
316
360
|
* 2026-02-24 - Log skipped files
|
|
@@ -321,9 +365,6 @@ completion,test,update,update-readme-history,update-test-snapshot-files,version}
|
|
|
321
365
|
* 2026-02-18 - Add "update" beside "update-submodules"
|
|
322
366
|
* 2026-02-17 - Update requirements
|
|
323
367
|
* 2026-02-16 - update README
|
|
324
|
-
|
|
325
|
-
<details><summary>Expand older history entries ...</summary>
|
|
326
|
-
|
|
327
368
|
* [v0.2.0](https://github.com/jedie/mposcli/compare/v0.1.0...v0.2.0)
|
|
328
369
|
* 2026-02-16 - New CLI command: "cp" with convenience features.
|
|
329
370
|
* 2026-02-16 - New command: "flash" with file selector
|
|
@@ -14,7 +14,7 @@ from mposcli.cli_app import app
|
|
|
14
14
|
from mposcli.mpos_utils import get_mpos_path
|
|
15
15
|
from mposcli.tools import get_mpremote_bin
|
|
16
16
|
from mposcli.user_input import choose_newest_modified_directory, get_newest_files
|
|
17
|
-
from mposcli.utilities.mpremote import MpOsPathResolver, start_mpremote_repl
|
|
17
|
+
from mposcli.utilities.mpremote import MpOsPathResolver, check_call_loop, start_mpremote_repl
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
logger = logging.getLogger(__name__)
|
|
@@ -79,12 +79,11 @@ def cp(
|
|
|
79
79
|
else:
|
|
80
80
|
print(f'Copying file "[bold]{local_path_str}[/bold]" to device at "[bold]{remote_str}[/bold]" ...')
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
verbose=True,
|
|
82
|
+
popenargs += ('cp', local_path_str, remote_str)
|
|
83
|
+
check_call_loop(
|
|
84
|
+
popen_args=popenargs,
|
|
85
|
+
max_try=10,
|
|
86
|
+
wait_time=1,
|
|
88
87
|
cwd=mpos_path,
|
|
89
88
|
text=None,
|
|
90
89
|
)
|
|
@@ -146,9 +145,11 @@ def cp_app(
|
|
|
146
145
|
remote_path = f':/apps/{app.name}'
|
|
147
146
|
|
|
148
147
|
popenargs += (local_path, remote_path)
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
148
|
+
|
|
149
|
+
check_call_loop(
|
|
150
|
+
popen_args=popenargs,
|
|
151
|
+
max_try=10,
|
|
152
|
+
wait_time=1,
|
|
152
153
|
cwd=mpos_path,
|
|
153
154
|
text=None,
|
|
154
155
|
)
|
|
@@ -164,12 +165,4 @@ def cp_app(
|
|
|
164
165
|
)
|
|
165
166
|
|
|
166
167
|
if repl:
|
|
167
|
-
|
|
168
|
-
verbose_check_call(
|
|
169
|
-
mpremote_bin,
|
|
170
|
-
'repl',
|
|
171
|
-
verbose=True,
|
|
172
|
-
cwd=mpos_path,
|
|
173
|
-
timeout=None,
|
|
174
|
-
text=None,
|
|
175
|
-
)
|
|
168
|
+
start_mpremote_repl()
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
import time
|
|
3
|
+
from typing import Annotated
|
|
4
|
+
|
|
5
|
+
import tyro
|
|
6
|
+
from cli_base.cli_tools.subprocess_utils import verbose_check_call
|
|
7
|
+
from cli_base.cli_tools.verbosity import setup_logging
|
|
8
|
+
from cli_base.tyro_commands import TyroVerbosityArgType
|
|
9
|
+
|
|
10
|
+
from mposcli.cli_app import app
|
|
11
|
+
from mposcli.mpos_utils import get_mpos_path
|
|
12
|
+
from mposcli.tools import get_mpremote_bin
|
|
13
|
+
from mposcli.utilities.mpremote import start_mpremote_repl
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
logger = logging.getLogger(__name__)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@app.command
|
|
20
|
+
def shell(
|
|
21
|
+
reset: Annotated[
|
|
22
|
+
bool,
|
|
23
|
+
tyro.conf.arg(help='Reset the device before starting the REPL?'),
|
|
24
|
+
] = False,
|
|
25
|
+
verbosity: TyroVerbosityArgType = 1,
|
|
26
|
+
):
|
|
27
|
+
"""
|
|
28
|
+
Start a REPL shell connected to the device using mpremote. Optional reset before starting the REPL.
|
|
29
|
+
The goal it to try to get a REPL in a loop until it works.
|
|
30
|
+
"""
|
|
31
|
+
setup_logging(verbosity=verbosity)
|
|
32
|
+
mpos_path = get_mpos_path()
|
|
33
|
+
mpremote_bin = get_mpremote_bin()
|
|
34
|
+
|
|
35
|
+
if reset:
|
|
36
|
+
time.sleep(1)
|
|
37
|
+
verbose_check_call(
|
|
38
|
+
mpremote_bin,
|
|
39
|
+
'reset',
|
|
40
|
+
verbose=True,
|
|
41
|
+
cwd=mpos_path,
|
|
42
|
+
text=None,
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
start_mpremote_repl()
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
import shutil
|
|
3
|
+
from typing import Annotated
|
|
4
|
+
|
|
5
|
+
import tyro
|
|
6
|
+
from cli_base.cli_tools.git import Git
|
|
7
|
+
from cli_base.cli_tools.verbosity import setup_logging
|
|
8
|
+
from cli_base.tyro_commands import TyroVerbosityArgType
|
|
9
|
+
from rich import print
|
|
10
|
+
|
|
11
|
+
from mposcli.cli_app import app
|
|
12
|
+
from mposcli.mpos_utils import get_mpos_path
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
logger = logging.getLogger(__name__)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _update_submodules(git: Git, *, cleanup, shallow_clone):
|
|
19
|
+
if shallow_clone:
|
|
20
|
+
git.git_verbose_check_call('submodule', 'deinit', '-f', '--all')
|
|
21
|
+
modules_path = git.cwd / '.git' / 'modules'
|
|
22
|
+
if modules_path.exists():
|
|
23
|
+
shutil.rmtree(modules_path)
|
|
24
|
+
git.git_verbose_check_call('submodule', 'update', '--init', '--depth', '1', '--recursive')
|
|
25
|
+
else:
|
|
26
|
+
git.git_verbose_check_call(
|
|
27
|
+
'submodule', 'foreach', '--recursive', 'git', 'clean', '-f', ';', 'git', 'checkout', '.'
|
|
28
|
+
)
|
|
29
|
+
git.git_verbose_check_call('pull', '--recurse-submodules', '--force')
|
|
30
|
+
|
|
31
|
+
if cleanup:
|
|
32
|
+
git.git_verbose_check_call(
|
|
33
|
+
'submodule', 'foreach', '--recursive', 'git', 'gc', '--aggressive', '--prune=now'
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@app.command
|
|
38
|
+
def update_submodules(
|
|
39
|
+
cleanup: Annotated[
|
|
40
|
+
bool,
|
|
41
|
+
tyro.conf.arg(help='Cleanup unnecessary files and optimize the local repository, too?'),
|
|
42
|
+
] = True,
|
|
43
|
+
shallow_clone: Annotated[
|
|
44
|
+
bool,
|
|
45
|
+
tyro.conf.arg(help='Submodules only a shallow clone with --depth=1?'),
|
|
46
|
+
] = False,
|
|
47
|
+
verbosity: TyroVerbosityArgType = 1,
|
|
48
|
+
):
|
|
49
|
+
"""
|
|
50
|
+
Updates MicroPythonOS git submodules only.
|
|
51
|
+
Use "mposcli update" to update the main repository and optionally the submodules as well.
|
|
52
|
+
see: https://docs.micropythonos.com/os-development/linux/#optional-updating-the-code
|
|
53
|
+
"""
|
|
54
|
+
setup_logging(verbosity=verbosity)
|
|
55
|
+
mpos_path = get_mpos_path()
|
|
56
|
+
git = Git(cwd=mpos_path)
|
|
57
|
+
_update_submodules(git, cleanup=cleanup, shallow_clone=shallow_clone)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
@app.command
|
|
61
|
+
def update(
|
|
62
|
+
cleanup: Annotated[
|
|
63
|
+
bool,
|
|
64
|
+
tyro.conf.arg(help='Cleanup unnecessary files and optimize the local repository, too?'),
|
|
65
|
+
] = True,
|
|
66
|
+
shallow_clone: Annotated[
|
|
67
|
+
bool,
|
|
68
|
+
tyro.conf.arg(help='Submodules only a shallow clone with --depth=1?'),
|
|
69
|
+
] = False,
|
|
70
|
+
verbosity: TyroVerbosityArgType = 1,
|
|
71
|
+
):
|
|
72
|
+
"""
|
|
73
|
+
Update MicroPythonOS repository. Assume that there is a "origin" and/or "upstream" remote configured.
|
|
74
|
+
Will also ask if you want to update the submodules as well, which is recommended.
|
|
75
|
+
"""
|
|
76
|
+
setup_logging(verbosity=verbosity)
|
|
77
|
+
mpos_path = get_mpos_path()
|
|
78
|
+
git = Git(cwd=mpos_path)
|
|
79
|
+
|
|
80
|
+
main_branch_name = git.get_main_branch_name()
|
|
81
|
+
print(f'The main branch is: [yellow blue]{main_branch_name}')
|
|
82
|
+
|
|
83
|
+
git.git_verbose_check_call('fetch', '--all')
|
|
84
|
+
|
|
85
|
+
output = git.git_verbose_check_output('remote')
|
|
86
|
+
remotes = output.splitlines()
|
|
87
|
+
print(f'Git {remotes=}')
|
|
88
|
+
|
|
89
|
+
for remote_name in ('origin', 'upstream'):
|
|
90
|
+
if remote_name in remotes:
|
|
91
|
+
git.git_verbose_check_call('rebase', '--no-verify', f'{remote_name}/{main_branch_name}', exit_on_error=True)
|
|
92
|
+
else:
|
|
93
|
+
print(f'[yellow]Remote "{remote_name}" not found, skipping rebase to it.')
|
|
94
|
+
|
|
95
|
+
if cleanup:
|
|
96
|
+
print('\nCleaning up the git repository...\n')
|
|
97
|
+
git.git_verbose_check_call('gc', '--aggressive', '--prune=now')
|
|
98
|
+
|
|
99
|
+
print('\n')
|
|
100
|
+
if input('Do you want to update submodules as well? [Y/n] (default: Yes): ') in ('y', ''):
|
|
101
|
+
print('\nUpdating submodules...\n')
|
|
102
|
+
_update_submodules(git, cleanup=cleanup, shallow_clone=shallow_clone)
|
|
@@ -16,7 +16,7 @@ def get_mpos_path() -> Path:
|
|
|
16
16
|
current_path = Path().cwd().resolve()
|
|
17
17
|
logger.info('Current working directory: %s', current_path)
|
|
18
18
|
|
|
19
|
-
for dir_name in ('internal_filesystem',
|
|
19
|
+
for dir_name in ('internal_filesystem', 'lvgl_micropython'):
|
|
20
20
|
dir_path = current_path / dir_name
|
|
21
21
|
logger.debug('Checking for directory: %s', dir_path)
|
|
22
22
|
if not dir_path.is_dir():
|
|
@@ -83,7 +83,19 @@ class ReadmeTestCase(BaseTestCase):
|
|
|
83
83
|
|
|
84
84
|
commands.discard('version') # version is pseudo command, because the version always printed on every CLI call
|
|
85
85
|
commands = sorted(commands)
|
|
86
|
-
self.assertEqual(
|
|
86
|
+
self.assertEqual(
|
|
87
|
+
commands,
|
|
88
|
+
[
|
|
89
|
+
'build',
|
|
90
|
+
'cp',
|
|
91
|
+
'cp-app',
|
|
92
|
+
'flash',
|
|
93
|
+
'run-desktop',
|
|
94
|
+
'shell',
|
|
95
|
+
'update',
|
|
96
|
+
'update-submodules',
|
|
97
|
+
],
|
|
98
|
+
)
|
|
87
99
|
|
|
88
100
|
for command in commands:
|
|
89
101
|
with self.subTest(command):
|
|
@@ -45,20 +45,25 @@ class MpOsPathResolver:
|
|
|
45
45
|
return local_path_str, remote_str
|
|
46
46
|
|
|
47
47
|
|
|
48
|
-
def
|
|
49
|
-
print('Starting mpremote REPL...')
|
|
50
|
-
time.sleep(wait_time)
|
|
51
|
-
mpremote_bin = get_mpremote_bin()
|
|
52
|
-
|
|
53
|
-
popen_args = (mpremote_bin, 'repl')
|
|
54
|
-
|
|
48
|
+
def check_call_loop(*, popen_args, max_try=10, wait_time=1, **popen_kwargs):
|
|
55
49
|
for try_count in range(max_try):
|
|
56
50
|
print(f'\n+ {shlex.join(str(arg) for arg in popen_args)}')
|
|
57
51
|
try:
|
|
58
|
-
return subprocess.check_call(popen_args)
|
|
52
|
+
return subprocess.check_call(popen_args, **popen_kwargs)
|
|
59
53
|
except subprocess.CalledProcessError as err:
|
|
60
54
|
print(
|
|
61
55
|
f'[yellow]mpremote finished with [red]exit code {err.returncode!r}[/red]'
|
|
62
56
|
f' Retrying in {wait_time} seconds... (try {try_count + 1}/{max_try})'
|
|
63
57
|
)
|
|
64
58
|
time.sleep(wait_time)
|
|
59
|
+
raise RuntimeError(f'mpremote failed after {max_try} attempts')
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def start_mpremote_repl(max_try=10, wait_time=1):
|
|
63
|
+
print('Starting mpremote REPL...')
|
|
64
|
+
mpremote_bin = get_mpremote_bin()
|
|
65
|
+
return check_call_loop(
|
|
66
|
+
popen_args=(mpremote_bin, 'repl'),
|
|
67
|
+
max_try=max_try,
|
|
68
|
+
wait_time=wait_time,
|
|
69
|
+
)
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import logging
|
|
2
|
-
|
|
3
|
-
from cli_base.cli_tools.git import Git
|
|
4
|
-
from cli_base.cli_tools.verbosity import setup_logging
|
|
5
|
-
from cli_base.tyro_commands import TyroVerbosityArgType
|
|
6
|
-
from rich import print
|
|
7
|
-
|
|
8
|
-
from mposcli.cli_app import app
|
|
9
|
-
from mposcli.mpos_utils import get_mpos_path
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
logger = logging.getLogger(__name__)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def _update_submodules(git: Git):
|
|
16
|
-
git.git_verbose_check_call('submodule', 'foreach', '--recursive', 'git', 'clean', '-f', ';', 'git', 'checkout', '.')
|
|
17
|
-
git.git_verbose_check_call('pull', '--recurse-submodules', '--force')
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
@app.command
|
|
21
|
-
def update_submodules(verbosity: TyroVerbosityArgType = 1):
|
|
22
|
-
"""
|
|
23
|
-
Updates MicroPythonOS git submodules only.
|
|
24
|
-
Use "mposcli update" to update the main repository and optionally the submodules as well.
|
|
25
|
-
see: https://docs.micropythonos.com/os-development/linux/#optional-updating-the-code
|
|
26
|
-
"""
|
|
27
|
-
setup_logging(verbosity=verbosity)
|
|
28
|
-
mpos_path = get_mpos_path()
|
|
29
|
-
git = Git(cwd=mpos_path)
|
|
30
|
-
_update_submodules(git)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
@app.command
|
|
34
|
-
def update(verbosity: TyroVerbosityArgType = 1):
|
|
35
|
-
"""
|
|
36
|
-
Update MicroPythonOS repository. Assume that there is a "origin" and/or "upstream" remote configured.
|
|
37
|
-
Will also ask if you want to update the submodules as well, which is recommended.
|
|
38
|
-
"""
|
|
39
|
-
setup_logging(verbosity=verbosity)
|
|
40
|
-
mpos_path = get_mpos_path()
|
|
41
|
-
git = Git(cwd=mpos_path)
|
|
42
|
-
|
|
43
|
-
main_branch_name = git.get_main_branch_name()
|
|
44
|
-
print(f'The main branch is: [yellow blue]{main_branch_name}')
|
|
45
|
-
|
|
46
|
-
git.git_verbose_check_call('fetch', '--all')
|
|
47
|
-
|
|
48
|
-
output = git.git_verbose_check_output('remote')
|
|
49
|
-
remotes = output.splitlines()
|
|
50
|
-
print(f'Git {remotes=}')
|
|
51
|
-
|
|
52
|
-
for remote_name in ('origin', 'upstream'):
|
|
53
|
-
if remote_name in remotes:
|
|
54
|
-
git.git_verbose_check_call('rebase', '--no-verify', f'{remote_name}/{main_branch_name}', exit_on_error=True)
|
|
55
|
-
else:
|
|
56
|
-
print(f'[yellow]Remote "{remote_name}" not found, skipping rebase to it.')
|
|
57
|
-
|
|
58
|
-
print('\n')
|
|
59
|
-
if input('Do you want to update submodules as well? [Y/n] (default: Yes): ') in ('y', ''):
|
|
60
|
-
print('\nUpdating submodules...\n')
|
|
61
|
-
_update_submodules(git)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|