Skip to content

Commit 14bba90

Browse files
yveslljhedberg
authored andcommitted
ci: compliance: call dts linter safely under windows
subprocess run without shell requires npx shim under windows. Signed-off-by: Yves Wang <zhengjia.wang@nxp.com>
1 parent 6d6508a commit 14bba90

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

scripts/ci/check_compliance.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -499,12 +499,13 @@ class DevicetreeLintingCheck(ComplianceTest):
499499
NPX_EXECUTABLE = "npx"
500500

501501
def ensure_npx(self) -> bool:
502-
if not shutil.which(self.NPX_EXECUTABLE):
502+
if not (npx_executable := shutil.which(self.NPX_EXECUTABLE)):
503503
return False
504504
try:
505+
self.npx_exe = npx_executable
505506
# --no prevents npx from fetching from registry
506507
subprocess.run(
507-
[self.NPX_EXECUTABLE, "--prefix", "./scripts/ci", "--no", 'dts-linter', "--", "--version"],
508+
[self.npx_exe, "--prefix", "./scripts/ci", "--no", 'dts-linter', "--", "--version"],
508509
stdout=subprocess.DEVNULL,
509510
stderr=subprocess.DEVNULL,
510511
check=True,
@@ -535,6 +536,7 @@ def _parse_json_output(self, cmd, cwd=None):
535536
raise RuntimeError(f"Failed to parse dts-linter JSON output: {e}")
536537

537538
def run(self):
539+
self.npx_exe = self.NPX_EXECUTABLE
538540
# Get changed DTS files
539541
dts_files = [
540542
file for file in get_files(filter="d")
@@ -560,7 +562,7 @@ def run(self):
560562
temp_patch_files.append(temp_patch)
561563

562564
cmd = [
563-
"npx", "--prefix", "./scripts/ci", "--no",
565+
self.npx_exe, "--prefix", "./scripts/ci", "--no",
564566
"dts-linter", "--", "--outputFormat",
565567
"json", "--format",
566568
"--patchFile", temp_patch,

0 commit comments

Comments
 (0)