Skip to content

Commit

Permalink
scripts: ci: check_compliance: fix split on ":" for Windows
Browse files Browse the repository at this point in the history
The method get_kconfig_dts() relies on str's split() to split
lines into fields separated by ':'. The second field is an
absolute path to a file.
On Windows, an absolute path includes a drive's letter followed
by ':' which breaks the current code.
On Linux, although rare, a file or directory name may also include
':', which would also break the code.

The fix is to constraint the number of splits to 1.
The code then becomes:

 _,b = line.split(":", 1)

Signed-off-by: Yves Vandervennet <[email protected]>
  • Loading branch information
yvanderv committed Feb 28, 2024
1 parent 408babb commit d64c506
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/ci/check_compliance.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def get_kconfig_dts(self, kconfig_dts_file, settings_file):
lines = content.strip().split('\n')
for line in lines:
if line.startswith('"DTS_ROOT":'):
_, dts_root_path = line.split(":")
_, dts_root_path = line.split(":", 1)
binding_paths.append(os.path.join(dts_root_path.strip('"'), "dts", "bindings"))

cmd = [sys.executable, zephyr_drv_kconfig_path,
Expand Down

0 comments on commit d64c506

Please sign in to comment.