diff --git a/.ruff-excludes.toml b/.ruff-excludes.toml index 5d106320b75..dcb5781e90b 100644 --- a/.ruff-excludes.toml +++ b/.ruff-excludes.toml @@ -1190,11 +1190,6 @@ "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes "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" = [ "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports diff --git a/scripts/west_commands/zspdx/getincludes.py b/scripts/west_commands/zspdx/getincludes.py index 27a0c57965b..86faa44b3e2 100644 --- a/scripts/west_commands/zspdx/getincludes.py +++ b/scripts/west_commands/zspdx/getincludes.py @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: Apache-2.0 -from subprocess import run, PIPE +from subprocess import run from west import log @@ -30,7 +30,7 @@ def getCIncludes(compilerPath, srcFile, tcg): # prepare command invocation 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: log.dbg(f" - calling {compilerPath} failed with error code {cp.returncode}") return []