diff options
author | Erovia <erovia@users.noreply.github.com> | 2020-02-20 01:10:56 +0100 |
---|---|---|
committer | skullydazed <skullydazed@users.noreply.github.com> | 2020-04-08 09:31:14 -0700 |
commit | 724f20ed32758b0c5d91ad4b7ba4a9348e152eeb (patch) | |
tree | 593ede983bd5a5b0a2e70afe63594dc6f87ede8c | |
parent | c61f016fa491502920941fd03cdab6453d126e67 (diff) | |
download | qmk_firmware-724f20ed32758b0c5d91ad4b7ba4a9348e152eeb.tar.gz qmk_firmware-724f20ed32758b0c5d91ad4b7ba4a9348e152eeb.zip |
Use milc for config check, requirements fixes
Use milc's config finding and parsing to check if the user is a
developer or not.
'requirements-dev.txt' will now load 'requirements.txt', so no need to
run pip twice.
Add missing 'yapf' dependency to 'requirements-dev.txt'.
-rwxr-xr-x | bin/qmk | 10 | ||||
-rw-r--r-- | requirements-dev.txt | 4 |
2 files changed, 8 insertions, 6 deletions
@@ -13,8 +13,8 @@ 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 | # QMK CLI user config file | 16 | # Setup the CLI |
17 | config_file = Path(Path.home() / '.config/qmk/qmk.ini') | 17 | import milc # noqa |
18 | 18 | ||
19 | 19 | ||
20 | def _check_modules(requirements): | 20 | def _check_modules(requirements): |
@@ -24,7 +24,7 @@ def _check_modules(requirements): | |||
24 | for line in fd.readlines(): | 24 | for line in fd.readlines(): |
25 | line = line.strip().replace('<', '=').replace('>', '=') | 25 | line = line.strip().replace('<', '=').replace('>', '=') |
26 | 26 | ||
27 | if line[0] == '#': | 27 | if len(line) == 0 or line[0] == '#' or '-r' in line: |
28 | continue | 28 | continue |
29 | 29 | ||
30 | if '#' in line: | 30 | if '#' in line: |
@@ -53,12 +53,10 @@ developer = False | |||
53 | _check_modules('requirements.txt') | 53 | _check_modules('requirements.txt') |
54 | 54 | ||
55 | # For developers additional modules are needed | 55 | # For developers additional modules are needed |
56 | if config_file.exists() and 'developer = True' in config_file.read_text(): | 56 | if milc.cli.config.user.developer: |
57 | developer = True | 57 | developer = True |
58 | _check_modules('requirements-dev.txt') | 58 | _check_modules('requirements-dev.txt') |
59 | 59 | ||
60 | # Setup the CLI | ||
61 | import milc # noqa | ||
62 | 60 | ||
63 | milc.EMOJI_LOGLEVELS['INFO'] = '{fg_blue}Ψ{style_reset_all}' | 61 | milc.EMOJI_LOGLEVELS['INFO'] = '{fg_blue}Ψ{style_reset_all}' |
64 | 62 | ||
diff --git a/requirements-dev.txt b/requirements-dev.txt index deab419cb..1db3b6d73 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt | |||
@@ -1,4 +1,8 @@ | |||
1 | # Install the necessary requirements | ||
2 | -r requirements.txt | ||
3 | |||
1 | # Python development requirements | 4 | # Python development requirements |
2 | nose2 | 5 | nose2 |
3 | flake8 | 6 | flake8 |
4 | pep8-naming | 7 | pep8-naming |
8 | yapf | ||