Browse Source

Migrate 'make git-submodule' to CLI command (#19479)

pull/19485/head
Joel Challis 1 year ago
committed by GitHub
parent
commit
b297531dbf
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 7 deletions
  1. +1
    -6
      Makefile
  2. +1
    -1
      builddefs/message.mk
  3. +1
    -0
      lib/python/qmk/cli/__init__.py
  4. +0
    -0
      lib/python/qmk/cli/git/__init__.py
  5. +22
    -0
      lib/python/qmk/cli/git/submodule.py

+ 1
- 6
Makefile View File

@ -430,12 +430,7 @@ lib/%:
.PHONY: git-submodule
git-submodule:
[ -e lib/ugfx ] && rm -rf lib/ugfx || true
[ -e lib/pico-sdk ] && rm -rf lib/pico-sdk || true
[ -e lib/chibios-contrib/ext/mcux-sdk ] && rm -rf lib/chibios-contrib/ext/mcux-sdk || true
[ -e lib/lvgl ] && rm -rf lib/lvgl || true
git submodule sync --recursive
git submodule update --init --recursive --progress
$(QMK_BIN) git-submodule
.PHONY: git-submodules
git-submodules: git-submodule


+ 1
- 1
builddefs/message.mk View File

@ -65,7 +65,7 @@ MSG_CLEANING = Cleaning project:
MSG_CREATING_LIBRARY = Creating library:
MSG_GENERATING = Generating:
MSG_SUBMODULE_DIRTY = $(WARN_COLOR)WARNING:$(NO_COLOR) Some git submodules are out of date or modified.\n\
Please consider running $(BOLD)make git-submodule$(NO_COLOR).\n\n
Please consider running $(BOLD)qmk git-submodule$(NO_COLOR).\n\n
MSG_NO_CMP = $(ERROR_COLOR)Error:$(NO_COLOR)$(BOLD) cmp command not found, please install diffutils\n$(NO_COLOR)
define GENERATE_MSG_MAKE_KB


+ 1
- 0
lib/python/qmk/cli/__init__.py View File

@ -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',


+ 0
- 0
lib/python/qmk/cli/git/__init__.py View File


+ 22
- 0
lib/python/qmk/cli/git/submodule.py View File

@ -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)

Loading…
Cancel
Save