mirror of
https://github.com/firewalkwithm3/qmk_firmware.git
synced 2024-11-22 19:40:29 +08:00
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'.
This commit is contained in:
parent
c61f016fa4
commit
724f20ed32
10
bin/qmk
10
bin/qmk
|
@ -13,8 +13,8 @@ qmk_dir = script_dir.parent
|
||||||
python_lib_dir = Path(qmk_dir / 'lib' / 'python').resolve()
|
python_lib_dir = Path(qmk_dir / 'lib' / 'python').resolve()
|
||||||
sys.path.append(str(python_lib_dir))
|
sys.path.append(str(python_lib_dir))
|
||||||
|
|
||||||
# QMK CLI user config file
|
# Setup the CLI
|
||||||
config_file = Path(Path.home() / '.config/qmk/qmk.ini')
|
import milc # noqa
|
||||||
|
|
||||||
|
|
||||||
def _check_modules(requirements):
|
def _check_modules(requirements):
|
||||||
|
@ -24,7 +24,7 @@ def _check_modules(requirements):
|
||||||
for line in fd.readlines():
|
for line in fd.readlines():
|
||||||
line = line.strip().replace('<', '=').replace('>', '=')
|
line = line.strip().replace('<', '=').replace('>', '=')
|
||||||
|
|
||||||
if line[0] == '#':
|
if len(line) == 0 or line[0] == '#' or '-r' in line:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if '#' in line:
|
if '#' in line:
|
||||||
|
@ -53,12 +53,10 @@ developer = False
|
||||||
_check_modules('requirements.txt')
|
_check_modules('requirements.txt')
|
||||||
|
|
||||||
# For developers additional modules are needed
|
# For developers additional modules are needed
|
||||||
if config_file.exists() and 'developer = True' in config_file.read_text():
|
if milc.cli.config.user.developer:
|
||||||
developer = True
|
developer = True
|
||||||
_check_modules('requirements-dev.txt')
|
_check_modules('requirements-dev.txt')
|
||||||
|
|
||||||
# Setup the CLI
|
|
||||||
import milc # noqa
|
|
||||||
|
|
||||||
milc.EMOJI_LOGLEVELS['INFO'] = '{fg_blue}Ψ{style_reset_all}'
|
milc.EMOJI_LOGLEVELS['INFO'] = '{fg_blue}Ψ{style_reset_all}'
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
|
# Install the necessary requirements
|
||||||
|
-r requirements.txt
|
||||||
|
|
||||||
# Python development requirements
|
# Python development requirements
|
||||||
nose2
|
nose2
|
||||||
flake8
|
flake8
|
||||||
pep8-naming
|
pep8-naming
|
||||||
|
yapf
|
||||||
|
|
Loading…
Reference in a new issue