From b297531dbf645a28fd5a67e546a9ff27d49e1b1e Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Mon, 2 Jan 2023 22:11:57 +0000 Subject: Migrate 'make git-submodule' to CLI command (#19479) --- lib/python/qmk/cli/__init__.py | 1 + lib/python/qmk/cli/git/__init__.py | 0 lib/python/qmk/cli/git/submodule.py | 22 ++++++++++++++++++++++ 3 files changed, 23 insertions(+) create mode 100644 lib/python/qmk/cli/git/__init__.py create mode 100644 lib/python/qmk/cli/git/submodule.py (limited to 'lib/python/qmk') 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 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) -- cgit v1.2.3