diff options
Diffstat (limited to 'lib/python/qmk/submodules.py')
-rw-r--r-- | lib/python/qmk/submodules.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/python/qmk/submodules.py b/lib/python/qmk/submodules.py index be51a6804..6a272dae5 100644 --- a/lib/python/qmk/submodules.py +++ b/lib/python/qmk/submodules.py | |||
@@ -1,7 +1,6 @@ | |||
1 | """Functions for working with QMK's submodules. | 1 | """Functions for working with QMK's submodules. |
2 | """ | 2 | """ |
3 | 3 | from milc import cli | |
4 | import subprocess | ||
5 | 4 | ||
6 | 5 | ||
7 | def status(): | 6 | def status(): |
@@ -18,7 +17,7 @@ def status(): | |||
18 | status is None when the submodule doesn't exist, False when it's out of date, and True when it's current | 17 | status is None when the submodule doesn't exist, False when it's out of date, and True when it's current |
19 | """ | 18 | """ |
20 | submodules = {} | 19 | submodules = {} |
21 | git_cmd = subprocess.run(['git', 'submodule', 'status'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=30, universal_newlines=True) | 20 | git_cmd = cli.run(['git', 'submodule', 'status'], timeout=30) |
22 | 21 | ||
23 | for line in git_cmd.stdout.split('\n'): | 22 | for line in git_cmd.stdout.split('\n'): |
24 | if not line: | 23 | if not line: |
@@ -53,19 +52,19 @@ def update(submodules=None): | |||
53 | # Update everything | 52 | # Update everything |
54 | git_sync_cmd.append('--recursive') | 53 | git_sync_cmd.append('--recursive') |
55 | git_update_cmd.append('--recursive') | 54 | git_update_cmd.append('--recursive') |
56 | subprocess.run(git_sync_cmd, check=True) | 55 | cli.run(git_sync_cmd, check=True) |
57 | subprocess.run(git_update_cmd, check=True) | 56 | cli.run(git_update_cmd, check=True) |
58 | 57 | ||
59 | else: | 58 | else: |
60 | if isinstance(submodules, str): | 59 | if isinstance(submodules, str): |
61 | # Update only a single submodule | 60 | # Update only a single submodule |
62 | git_sync_cmd.append(submodules) | 61 | git_sync_cmd.append(submodules) |
63 | git_update_cmd.append(submodules) | 62 | git_update_cmd.append(submodules) |
64 | subprocess.run(git_sync_cmd, check=True) | 63 | cli.run(git_sync_cmd, check=True) |
65 | subprocess.run(git_update_cmd, check=True) | 64 | cli.run(git_update_cmd, check=True) |
66 | 65 | ||
67 | else: | 66 | else: |
68 | # Update submodules in a list | 67 | # Update submodules in a list |
69 | for submodule in submodules: | 68 | for submodule in submodules: |
70 | subprocess.run(git_sync_cmd + [submodule], check=True) | 69 | cli.run([*git_sync_cmd, submodule], check=True) |
71 | subprocess.run(git_update_cmd + [submodule], check=True) | 70 | cli.run([*git_update_cmd, submodule], check=True) |