diff options
author | Erovia <erovia@users.noreply.github.com> | 2020-03-23 17:08:35 +0100 |
---|---|---|
committer | skullydazed <skullydazed@users.noreply.github.com> | 2020-04-08 09:31:14 -0700 |
commit | eb683c8c52df7e3fb6d9829ec15c634e23e9f2ce (patch) | |
tree | cc65368c43844c3cc91ddf831d2c39c61875325c | |
parent | 21799be1caa72bc8770143e9f83e1b8d55812dfd (diff) | |
download | qmk_firmware-eb683c8c52df7e3fb6d9829ec15c634e23e9f2ce.tar.gz qmk_firmware-eb683c8c52df7e3fb6d9829ec15c634e23e9f2ce.zip |
Apply @skullydazed's suggestions, move 'import milc'
Only 'import milc' after we are sure that the minimum required modules
are available, as it depends on a few of them.
-rwxr-xr-x | bin/qmk | 16 |
1 files changed, 7 insertions, 9 deletions
@@ -13,9 +13,6 @@ qmk_dir = script_dir.parent | |||
13 | python_lib_dir = Path(qmk_dir / 'lib' / 'python').resolve() | 13 | python_lib_dir = Path(qmk_dir / 'lib' / 'python').resolve() |
14 | sys.path.append(str(python_lib_dir)) | 14 | sys.path.append(str(python_lib_dir)) |
15 | 15 | ||
16 | # Setup the CLI | ||
17 | import milc # noqa | ||
18 | |||
19 | 16 | ||
20 | def _check_modules(requirements): | 17 | def _check_modules(requirements): |
21 | """ Check if the modules in the given requirements.txt are available. | 18 | """ Check if the modules in the given requirements.txt are available. |
@@ -39,19 +36,20 @@ def _check_modules(requirements): | |||
39 | 36 | ||
40 | if not find_spec(module['import']): | 37 | if not find_spec(module['import']): |
41 | print('Could not find module %s!' % module['name']) | 38 | print('Could not find module %s!' % module['name']) |
39 | print('Please run `python3 -m pip install -r %s` to install required python dependencies.' % str(qmk_dir / requirements)) | ||
42 | if developer: | 40 | if developer: |
43 | print('Please run `pip3 install -r requirements-dev.txt` to install the python development dependencies or turn off developer mode with `qmk config user.developer=None`.') | 41 | print('You can also turn off developer mode: qmk config user.developer=None') |
44 | print() | 42 | print() |
45 | else: | 43 | exit(255) |
46 | print('Please run `pip3 install -r requirements.txt` to install the python dependencies.') | ||
47 | print() | ||
48 | exit(255) | ||
49 | 44 | ||
50 | 45 | ||
51 | developer = False | 46 | developer = False |
52 | # Make sure our modules have been setup | 47 | # Make sure our modules have been setup |
53 | _check_modules('requirements.txt') | 48 | _check_modules('requirements.txt') |
54 | 49 | ||
50 | # Setup the CLI | ||
51 | import milc # noqa | ||
52 | |||
55 | # For developers additional modules are needed | 53 | # For developers additional modules are needed |
56 | if milc.cli.config.user.developer: | 54 | if milc.cli.config.user.developer: |
57 | developer = True | 55 | developer = True |