mposcli 0.7.1__tar.gz → 0.8.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.7.1 → mposcli-0.8.0}/.pre-commit-config.yaml +1 -1
- {mposcli-0.7.1 → mposcli-0.8.0}/PKG-INFO +23 -12
- {mposcli-0.7.1 → mposcli-0.8.0}/README.md +22 -11
- mposcli-0.8.0/dist/.gitignore +1 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/mposcli/__init__.py +1 -1
- {mposcli-0.7.1 → mposcli-0.8.0}/mposcli/cli_app/build.py +1 -1
- {mposcli-0.7.1 → mposcli-0.8.0}/mposcli/cli_app/copy_mpos.py +2 -2
- {mposcli-0.7.1 → mposcli-0.8.0}/mposcli/cli_app/update.py +46 -14
- {mposcli-0.7.1 → mposcli-0.8.0}/mposcli/tests/test_mpremote_cp_utils.py +2 -2
- mposcli-0.8.0/mposcli/utilities/__init__.py +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/mposcli/utilities/mpremote.py +2 -13
- {mposcli-0.7.1 → mposcli-0.8.0}/uv.lock +290 -280
- {mposcli-0.7.1 → mposcli-0.8.0}/.editorconfig +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/.github/workflows/tests.yml +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/.gitignore +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/.idea/.gitignore +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/.pre-commit-hooks.yaml +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/.run/Template Python tests.run.xml +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/.run/Template Python.run.xml +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/.run/Unittests __all__.run.xml +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/.run/cli --help.run.xml +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/.run/dev-cli --help.run.xml +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/.run/dev-cli test.run.xml +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/.venv-app/.gitignore +0 -0
- {mposcli-0.7.1/dist → mposcli-0.8.0/.venv-app/lib/python3.14/site-packages/cli_base/tests/shell_complete_snapshots/.cache/uv}/.gitignore +0 -0
- /mposcli-0.7.1/mposcli/utilities/__init__.py → /mposcli-0.8.0/.venv-app/lib/python3.14/site-packages/cli_base/tests/shell_complete_snapshots/.cache/uv/sdists-v9/.gitignore +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/.venv-app/lib/python3.14/site-packages/cli_base/tests/shell_complete_snapshots/.gitignore +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/cli.py +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/dev-cli.py +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/mposcli/__main__.py +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/mposcli/cli_app/__init__.py +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/mposcli/cli_app/flash.py +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/mposcli/cli_app/run_deskop.py +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/mposcli/cli_app/shell.py +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/mposcli/cli_dev/__init__.py +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/mposcli/cli_dev/__main__.py +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/mposcli/cli_dev/code_style.py +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/mposcli/cli_dev/packaging.py +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/mposcli/cli_dev/shell_completion.py +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/mposcli/cli_dev/testing.py +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/mposcli/cli_dev/update_readme_history.py +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/mposcli/constants.py +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/mposcli/fs_utils.py +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/mposcli/mpos_utils.py +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/mposcli/shared_tyro.py +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/mposcli/tests/__init__.py +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/mposcli/tests/test_doctests.py +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/mposcli/tests/test_project_setup.py +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/mposcli/tests/test_readme.py +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/mposcli/tests/test_readme_history.py +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/mposcli/tools.py +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/mposcli/user_input.py +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/noxfile.py +0 -0
- {mposcli-0.7.1 → mposcli-0.8.0}/pyproject.toml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mposcli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8.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
|
|
@@ -97,13 +97,13 @@ submodules,version}
|
|
|
97
97
|
|
|
98
98
|
[comment]: <> (✂✂✂ auto generated build start ✂✂✂)
|
|
99
99
|
```
|
|
100
|
-
usage: mposcli build [-h] [{esp32,esp32s3,unphone,unix,macOS}] [-v]
|
|
100
|
+
usage: mposcli build [-h] [{esp32,esp32-small,esp32s3,unphone,unix,macOS}] [-v]
|
|
101
101
|
|
|
102
102
|
Build MicroPythonOS by calling: ./scripts/build_mpos.sh <target> see:
|
|
103
103
|
https://docs.micropythonos.com/os-development/
|
|
104
104
|
|
|
105
105
|
╭─ positional arguments ───────────────────────────────────────────────────╮
|
|
106
|
-
│ [{esp32,esp32s3,unphone,unix,macOS}]
|
|
106
|
+
│ [{esp32,esp32-small,esp32s3,unphone,unix,macOS}] │
|
|
107
107
|
│ Target platform to build for. (default: unix) │
|
|
108
108
|
╰──────────────────────────────────────────────────────────────────────────╯
|
|
109
109
|
╭─ options ────────────────────────────────────────────────────────────────╮
|
|
@@ -244,8 +244,7 @@ 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] [
|
|
248
|
-
clone] [-v]
|
|
247
|
+
usage: mposcli update [-h] [UPDATE OPTIONS]
|
|
249
248
|
|
|
250
249
|
Update MicroPythonOS repository. Assume that there is a "origin" and/or "upstream" remote
|
|
251
250
|
configured. Will also ask if you want to update the submodules as well, which is
|
|
@@ -257,7 +256,11 @@ recommended.
|
|
|
257
256
|
│ Cleanup unnecessary files and optimize the local repository, too? │
|
|
258
257
|
│ (default: True) │
|
|
259
258
|
│ --shallow-clone, --no-shallow-clone │
|
|
260
|
-
│ Submodules only a shallow clone with --depth=1? (default:
|
|
259
|
+
│ Submodules only a shallow clone with --depth=1? (default: True) │
|
|
260
|
+
│ --reset-submodules, --no-reset-submodules │
|
|
261
|
+
│ Drop and recreate all submodules? (Takes a while) (default: False) │
|
|
262
|
+
│ --jobs INT git submodule update --jobs argument, i.e. how many submodules to │
|
|
263
|
+
│ update in parallel (default: 16) │
|
|
261
264
|
│ -v, --verbosity Verbosity level; e.g.: -v, -vv, -vvv, etc. (repeatable) │
|
|
262
265
|
╰────────────────────────────────────────────────────────────────────────────────────────╯
|
|
263
266
|
```
|
|
@@ -271,8 +274,7 @@ recommended.
|
|
|
271
274
|
|
|
272
275
|
[comment]: <> (✂✂✂ auto generated update-submodules start ✂✂✂)
|
|
273
276
|
```
|
|
274
|
-
usage: mposcli update-submodules [-h] [
|
|
275
|
-
shallow-clone] [-v]
|
|
277
|
+
usage: mposcli update-submodules [-h] [UPDATE-SUBMODULES OPTIONS]
|
|
276
278
|
|
|
277
279
|
Updates MicroPythonOS git submodules only. Use "mposcli update" to update the main
|
|
278
280
|
repository and optionally the submodules as well. see: https://docs.micropythonos.com/os-
|
|
@@ -284,7 +286,11 @@ development/linux/#optional-updating-the-code
|
|
|
284
286
|
│ Cleanup unnecessary files and optimize the local repository, too? │
|
|
285
287
|
│ (default: True) │
|
|
286
288
|
│ --shallow-clone, --no-shallow-clone │
|
|
287
|
-
│ Submodules only a shallow clone with --depth=1? (default:
|
|
289
|
+
│ Submodules only a shallow clone with --depth=1? (default: True) │
|
|
290
|
+
│ --reset-submodules, --no-reset-submodules │
|
|
291
|
+
│ Drop and recreate all submodules? (Takes a while) (default: False) │
|
|
292
|
+
│ --jobs INT git submodule update --jobs argument, i.e. how many submodules to │
|
|
293
|
+
│ update in parallel (default: 16) │
|
|
288
294
|
│ -v, --verbosity Verbosity level; e.g.: -v, -vv, -vvv, etc. (repeatable) │
|
|
289
295
|
╰────────────────────────────────────────────────────────────────────────────────────────╯
|
|
290
296
|
```
|
|
@@ -355,6 +361,11 @@ completion,test,update,update-readme-history,update-test-snapshot-files,version}
|
|
|
355
361
|
|
|
356
362
|
[comment]: <> (✂✂✂ auto generated history start ✂✂✂)
|
|
357
363
|
|
|
364
|
+
* [v0.8.0](https://github.com/jedie/mposcli/compare/v0.7.1...v0.8.0)
|
|
365
|
+
* 2026-04-08 - Update build targets
|
|
366
|
+
* 2026-04-08 - Enhance git submodule update
|
|
367
|
+
* 2026-04-08 - update requirements
|
|
368
|
+
* 2026-03-31 - Fix local <-> device filesystem mapping
|
|
358
369
|
* [v0.7.1](https://github.com/jedie/mposcli/compare/v0.7.0...v0.7.1)
|
|
359
370
|
* 2026-03-24 - Warn if non executeable build found
|
|
360
371
|
* 2026-03-24 - Set log level to WARNING as default
|
|
@@ -363,14 +374,14 @@ completion,test,update,update-readme-history,update-test-snapshot-files,version}
|
|
|
363
374
|
* 2026-03-22 - Use "retry loop" for copy, too
|
|
364
375
|
* [v0.6.0](https://github.com/jedie/mposcli/compare/v0.5.0...v0.6.0)
|
|
365
376
|
* 2026-03-21 - NEW: "shell" to start the REPL
|
|
377
|
+
|
|
378
|
+
<details><summary>Expand older history entries ...</summary>
|
|
379
|
+
|
|
366
380
|
* [v0.5.0](https://github.com/jedie/mposcli/compare/v0.4.1...v0.5.0)
|
|
367
381
|
* 2026-03-08 - update README
|
|
368
382
|
* 2026-03-05 - Enhance "cp" command and auto restart "mpremote repl"
|
|
369
383
|
* 2026-03-03 - Refactor "cp" command
|
|
370
384
|
* 2026-03-03 - flash command: use port auto detection as default
|
|
371
|
-
|
|
372
|
-
<details><summary>Expand older history entries ...</summary>
|
|
373
|
-
|
|
374
385
|
* [v0.4.1](https://github.com/jedie/mposcli/compare/v0.4.0...v0.4.1)
|
|
375
386
|
* 2026-02-27 - Use "--force" for pulling submodules to overwrite local changes
|
|
376
387
|
* [v0.4.0](https://github.com/jedie/mposcli/compare/v0.3.0...v0.4.0)
|
|
@@ -82,13 +82,13 @@ submodules,version}
|
|
|
82
82
|
|
|
83
83
|
[comment]: <> (✂✂✂ auto generated build start ✂✂✂)
|
|
84
84
|
```
|
|
85
|
-
usage: mposcli build [-h] [{esp32,esp32s3,unphone,unix,macOS}] [-v]
|
|
85
|
+
usage: mposcli build [-h] [{esp32,esp32-small,esp32s3,unphone,unix,macOS}] [-v]
|
|
86
86
|
|
|
87
87
|
Build MicroPythonOS by calling: ./scripts/build_mpos.sh <target> see:
|
|
88
88
|
https://docs.micropythonos.com/os-development/
|
|
89
89
|
|
|
90
90
|
╭─ positional arguments ───────────────────────────────────────────────────╮
|
|
91
|
-
│ [{esp32,esp32s3,unphone,unix,macOS}]
|
|
91
|
+
│ [{esp32,esp32-small,esp32s3,unphone,unix,macOS}] │
|
|
92
92
|
│ Target platform to build for. (default: unix) │
|
|
93
93
|
╰──────────────────────────────────────────────────────────────────────────╯
|
|
94
94
|
╭─ options ────────────────────────────────────────────────────────────────╮
|
|
@@ -229,8 +229,7 @@ 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] [
|
|
233
|
-
clone] [-v]
|
|
232
|
+
usage: mposcli update [-h] [UPDATE OPTIONS]
|
|
234
233
|
|
|
235
234
|
Update MicroPythonOS repository. Assume that there is a "origin" and/or "upstream" remote
|
|
236
235
|
configured. Will also ask if you want to update the submodules as well, which is
|
|
@@ -242,7 +241,11 @@ recommended.
|
|
|
242
241
|
│ Cleanup unnecessary files and optimize the local repository, too? │
|
|
243
242
|
│ (default: True) │
|
|
244
243
|
│ --shallow-clone, --no-shallow-clone │
|
|
245
|
-
│ Submodules only a shallow clone with --depth=1? (default:
|
|
244
|
+
│ Submodules only a shallow clone with --depth=1? (default: True) │
|
|
245
|
+
│ --reset-submodules, --no-reset-submodules │
|
|
246
|
+
│ Drop and recreate all submodules? (Takes a while) (default: False) │
|
|
247
|
+
│ --jobs INT git submodule update --jobs argument, i.e. how many submodules to │
|
|
248
|
+
│ update in parallel (default: 16) │
|
|
246
249
|
│ -v, --verbosity Verbosity level; e.g.: -v, -vv, -vvv, etc. (repeatable) │
|
|
247
250
|
╰────────────────────────────────────────────────────────────────────────────────────────╯
|
|
248
251
|
```
|
|
@@ -256,8 +259,7 @@ recommended.
|
|
|
256
259
|
|
|
257
260
|
[comment]: <> (✂✂✂ auto generated update-submodules start ✂✂✂)
|
|
258
261
|
```
|
|
259
|
-
usage: mposcli update-submodules [-h] [
|
|
260
|
-
shallow-clone] [-v]
|
|
262
|
+
usage: mposcli update-submodules [-h] [UPDATE-SUBMODULES OPTIONS]
|
|
261
263
|
|
|
262
264
|
Updates MicroPythonOS git submodules only. Use "mposcli update" to update the main
|
|
263
265
|
repository and optionally the submodules as well. see: https://docs.micropythonos.com/os-
|
|
@@ -269,7 +271,11 @@ development/linux/#optional-updating-the-code
|
|
|
269
271
|
│ Cleanup unnecessary files and optimize the local repository, too? │
|
|
270
272
|
│ (default: True) │
|
|
271
273
|
│ --shallow-clone, --no-shallow-clone │
|
|
272
|
-
│ Submodules only a shallow clone with --depth=1? (default:
|
|
274
|
+
│ Submodules only a shallow clone with --depth=1? (default: True) │
|
|
275
|
+
│ --reset-submodules, --no-reset-submodules │
|
|
276
|
+
│ Drop and recreate all submodules? (Takes a while) (default: False) │
|
|
277
|
+
│ --jobs INT git submodule update --jobs argument, i.e. how many submodules to │
|
|
278
|
+
│ update in parallel (default: 16) │
|
|
273
279
|
│ -v, --verbosity Verbosity level; e.g.: -v, -vv, -vvv, etc. (repeatable) │
|
|
274
280
|
╰────────────────────────────────────────────────────────────────────────────────────────╯
|
|
275
281
|
```
|
|
@@ -340,6 +346,11 @@ completion,test,update,update-readme-history,update-test-snapshot-files,version}
|
|
|
340
346
|
|
|
341
347
|
[comment]: <> (✂✂✂ auto generated history start ✂✂✂)
|
|
342
348
|
|
|
349
|
+
* [v0.8.0](https://github.com/jedie/mposcli/compare/v0.7.1...v0.8.0)
|
|
350
|
+
* 2026-04-08 - Update build targets
|
|
351
|
+
* 2026-04-08 - Enhance git submodule update
|
|
352
|
+
* 2026-04-08 - update requirements
|
|
353
|
+
* 2026-03-31 - Fix local <-> device filesystem mapping
|
|
343
354
|
* [v0.7.1](https://github.com/jedie/mposcli/compare/v0.7.0...v0.7.1)
|
|
344
355
|
* 2026-03-24 - Warn if non executeable build found
|
|
345
356
|
* 2026-03-24 - Set log level to WARNING as default
|
|
@@ -348,14 +359,14 @@ completion,test,update,update-readme-history,update-test-snapshot-files,version}
|
|
|
348
359
|
* 2026-03-22 - Use "retry loop" for copy, too
|
|
349
360
|
* [v0.6.0](https://github.com/jedie/mposcli/compare/v0.5.0...v0.6.0)
|
|
350
361
|
* 2026-03-21 - NEW: "shell" to start the REPL
|
|
362
|
+
|
|
363
|
+
<details><summary>Expand older history entries ...</summary>
|
|
364
|
+
|
|
351
365
|
* [v0.5.0](https://github.com/jedie/mposcli/compare/v0.4.1...v0.5.0)
|
|
352
366
|
* 2026-03-08 - update README
|
|
353
367
|
* 2026-03-05 - Enhance "cp" command and auto restart "mpremote repl"
|
|
354
368
|
* 2026-03-03 - Refactor "cp" command
|
|
355
369
|
* 2026-03-03 - flash command: use port auto detection as default
|
|
356
|
-
|
|
357
|
-
<details><summary>Expand older history entries ...</summary>
|
|
358
|
-
|
|
359
370
|
* [v0.4.1](https://github.com/jedie/mposcli/compare/v0.4.0...v0.4.1)
|
|
360
371
|
* 2026-02-27 - Use "--force" for pulling submodules to overwrite local changes
|
|
361
372
|
* [v0.4.0](https://github.com/jedie/mposcli/compare/v0.3.0...v0.4.0)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
*
|
|
@@ -18,7 +18,7 @@ logger = logging.getLogger(__name__)
|
|
|
18
18
|
@app.command
|
|
19
19
|
def build(
|
|
20
20
|
target: Annotated[
|
|
21
|
-
Literal['esp32', 'esp32s3', 'unphone', 'unix', 'macOS'],
|
|
21
|
+
Literal['esp32', 'esp32-small', 'esp32s3', 'unphone', 'unix', 'macOS'],
|
|
22
22
|
tyro.conf.arg(
|
|
23
23
|
help='Target platform to build for.',
|
|
24
24
|
),
|
|
@@ -58,10 +58,10 @@ def cp(
|
|
|
58
58
|
|
|
59
59
|
if not local_path:
|
|
60
60
|
# Let's the user select from the list of the newest modified files in internal_filesystem/lib/mpos:
|
|
61
|
-
local_path = get_newest_files(resolver.
|
|
61
|
+
local_path = get_newest_files(resolver.internal_fs, limit=new_file_limit)
|
|
62
62
|
if not local_path:
|
|
63
63
|
print('Copy/update all files in lib/mpos to the device')
|
|
64
|
-
local_path = resolver.
|
|
64
|
+
local_path = resolver.internal_fs
|
|
65
65
|
|
|
66
66
|
print(f'Copy/update app: "{local_path}" ...')
|
|
67
67
|
|
|
@@ -14,24 +14,36 @@ from mposcli.shared_tyro import DEFAULT_VERBOSITY, TyroVerbosityArgType
|
|
|
14
14
|
|
|
15
15
|
logger = logging.getLogger(__name__)
|
|
16
16
|
|
|
17
|
+
GIT_JOBS_DEFAULT = 16
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
|
|
20
|
+
def _update_submodules(git: Git, *, cleanup, shallow_clone, reset_submodules, jobs: int):
|
|
21
|
+
if reset_submodules:
|
|
22
|
+
git.git_verbose_check_call('submodule', 'deinit', '--force', '--all')
|
|
21
23
|
modules_path = git.cwd / '.git' / 'modules'
|
|
22
24
|
if modules_path.exists():
|
|
23
25
|
shutil.rmtree(modules_path)
|
|
24
|
-
git.git_verbose_check_call('
|
|
26
|
+
git.git_verbose_check_call('gc', '--aggressive', '--prune=now')
|
|
27
|
+
|
|
28
|
+
args = ('submodule', 'update', '--init', '--recursive', '--jobs', str(jobs))
|
|
29
|
+
if shallow_clone:
|
|
30
|
+
args += ('--depth', '1')
|
|
31
|
+
git.git_verbose_check_call(*args)
|
|
25
32
|
else:
|
|
33
|
+
git.git_verbose_check_call('submodule', 'sync', '--recursive')
|
|
34
|
+
git.git_verbose_check_call('submodule', 'foreach', '--recursive', 'git', 'reset', '--hard')
|
|
35
|
+
git.git_verbose_check_call('submodule', 'foreach', '--recursive', 'git', 'clean', '-ffdx')
|
|
36
|
+
git.git_verbose_check_call('submodule', 'foreach', '--recursive', 'git', 'fetch', '--all', '--jobs', str(jobs))
|
|
37
|
+
|
|
38
|
+
args = ('submodule', 'update', '--init', '--recursive', '--force', '--jobs', str(jobs))
|
|
39
|
+
if shallow_clone:
|
|
40
|
+
args += ('--depth', '1')
|
|
41
|
+
git.git_verbose_check_call(*args)
|
|
42
|
+
|
|
43
|
+
if cleanup:
|
|
26
44
|
git.git_verbose_check_call(
|
|
27
|
-
'submodule', 'foreach', '--recursive', 'git', '
|
|
45
|
+
'submodule', 'foreach', '--recursive', 'git', 'gc', '--prune=now',
|
|
28
46
|
)
|
|
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
47
|
|
|
36
48
|
|
|
37
49
|
@app.command
|
|
@@ -43,7 +55,15 @@ def update_submodules(
|
|
|
43
55
|
shallow_clone: Annotated[
|
|
44
56
|
bool,
|
|
45
57
|
tyro.conf.arg(help='Submodules only a shallow clone with --depth=1?'),
|
|
58
|
+
] = True,
|
|
59
|
+
reset_submodules: Annotated[
|
|
60
|
+
bool,
|
|
61
|
+
tyro.conf.arg(help='Drop and recreate all submodules? (Takes a while)'),
|
|
46
62
|
] = False,
|
|
63
|
+
jobs: Annotated[
|
|
64
|
+
int,
|
|
65
|
+
tyro.conf.arg(help='git submodule update --jobs argument, i.e. how many submodules to update in parallel'),
|
|
66
|
+
] = GIT_JOBS_DEFAULT,
|
|
47
67
|
verbosity: TyroVerbosityArgType = DEFAULT_VERBOSITY,
|
|
48
68
|
):
|
|
49
69
|
"""
|
|
@@ -54,7 +74,7 @@ def update_submodules(
|
|
|
54
74
|
setup_logging(verbosity=verbosity)
|
|
55
75
|
mpos_path = get_mpos_path()
|
|
56
76
|
git = Git(cwd=mpos_path)
|
|
57
|
-
_update_submodules(git, cleanup=cleanup, shallow_clone=shallow_clone)
|
|
77
|
+
_update_submodules(git, cleanup=cleanup, shallow_clone=shallow_clone, reset_submodules=reset_submodules, jobs=jobs)
|
|
58
78
|
|
|
59
79
|
|
|
60
80
|
@app.command
|
|
@@ -66,7 +86,15 @@ def update(
|
|
|
66
86
|
shallow_clone: Annotated[
|
|
67
87
|
bool,
|
|
68
88
|
tyro.conf.arg(help='Submodules only a shallow clone with --depth=1?'),
|
|
89
|
+
] = True,
|
|
90
|
+
reset_submodules: Annotated[
|
|
91
|
+
bool,
|
|
92
|
+
tyro.conf.arg(help='Drop and recreate all submodules? (Takes a while)'),
|
|
69
93
|
] = False,
|
|
94
|
+
jobs: Annotated[
|
|
95
|
+
int,
|
|
96
|
+
tyro.conf.arg(help='git submodule update --jobs argument, i.e. how many submodules to update in parallel'),
|
|
97
|
+
] = GIT_JOBS_DEFAULT,
|
|
70
98
|
verbosity: TyroVerbosityArgType = DEFAULT_VERBOSITY,
|
|
71
99
|
):
|
|
72
100
|
"""
|
|
@@ -88,7 +116,9 @@ def update(
|
|
|
88
116
|
|
|
89
117
|
for remote_name in ('origin', 'upstream'):
|
|
90
118
|
if remote_name in remotes:
|
|
91
|
-
git.git_verbose_check_call(
|
|
119
|
+
git.git_verbose_check_call(
|
|
120
|
+
'rebase', '--no-verify', f'{remote_name}/{main_branch_name}', '--force', exit_on_error=True
|
|
121
|
+
)
|
|
92
122
|
else:
|
|
93
123
|
print(f'[yellow]Remote "{remote_name}" not found, skipping rebase to it.')
|
|
94
124
|
|
|
@@ -99,4 +129,6 @@ def update(
|
|
|
99
129
|
print('\n')
|
|
100
130
|
if input('Do you want to update submodules as well? [Y/n] (default: Yes): ') in ('y', ''):
|
|
101
131
|
print('\nUpdating submodules...\n')
|
|
102
|
-
_update_submodules(
|
|
132
|
+
_update_submodules(
|
|
133
|
+
git, cleanup=cleanup, shallow_clone=shallow_clone, reset_submodules=reset_submodules, jobs=jobs
|
|
134
|
+
)
|
|
@@ -47,14 +47,14 @@ class ProjectSetupTestCase(TestCase):
|
|
|
47
47
|
resolver.resolve(mpos_path / 'internal_filesystem/lib/mpos/board/'),
|
|
48
48
|
(
|
|
49
49
|
'internal_filesystem/lib/mpos/board/',
|
|
50
|
-
':mpos/',
|
|
50
|
+
':lib/mpos/',
|
|
51
51
|
),
|
|
52
52
|
)
|
|
53
53
|
self.assertEqual(
|
|
54
54
|
resolver.resolve(mpos_path / 'internal_filesystem/lib/mpos/board/unphone.py'),
|
|
55
55
|
(
|
|
56
56
|
'internal_filesystem/lib/mpos/board/unphone.py',
|
|
57
|
-
':mpos/board/unphone.py',
|
|
57
|
+
':lib/mpos/board/unphone.py',
|
|
58
58
|
),
|
|
59
59
|
)
|
|
60
60
|
|
|
File without changes
|
|
@@ -3,7 +3,6 @@ import subprocess
|
|
|
3
3
|
import time
|
|
4
4
|
from pathlib import Path
|
|
5
5
|
|
|
6
|
-
from bx_py_utils.path import assert_is_dir
|
|
7
6
|
from rich import print
|
|
8
7
|
|
|
9
8
|
from mposcli.tools import get_mpremote_bin
|
|
@@ -13,24 +12,14 @@ class MpOsPathResolver:
|
|
|
13
12
|
def __init__(self, mpos: Path):
|
|
14
13
|
self.mpos = mpos # e.g.: ~/repos/MicroPythonOS
|
|
15
14
|
self.internal_fs = mpos / 'internal_filesystem'
|
|
16
|
-
self.lib_mpos = self.internal_fs / 'lib' / 'mpos'
|
|
17
|
-
assert_is_dir(self.lib_mpos)
|
|
18
|
-
self.apps_path = self.internal_fs / 'apps'
|
|
19
|
-
assert_is_dir(self.apps_path)
|
|
20
15
|
|
|
21
16
|
def resolve(self, source: Path):
|
|
22
17
|
source = source.resolve()
|
|
23
18
|
assert source.exists(), f'Not existing path: {source=}'
|
|
24
19
|
assert source.is_relative_to(self.mpos), f'{source=} is not inside {self.mpos=}'
|
|
20
|
+
assert source.is_relative_to(self.internal_fs), f'{source=} is not inside {self.internal_fs=}'
|
|
25
21
|
|
|
26
|
-
|
|
27
|
-
device_base_path = self.apps_path.parent
|
|
28
|
-
elif source.is_relative_to(self.lib_mpos):
|
|
29
|
-
device_base_path = self.lib_mpos.parent
|
|
30
|
-
elif source.is_relative_to(self.internal_fs):
|
|
31
|
-
device_base_path = self.internal_fs
|
|
32
|
-
else:
|
|
33
|
-
raise ValueError(f'Path {source} is not in a recognized location')
|
|
22
|
+
device_base_path = self.internal_fs
|
|
34
23
|
|
|
35
24
|
remote_path = source.relative_to(device_base_path)
|
|
36
25
|
source_path = source.relative_to(self.mpos)
|