scripts: west_commands: zspdx: getincludes: Fix linter issues

Fix issues reported by ruff.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
This commit is contained in:
Pieter De Gendt 2025-05-24 22:06:39 +02:00 committed by Benjamin Cabé
commit 8360238ae5
2 changed files with 2 additions and 7 deletions

View file

@ -1190,11 +1190,6 @@
"UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes
"UP032", # https://docs.astral.sh/ruff/rules/f-string "UP032", # https://docs.astral.sh/ruff/rules/f-string
] ]
"./scripts/west_commands/zspdx/getincludes.py" = [
"I001", # https://docs.astral.sh/ruff/rules/unsorted-imports
"UP021", # https://docs.astral.sh/ruff/rules/replace-universal-newlines
"UP022", # https://docs.astral.sh/ruff/rules/replace-stdout-stderr
]
"./scripts/west_commands/zspdx/sbom.py" = [ "./scripts/west_commands/zspdx/sbom.py" = [
"F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders
"I001", # https://docs.astral.sh/ruff/rules/unsorted-imports "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports

View file

@ -2,7 +2,7 @@
# #
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
from subprocess import run, PIPE from subprocess import run
from west import log from west import log
@ -30,7 +30,7 @@ def getCIncludes(compilerPath, srcFile, tcg):
# prepare command invocation # prepare command invocation
cmd = [compilerPath, "-E", "-H"] + fragments + includes + defines + [srcFile] cmd = [compilerPath, "-E", "-H"] + fragments + includes + defines + [srcFile]
cp = run(cmd, stdout=PIPE, stderr=PIPE, universal_newlines=True) cp = run(cmd, capture_output=True, text=True)
if cp.returncode != 0: if cp.returncode != 0:
log.dbg(f" - calling {compilerPath} failed with error code {cp.returncode}") log.dbg(f" - calling {compilerPath} failed with error code {cp.returncode}")
return [] return []