Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 44a446308f | |||
| 90bdf52416 | |||
| 191980052e | |||
| 5fbdd95c4b | |||
| 1002360e20 | |||
| a03aa1cbba | |||
| a0b692d718 | |||
| ab7d0c6e46 | |||
| 73c903b8b6 | |||
| 8f2185af32 | |||
| bae2f1f1ee | |||
| 120ce557f1 | |||
| a15b0d6460 |
+1
-1
@@ -1,3 +1,3 @@
|
||||
"""A program to help you work with qmk_firmware."""
|
||||
|
||||
__version__ = '0.0.30'
|
||||
__version__ = '0.0.32'
|
||||
|
||||
+13
-2
@@ -9,6 +9,7 @@ import subprocess
|
||||
import sys
|
||||
from functools import lru_cache
|
||||
from pathlib import Path
|
||||
import platform
|
||||
|
||||
import milc
|
||||
|
||||
@@ -30,7 +31,7 @@ def in_qmk_firmware():
|
||||
while len(cur_dir.parents) > 0:
|
||||
found_bin = cur_dir / 'bin' / 'qmk'
|
||||
if found_bin.is_file():
|
||||
command = [found_bin.as_posix(), '--version']
|
||||
command = [sys.executable, found_bin.as_posix()]
|
||||
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
|
||||
if result.returncode == 0:
|
||||
@@ -69,6 +70,11 @@ def main():
|
||||
print('Warning: Your Python version is out of date! Some subcommands may not work!')
|
||||
print('Please upgrade to Python 3.6 or later.')
|
||||
|
||||
if 'windows' in platform.platform().lower():
|
||||
if 'mingw64' not in sys.executable or 'mingw64' not in os.environ.get('MSYSTEM_PREFIX', ''):
|
||||
print('Warning: It seems you are not using the MINGW64 terminal.')
|
||||
print('While the MSYS one can work, too, we recommend/support you start "MSYS2 MinGW 64-bit".\n')
|
||||
|
||||
# Environment setup
|
||||
import qmk_cli
|
||||
milc.cli.version = qmk_cli.__version__
|
||||
@@ -82,7 +88,12 @@ def main():
|
||||
if qmk_firmware.exists():
|
||||
os.chdir(str(qmk_firmware))
|
||||
sys.path.append(str(qmk_firmware / 'lib' / 'python'))
|
||||
import qmk.cli
|
||||
try:
|
||||
import qmk.cli
|
||||
except ImportError:
|
||||
print('Error: %s is too old or not set up correctly!' % qmk_firmware)
|
||||
print('Please update it or remove it completely before continuing.')
|
||||
sys.exit(1)
|
||||
|
||||
# Call the entrypoint
|
||||
milc.cli()
|
||||
|
||||
@@ -14,7 +14,8 @@ default_fork = 'qmk/' + default_repo
|
||||
default_branch = 'master'
|
||||
|
||||
|
||||
@cli.argument('-y', '--yes', action='store_true', help='Answer yes to all questions')
|
||||
@cli.argument('-n', '--no', arg_only=True, action='store_true', help='Answer no to all questions')
|
||||
@cli.argument('-y', '--yes', arg_only=True, action='store_true', help='Answer yes to all questions')
|
||||
@cli.argument('--baseurl', default='https://github.com', help='The URL all git operations start from')
|
||||
@cli.argument('-b', '--branch', default=default_branch, help='The branch to clone')
|
||||
@cli.argument('destination', default=os.environ['QMK_HOME'], nargs='?', help='The directory to clone to')
|
||||
@@ -23,8 +24,13 @@ default_branch = 'master'
|
||||
def setup(cli):
|
||||
qmk_firmware = Path(cli.args.destination)
|
||||
|
||||
# Sanity checks
|
||||
if cli.args.yes and cli.args.no:
|
||||
cli.log.error("Can't use both --yes and --no at the same time.")
|
||||
exit(1)
|
||||
|
||||
# Check on qmk_firmware, and if it doesn't exist offer to check it out.
|
||||
if qmk_firmware.exists():
|
||||
if (qmk_firmware / 'Makefile').exists():
|
||||
cli.log.info('Found qmk_firmware at %s.', str(qmk_firmware))
|
||||
else:
|
||||
cli.log.error('qmk_firmware not found!')
|
||||
@@ -35,7 +41,12 @@ def setup(cli):
|
||||
# Run `qmk_firmware/bin/qmk doctor` to check the rest of the environment out
|
||||
if qmk_firmware.exists():
|
||||
qmk_bin = qmk_firmware / 'bin' / 'qmk'
|
||||
doctor = subprocess.run([sys.executable, str(qmk_bin), 'doctor'])
|
||||
doctor_cmd = [sys.executable, str(qmk_bin), 'doctor']
|
||||
if cli.args.yes:
|
||||
doctor_cmd.append('--yes')
|
||||
if cli.args.no:
|
||||
doctor_cmd.append('--no')
|
||||
doctor = subprocess.run(doctor_cmd)
|
||||
if doctor.returncode != 0:
|
||||
cli.log.error('Your build environment is not setup completely.')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user