General improvements

* refactor to make the code clearer in some places
* don't call bin/qmk anymore
* ask the user if they want to install python modules when they're missing
This commit is contained in:
Zach White
2021-03-26 10:28:36 -07:00
committed by Zach White
parent d805fe2b6e
commit fe42ab3534
6 changed files with 76 additions and 44 deletions
+8 -9
View File
@@ -74,18 +74,17 @@ def setup(cli):
exit(1)
# Offer to set `user.qmk_home` for them.
if cli.args.home != Path(os.environ['QMK_HOME']) and yesno(home_prompt):
if str(cli.args.home) != os.environ['QMK_HOME'] and yesno(home_prompt):
cli.config['user']['qmk_home'] = str(cli.args.home.absolute())
cli.write_config_option('user', 'qmk_home')
# Run `qmk_firmware/bin/qmk doctor` to check the rest of the environment out
qmk_bin = cli.args.home / 'bin/qmk'
doctor_cmd = [sys.executable, qmk_bin.as_posix(), 'doctor']
if cli.args.yes:
doctor_cmd.append('--yes')
# Run `qmk doctor` to check the rest of the environment out
doctor_command = [sys.executable, sys.argv[0], 'doctor']
if cli.args.no:
doctor_cmd.append('--no')
doctor_command.append('--no')
subprocess.run(doctor_cmd)
if cli.args.yes:
doctor_command.append('--yes')
cli.run(doctor_command, capture_output=False)