diff options
author | Joel Challis <git@zvecr.com> | 2023-01-02 22:11:57 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-03 09:11:57 +1100 |
commit | b297531dbf645a28fd5a67e546a9ff27d49e1b1e (patch) | |
tree | d16cd659a2cde4d5c665f147c30ab4a9c86ae4cd /lib/python/qmk/cli | |
parent | 3a5a4c708f4817919d9fe7396ceb2b8e57d2e68e (diff) |
Migrate 'make git-submodule' to CLI command (#19479)
Diffstat (limited to 'lib/python/qmk/cli')
-rw-r--r-- | lib/python/qmk/cli/__init__.py | 1 | ||||
-rw-r--r-- | lib/python/qmk/cli/git/__init__.py | 0 | ||||
-rw-r--r-- | lib/python/qmk/cli/git/submodule.py | 22 |
3 files changed, 23 insertions, 0 deletions
diff --git a/lib/python/qmk/cli/__init__.py b/lib/python/qmk/cli/__init__.py index a6d53c1cb6..e0ab67da7b 100644 --- a/lib/python/qmk/cli/__init__.py +++ b/lib/python/qmk/cli/__init__.py @@ -61,6 +61,7 @@ subcommands = [ 'qmk.cli.generate.rgb_breathe_table', 'qmk.cli.generate.rules_mk', 'qmk.cli.generate.version_h', + 'qmk.cli.git.submodule', 'qmk.cli.hello', 'qmk.cli.import.kbfirmware', 'qmk.cli.import.keyboard', diff --git a/lib/python/qmk/cli/git/__init__.py b/lib/python/qmk/cli/git/__init__.py new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/lib/python/qmk/cli/git/__init__.py diff --git a/lib/python/qmk/cli/git/submodule.py b/lib/python/qmk/cli/git/submodule.py new file mode 100644 index 0000000000..bcc3868a52 --- /dev/null +++ b/lib/python/qmk/cli/git/submodule.py @@ -0,0 +1,22 @@ +import shutil +from qmk.path import normpath + +from milc import cli + +REMOVE_DIRS = [ + 'lib/ugfx', + 'lib/pico-sdk', + 'lib/chibios-contrib/ext/mcux-sdk', + 'lib/lvgl', +] + + +@cli.subcommand('Git Submodule actions.') +def git_submodule(cli): + for folder in REMOVE_DIRS: + if normpath(folder).is_dir(): + print(f"Removing '{folder}'") + shutil.rmtree(folder) + + cli.run(['git', 'submodule', 'sync', '--recursive'], capture_output=False) + cli.run(['git', 'submodule', 'update', '--init', '--recursive', '--progress'], capture_output=False) |