-
-
Notifications
You must be signed in to change notification settings - Fork 40k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use pathlib everywhere we can #7872
Conversation
lib/python/qmk/path.py
Outdated
|
||
if os.path.exists(basepath): | ||
return basepath | ||
for i in range(5): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This 5
feels like a magic number here. Why 5?
This code is walking up the directory tree, right? I think a while keyboard_folder != Path('keyboards')
would be more readable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the number of subfolders we support when building keyboards.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about while keyboard_folder != Path('keyboards')
so we don't have to hardcode a number?
Travis is failing: https://travis-ci.org/qmk/qmk_firmware/builds/641857334#L685 |
3611b32
to
f31e110
Compare
1488479
to
2c3a876
Compare
Co-Authored-By: Erovia <[email protected]>
Co-Authored-By: Erovia <[email protected]>
This reverts commit 67625bea796c4c25bb53c95fcf5443554b2c10a2.
2c3a876
to
52d9b8e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* Use pathlib everywhere we can * Update lib/python/qmk/path.py Co-Authored-By: Erovia <[email protected]> * Update lib/python/qmk/path.py Co-Authored-By: Erovia <[email protected]> * Improvements based on @Erovia's feedback * rework qmk compile and qmk flash to use pathlib * style * Remove the subcommand_name argument from find_keyboard_keymap() Co-authored-by: Erovia <[email protected]>
* upstream/master: (330 commits) Add Danish keymap and sendstring LUT (qmk#8218) format code according to conventions [skip ci] uart.c fix from TMK (qmk#7628) S75 Encoder Fixes (qmk#7758) Add Turkish keymap aliases and sendstring LUT (qmk#7676) Add Arm Teensys to mcu_selection.mk (qmk#8026) [New keyboard]silverbullet44 (qmk#7950) Allow 30us matrix delay to be keyboard/user overridable (qmk#8216) Merge /prime_l and /prime_l_v2 (qmk#8194) [Keymap] Keymap for XD75 with 7U spacebar EN-RU gamers (qmk#8184) Add VIA support for kbd8x mk2 (qmk#8168) Move Grave/Tilde and some lesser used keys on my ergo boards (qmk#8200) [Keyboard] KC60SE cleanup (qmk#8171) Made windows driver installation accept y as All to allow CI (qmk#8189) Change the image photo of /keyboards/reviung41/readme.md (qmk#8195) MxSS RGB Handler Touchup (qmk#8105) Centromere Configurator layout support and readme update (qmk#8190) dynamic keymap sanity check (qmk#8181) [keyboard] Austin (qmk#8176) Use pathlib everywhere we can (qmk#7872) ...
* Use pathlib everywhere we can * Update lib/python/qmk/path.py Co-Authored-By: Erovia <[email protected]> * Update lib/python/qmk/path.py Co-Authored-By: Erovia <[email protected]> * Improvements based on @Erovia's feedback * rework qmk compile and qmk flash to use pathlib * style * Remove the subcommand_name argument from find_keyboard_keymap() Co-authored-by: Erovia <[email protected]>
* Use pathlib everywhere we can * Update lib/python/qmk/path.py Co-Authored-By: Erovia <[email protected]> * Update lib/python/qmk/path.py Co-Authored-By: Erovia <[email protected]> * Improvements based on @Erovia's feedback * rework qmk compile and qmk flash to use pathlib * style * Remove the subcommand_name argument from find_keyboard_keymap() Co-authored-by: Erovia <[email protected]>
* Use pathlib everywhere we can * Update lib/python/qmk/path.py Co-Authored-By: Erovia <[email protected]> * Update lib/python/qmk/path.py Co-Authored-By: Erovia <[email protected]> * Improvements based on @Erovia's feedback * rework qmk compile and qmk flash to use pathlib * style * Remove the subcommand_name argument from find_keyboard_keymap() Co-authored-by: Erovia <[email protected]>
* Use pathlib everywhere we can * Update lib/python/qmk/path.py Co-Authored-By: Erovia <[email protected]> * Update lib/python/qmk/path.py Co-Authored-By: Erovia <[email protected]> * Improvements based on @Erovia's feedback * rework qmk compile and qmk flash to use pathlib * style * Remove the subcommand_name argument from find_keyboard_keymap() Co-authored-by: Erovia <[email protected]>
* Use pathlib everywhere we can * Update lib/python/qmk/path.py Co-Authored-By: Erovia <[email protected]> * Update lib/python/qmk/path.py Co-Authored-By: Erovia <[email protected]> * Improvements based on @Erovia's feedback * rework qmk compile and qmk flash to use pathlib * style * Remove the subcommand_name argument from find_keyboard_keymap() Co-authored-by: Erovia <[email protected]>
* Use pathlib everywhere we can * Update lib/python/qmk/path.py Co-Authored-By: Erovia <[email protected]> * Update lib/python/qmk/path.py Co-Authored-By: Erovia <[email protected]> * Improvements based on @Erovia's feedback * rework qmk compile and qmk flash to use pathlib * style * Remove the subcommand_name argument from find_keyboard_keymap() Co-authored-by: Erovia <[email protected]>
* Use pathlib everywhere we can * Update lib/python/qmk/path.py Co-Authored-By: Erovia <[email protected]> * Update lib/python/qmk/path.py Co-Authored-By: Erovia <[email protected]> * Improvements based on @Erovia's feedback * rework qmk compile and qmk flash to use pathlib * style * Remove the subcommand_name argument from find_keyboard_keymap() Co-authored-by: Erovia <[email protected]>
This PR switches to using pathlib for all path related code. While we take a performance hit in some places the overall gain in code readability is well worth it.
Types of Changes
Checklist