diff options
author | QMK Bot <hello@qmk.fm> | 2021-11-23 00:24:00 +0000 |
---|---|---|
committer | QMK Bot <hello@qmk.fm> | 2021-11-23 00:24:00 +0000 |
commit | 69853175d00335d76ff57b3db46948acb7e33307 (patch) | |
tree | 952d8dcb018e1e3c9467de3fd2227b0ad62d58a1 /lib/python/qmk/cli | |
parent | 7746aefe94cc4cd492bfafdef73d95d073f0603b (diff) | |
parent | dbc7b535178020063f80aaaabac3ca8ff9f6e8bb (diff) | |
download | qmk_firmware-69853175d00335d76ff57b3db46948acb7e33307.tar.gz qmk_firmware-69853175d00335d76ff57b3db46948acb7e33307.zip |
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'lib/python/qmk/cli')
-rwxr-xr-x | lib/python/qmk/cli/format/python.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/python/qmk/cli/format/python.py b/lib/python/qmk/cli/format/python.py index 95868d18a..47b5c45fd 100755 --- a/lib/python/qmk/cli/format/python.py +++ b/lib/python/qmk/cli/format/python.py | |||
@@ -25,9 +25,8 @@ def yapf_run(files): | |||
25 | def filter_files(files): | 25 | def filter_files(files): |
26 | """Yield only files to be formatted and skip the rest | 26 | """Yield only files to be formatted and skip the rest |
27 | """ | 27 | """ |
28 | |||
29 | for file in files: | 28 | for file in files: |
30 | if file and file.name.split('.')[-1] in py_file_suffixes: | 29 | if file and normpath(file).name.split('.')[-1] in py_file_suffixes: |
31 | yield file | 30 | yield file |
32 | else: | 31 | else: |
33 | cli.log.debug('Skipping file %s', file) | 32 | cli.log.debug('Skipping file %s', file) |
@@ -53,12 +52,14 @@ def format_python(cli): | |||
53 | cli.log.warning('Filenames passed with -a, only formatting: %s', ','.join(map(str, files))) | 52 | cli.log.warning('Filenames passed with -a, only formatting: %s', ','.join(map(str, files))) |
54 | 53 | ||
55 | elif cli.args.all_files: | 54 | elif cli.args.all_files: |
56 | files = py_dirs | 55 | git_ls_cmd = ['git', 'ls-files', *py_dirs] |
56 | git_ls = cli.run(git_ls_cmd, stdin=DEVNULL) | ||
57 | files = list(filter_files(git_ls.stdout.split('\n'))) | ||
57 | 58 | ||
58 | else: | 59 | else: |
59 | git_diff_cmd = ['git', 'diff', '--name-only', cli.args.base_branch, *py_dirs] | 60 | git_diff_cmd = ['git', 'diff', '--name-only', cli.args.base_branch, *py_dirs] |
60 | git_diff = cli.run(git_diff_cmd, stdin=DEVNULL) | 61 | git_diff = cli.run(git_diff_cmd, stdin=DEVNULL) |
61 | files = list(filter(None, git_diff.stdout.split('\n'))) | 62 | files = list(filter_files(git_diff.stdout.split('\n'))) |
62 | 63 | ||
63 | # Sanity check | 64 | # Sanity check |
64 | if not files: | 65 | if not files: |