-
Notifications
You must be signed in to change notification settings - Fork 7.5k
cmake: modules: using posix path for Kconfig generated file #15290
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
cmake: modules: using posix path for Kconfig generated file #15290
Conversation
Fixes: zephyrproject-rtos#15289 Kconfig requires posix style path when sourcing other files. As abspath in python will use native host style, i.e. backslash '\' in windows this will cause invalid paths in Kconfig generated file and thus the file will never be loaded. This commit uses PurePath to convert the path to posix style, ensuring Kconfig can load the modules. Signed-off-by: Torsten Rasmussen <[email protected]>
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
Just as an FYI, Kconfiglib can deal with Windows paths (except for the gotcha here). The problem is that "C:\foo\bar" is transformed into "C:foobar", due to how escaping works in Kconfig. Wonder if I should change that so that unknown stuff is preserved instead. The only escapes are |
@@ -19,7 +19,7 @@ | |||
import pykwalify.core | |||
import subprocess | |||
import re | |||
|
|||
from pathlib import PurePath |
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.
Another option is to import posixpath
and then do posixpath.abspath(kconfig_file)
, etc., if you consistently want to deal with *nix paths.
os.path
is posixpath
if you're on *nix, and ntpath
if you're on Windows.
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.
yeah, that could also be a choice.
Only reason for deciding on PurePath
here, is because it is what is also used in west
.
Yeah, I had the assumption that a |
Yeah, the real problem might be overzealous compatibility with the C tools. |
BTW forward slashes work pretty much everywhere in Windows except in CMD.exe. Use PowerShell :-) |
Fixes: #15289
Kconfig requires posix style path when sourcing other files.
As abspath in python will use native host style, i.e. backslash '' in
windows this will cause invalid paths in Kconfig generated file and
thus the file will never be loaded.
This commit uses PurePath to convert the path to posix style, ensuring
Kconfig can load the modules.
Signed-off-by: Torsten Rasmussen [email protected]