diff options
author | Akaash Suresh <casa.akaash@gmail.com> | 2020-02-22 22:57:19 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-22 20:57:19 -0800 |
commit | b353028ea5e0ac7b69e7fed4f224c7cb07015ec9 (patch) | |
tree | b090b1907dff0b47de08d24002e3bcf72f92f8f8 /lib/python/qmk/path.py | |
parent | eb9c2429c69cf034fb3938f0533d15457a2d7820 (diff) | |
download | qmk_firmware-b353028ea5e0ac7b69e7fed4f224c7cb07015ec9.tar.gz qmk_firmware-b353028ea5e0ac7b69e7fed4f224c7cb07015ec9.zip |
New functionality for cformat (#7893)
Fixing complexity
remove lambda
PR review fixes #1
Removing unneccesary string substitution
Handle -a and specified files
Complexity rewrite, use pathlib
Diffstat (limited to 'lib/python/qmk/path.py')
-rw-r--r-- | lib/python/qmk/path.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/python/qmk/path.py b/lib/python/qmk/path.py index d16928afb..bfaa43924 100644 --- a/lib/python/qmk/path.py +++ b/lib/python/qmk/path.py | |||
@@ -68,3 +68,17 @@ def normpath(path): | |||
68 | return Path(path) | 68 | return Path(path) |
69 | 69 | ||
70 | return Path(os.environ['ORIG_CWD']) / path | 70 | return Path(os.environ['ORIG_CWD']) / path |
71 | |||
72 | |||
73 | def c_source_files(dir_names): | ||
74 | """Returns a list of all *.c, *.h, and *.cpp files for a given list of directories | ||
75 | |||
76 | Args: | ||
77 | |||
78 | dir_names | ||
79 | List of directories, relative pathing starts at qmk's cwd | ||
80 | """ | ||
81 | files = [] | ||
82 | for dir in dir_names: | ||
83 | files.extend(file for file in Path(dir).glob('**/*') if file.suffix in ['.c', '.h', '.cpp']) | ||
84 | return files | ||