mposcli 0.6.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.6.0 → mposcli-0.7.0}/PKG-INFO +29 -14
- {mposcli-0.6.0 → mposcli-0.7.0}/README.md +28 -13
- {mposcli-0.6.0 → mposcli-0.7.0}/mposcli/__init__.py +1 -1
- {mposcli-0.6.0 → mposcli-0.7.0}/mposcli/cli_app/copy_mpos.py +12 -19
- mposcli-0.7.0/mposcli/cli_app/update.py +102 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/mposcli/mpos_utils.py +1 -1
- {mposcli-0.6.0 → mposcli-0.7.0}/mposcli/utilities/mpremote.py +13 -8
- mposcli-0.6.0/mposcli/cli_app/update.py +0 -61
- {mposcli-0.6.0 → mposcli-0.7.0}/.editorconfig +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/.github/workflows/tests.yml +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/.gitignore +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/.idea/.gitignore +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/.pre-commit-config.yaml +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/.pre-commit-hooks.yaml +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/.run/Template Python tests.run.xml +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/.run/Template Python.run.xml +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/.run/Unittests __all__.run.xml +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/.run/cli --help.run.xml +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/.run/dev-cli --help.run.xml +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/.run/dev-cli test.run.xml +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/.venv-app/.gitignore +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/.venv-app/lib/python3.14/site-packages/cli_base/tests/shell_complete_snapshots/.gitignore +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/cli.py +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/dev-cli.py +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/dist/.gitignore +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/mposcli/__main__.py +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/mposcli/cli_app/__init__.py +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/mposcli/cli_app/build.py +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/mposcli/cli_app/flash.py +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/mposcli/cli_app/run_deskop.py +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/mposcli/cli_app/shell.py +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/mposcli/cli_dev/__init__.py +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/mposcli/cli_dev/__main__.py +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/mposcli/cli_dev/code_style.py +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/mposcli/cli_dev/packaging.py +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/mposcli/cli_dev/shell_completion.py +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/mposcli/cli_dev/testing.py +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/mposcli/cli_dev/update_readme_history.py +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/mposcli/constants.py +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/mposcli/fs_utils.py +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/mposcli/tests/__init__.py +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/mposcli/tests/test_doctests.py +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/mposcli/tests/test_mpremote_cp_utils.py +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/mposcli/tests/test_project_setup.py +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/mposcli/tests/test_readme.py +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/mposcli/tests/test_readme_history.py +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/mposcli/tools.py +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/mposcli/user_input.py +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/mposcli/utilities/__init__.py +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/noxfile.py +0 -0
- {mposcli-0.6.0 → mposcli-0.7.0}/pyproject.toml +0 -0
- {mposcli-0.6.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
|
|
@@ -244,16 +244,22 @@ the REPL. The goal it to try to get a REPL in a loop until it works.
|
|
|
244
244
|
|
|
245
245
|
[comment]: <> (✂✂✂ auto generated update start ✂✂✂)
|
|
246
246
|
```
|
|
247
|
-
usage: mposcli update [-h] [-
|
|
247
|
+
usage: mposcli update [-h] [--cleanup | --no-cleanup] [--shallow-clone | --no-shallow-
|
|
248
|
+
clone] [-v]
|
|
248
249
|
|
|
249
250
|
Update MicroPythonOS repository. Assume that there is a "origin" and/or "upstream" remote
|
|
250
251
|
configured. Will also ask if you want to update the submodules as well, which is
|
|
251
252
|
recommended.
|
|
252
253
|
|
|
253
|
-
╭─ options
|
|
254
|
-
│ -h, --help show this help message and exit
|
|
255
|
-
│
|
|
256
|
-
|
|
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
|
+
╰────────────────────────────────────────────────────────────────────────────────────────╯
|
|
257
263
|
```
|
|
258
264
|
[comment]: <> (✂✂✂ auto generated update end ✂✂✂)
|
|
259
265
|
|
|
@@ -265,16 +271,22 @@ recommended.
|
|
|
265
271
|
|
|
266
272
|
[comment]: <> (✂✂✂ auto generated update-submodules start ✂✂✂)
|
|
267
273
|
```
|
|
268
|
-
usage: mposcli update-submodules [-h] [-
|
|
274
|
+
usage: mposcli update-submodules [-h] [--cleanup | --no-cleanup] [--shallow-clone | --no-
|
|
275
|
+
shallow-clone] [-v]
|
|
269
276
|
|
|
270
277
|
Updates MicroPythonOS git submodules only. Use "mposcli update" to update the main
|
|
271
278
|
repository and optionally the submodules as well. see: https://docs.micropythonos.com/os-
|
|
272
279
|
development/linux/#optional-updating-the-code
|
|
273
280
|
|
|
274
|
-
╭─ options
|
|
275
|
-
│ -h, --help show this help message and exit
|
|
276
|
-
│
|
|
277
|
-
|
|
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
|
+
╰────────────────────────────────────────────────────────────────────────────────────────╯
|
|
278
290
|
```
|
|
279
291
|
[comment]: <> (✂✂✂ auto generated update-submodules end ✂✂✂)
|
|
280
292
|
|
|
@@ -343,6 +355,9 @@ completion,test,update,update-readme-history,update-test-snapshot-files,version}
|
|
|
343
355
|
|
|
344
356
|
[comment]: <> (✂✂✂ auto generated history start ✂✂✂)
|
|
345
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
|
|
346
361
|
* [v0.6.0](https://github.com/jedie/mposcli/compare/v0.5.0...v0.6.0)
|
|
347
362
|
* 2026-03-21 - NEW: "shell" to start the REPL
|
|
348
363
|
* [v0.5.0](https://github.com/jedie/mposcli/compare/v0.4.1...v0.5.0)
|
|
@@ -352,15 +367,15 @@ completion,test,update,update-readme-history,update-test-snapshot-files,version}
|
|
|
352
367
|
* 2026-03-03 - flash command: use port auto detection as default
|
|
353
368
|
* [v0.4.1](https://github.com/jedie/mposcli/compare/v0.4.0...v0.4.1)
|
|
354
369
|
* 2026-02-27 - Use "--force" for pulling submodules to overwrite local changes
|
|
370
|
+
|
|
371
|
+
<details><summary>Expand older history entries ...</summary>
|
|
372
|
+
|
|
355
373
|
* [v0.4.0](https://github.com/jedie/mposcli/compare/v0.3.0...v0.4.0)
|
|
356
374
|
* 2026-02-24 - NEW command: "cp-app" to install/update internal_filesystem/apps
|
|
357
375
|
* 2026-02-24 - Log skipped files
|
|
358
376
|
* 2026-02-23 - Update requirements and fix code style
|
|
359
377
|
* 2026-02-23 - "build" command: target as positional argument
|
|
360
378
|
* 2026-02-23 - Expand "cp" command and allow optional filesystem path
|
|
361
|
-
|
|
362
|
-
<details><summary>Expand older history entries ...</summary>
|
|
363
|
-
|
|
364
379
|
* [v0.3.0](https://github.com/jedie/mposcli/compare/v0.2.0...v0.3.0)
|
|
365
380
|
* 2026-02-18 - Add "update" beside "update-submodules"
|
|
366
381
|
* 2026-02-17 - Update requirements
|
|
@@ -229,16 +229,22 @@ the REPL. The goal it to try to get a REPL in a loop until it works.
|
|
|
229
229
|
|
|
230
230
|
[comment]: <> (✂✂✂ auto generated update start ✂✂✂)
|
|
231
231
|
```
|
|
232
|
-
usage: mposcli update [-h] [-
|
|
232
|
+
usage: mposcli update [-h] [--cleanup | --no-cleanup] [--shallow-clone | --no-shallow-
|
|
233
|
+
clone] [-v]
|
|
233
234
|
|
|
234
235
|
Update MicroPythonOS repository. Assume that there is a "origin" and/or "upstream" remote
|
|
235
236
|
configured. Will also ask if you want to update the submodules as well, which is
|
|
236
237
|
recommended.
|
|
237
238
|
|
|
238
|
-
╭─ options
|
|
239
|
-
│ -h, --help show this help message and exit
|
|
240
|
-
│
|
|
241
|
-
|
|
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
|
+
╰────────────────────────────────────────────────────────────────────────────────────────╯
|
|
242
248
|
```
|
|
243
249
|
[comment]: <> (✂✂✂ auto generated update end ✂✂✂)
|
|
244
250
|
|
|
@@ -250,16 +256,22 @@ recommended.
|
|
|
250
256
|
|
|
251
257
|
[comment]: <> (✂✂✂ auto generated update-submodules start ✂✂✂)
|
|
252
258
|
```
|
|
253
|
-
usage: mposcli update-submodules [-h] [-
|
|
259
|
+
usage: mposcli update-submodules [-h] [--cleanup | --no-cleanup] [--shallow-clone | --no-
|
|
260
|
+
shallow-clone] [-v]
|
|
254
261
|
|
|
255
262
|
Updates MicroPythonOS git submodules only. Use "mposcli update" to update the main
|
|
256
263
|
repository and optionally the submodules as well. see: https://docs.micropythonos.com/os-
|
|
257
264
|
development/linux/#optional-updating-the-code
|
|
258
265
|
|
|
259
|
-
╭─ options
|
|
260
|
-
│ -h, --help show this help message and exit
|
|
261
|
-
│
|
|
262
|
-
|
|
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
|
+
╰────────────────────────────────────────────────────────────────────────────────────────╯
|
|
263
275
|
```
|
|
264
276
|
[comment]: <> (✂✂✂ auto generated update-submodules end ✂✂✂)
|
|
265
277
|
|
|
@@ -328,6 +340,9 @@ completion,test,update,update-readme-history,update-test-snapshot-files,version}
|
|
|
328
340
|
|
|
329
341
|
[comment]: <> (✂✂✂ auto generated history start ✂✂✂)
|
|
330
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
|
|
331
346
|
* [v0.6.0](https://github.com/jedie/mposcli/compare/v0.5.0...v0.6.0)
|
|
332
347
|
* 2026-03-21 - NEW: "shell" to start the REPL
|
|
333
348
|
* [v0.5.0](https://github.com/jedie/mposcli/compare/v0.4.1...v0.5.0)
|
|
@@ -337,15 +352,15 @@ completion,test,update,update-readme-history,update-test-snapshot-files,version}
|
|
|
337
352
|
* 2026-03-03 - flash command: use port auto detection as default
|
|
338
353
|
* [v0.4.1](https://github.com/jedie/mposcli/compare/v0.4.0...v0.4.1)
|
|
339
354
|
* 2026-02-27 - Use "--force" for pulling submodules to overwrite local changes
|
|
355
|
+
|
|
356
|
+
<details><summary>Expand older history entries ...</summary>
|
|
357
|
+
|
|
340
358
|
* [v0.4.0](https://github.com/jedie/mposcli/compare/v0.3.0...v0.4.0)
|
|
341
359
|
* 2026-02-24 - NEW command: "cp-app" to install/update internal_filesystem/apps
|
|
342
360
|
* 2026-02-24 - Log skipped files
|
|
343
361
|
* 2026-02-23 - Update requirements and fix code style
|
|
344
362
|
* 2026-02-23 - "build" command: target as positional argument
|
|
345
363
|
* 2026-02-23 - Expand "cp" command and allow optional filesystem path
|
|
346
|
-
|
|
347
|
-
<details><summary>Expand older history entries ...</summary>
|
|
348
|
-
|
|
349
364
|
* [v0.3.0](https://github.com/jedie/mposcli/compare/v0.2.0...v0.3.0)
|
|
350
365
|
* 2026-02-18 - Add "update" beside "update-submodules"
|
|
351
366
|
* 2026-02-17 - Update requirements
|
|
@@ -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,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():
|
|
@@ -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
|
|
File without changes
|
|
File without changes
|