summaryrefslogtreecommitdiff
path: root/lib/python/qmk/submodules.py
diff options
context:
space:
mode:
authorZach White <skullydazed@gmail.com>2021-05-19 15:24:46 -0700
committerGitHub <noreply@github.com>2021-05-19 15:24:46 -0700
commitdb1eacdaacb9c8f6889f46bc1c6af155b81ad72a (patch)
treecd32a69a04c7ff93a11941d82aef3ce31c2b7523 /lib/python/qmk/submodules.py
parenta9aec546c873fa5a2cb1d9a10878aca71818b609 (diff)
Align our subprocess usage with current best practices. (#12940)
* Align our subprocess usage with current best practices. * remove unused import * Apply suggestions from code review Co-authored-by: Ryan <fauxpark@gmail.com> * fix the cpp invocation for older python * allow for unprompted installation * make sure qmk new-keyboard works on windows Co-authored-by: Ryan <fauxpark@gmail.com>
Diffstat (limited to 'lib/python/qmk/submodules.py')
-rw-r--r--lib/python/qmk/submodules.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/python/qmk/submodules.py b/lib/python/qmk/submodules.py
index be51a68043..6a272dae50 100644
--- a/lib/python/qmk/submodules.py
+++ b/lib/python/qmk/submodules.py
@@ -1,7 +1,6 @@
"""Functions for working with QMK's submodules.
"""
-
-import subprocess
+from milc import cli
def status():
@@ -18,7 +17,7 @@ def status():
status is None when the submodule doesn't exist, False when it's out of date, and True when it's current
"""
submodules = {}
- git_cmd = subprocess.run(['git', 'submodule', 'status'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=30, universal_newlines=True)
+ git_cmd = cli.run(['git', 'submodule', 'status'], timeout=30)
for line in git_cmd.stdout.split('\n'):
if not line:
@@ -53,19 +52,19 @@ def update(submodules=None):
# Update everything
git_sync_cmd.append('--recursive')
git_update_cmd.append('--recursive')
- subprocess.run(git_sync_cmd, check=True)
- subprocess.run(git_update_cmd, check=True)
+ cli.run(git_sync_cmd, check=True)
+ cli.run(git_update_cmd, check=True)
else:
if isinstance(submodules, str):
# Update only a single submodule
git_sync_cmd.append(submodules)
git_update_cmd.append(submodules)
- subprocess.run(git_sync_cmd, check=True)
- subprocess.run(git_update_cmd, check=True)
+ cli.run(git_sync_cmd, check=True)
+ cli.run(git_update_cmd, check=True)
else:
# Update submodules in a list
for submodule in submodules:
- subprocess.run(git_sync_cmd + [submodule], check=True)
- subprocess.run(git_update_cmd + [submodule], check=True)
+ cli.run([*git_sync_cmd, submodule], check=True)
+ cli.run([*git_update_cmd, submodule], check=True)