Skip to content

Commit ad026c0

Browse files
tejlmandcarlescufi
authored andcommitted
cmake: modules: using posix path for Kconfig generated file
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]>
1 parent ceca823 commit ad026c0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

scripts/zephyr_module.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import pykwalify.core
2020
import subprocess
2121
import re
22-
22+
from pathlib import PurePath
2323

2424
METADATA_SCHEMA = '''
2525
## A pykwalify schema for basic validation of the structure of a
@@ -91,12 +91,13 @@ def process_module(module, cmake_out=None, kconfig_out=None):
9191
cmake_file = os.path.join(cmake_path, 'CMakeLists.txt')
9292
if os.path.isfile(cmake_file) and cmake_out is not None:
9393
cmake_out.write('\"{}\":\"{}\"\n'.format(os.path.basename(module),
94-
os.path.abspath(cmake_path)))
94+
os.path.abspath(cmake_path)))
9595

9696
kconfig_file = os.path.join(module, kconfig_setting or 'zephyr/Kconfig')
9797
if os.path.isfile(kconfig_file) and kconfig_out is not None:
9898
kconfig_out.write('osource "{}"\n\n'
99-
.format(os.path.abspath(kconfig_file)))
99+
.format(PurePath(
100+
os.path.abspath(kconfig_file)).as_posix()))
100101

101102

102103
def main():

0 commit comments

Comments
 (0)