aboutsummaryrefslogtreecommitdiff
path: root/pw_presubmit
diff options
context:
space:
mode:
authorRob Mohr <mohrr@google.com>2023-01-31 23:19:08 +0000
committerCQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-01-31 23:19:08 +0000
commit3865a74f02bb4983ae3fc9b0398b7c6c70dc32d5 (patch)
tree2053126b98715880ae2a84071564f242603ae9ad /pw_presubmit
parent00e693c6fb7b9423fa31475b6abe63bca2fd01d3 (diff)
downloadpigweed-3865a74f02bb4983ae3fc9b0398b7c6c70dc32d5.tar.gz
pw_presubmit: Ignore some Python debug output
Ignore "Requirement already satisfied:" lines when summarizing failures. Change-Id: I62e66a9793dbcbb3867d99c9ce72ec53aa56f8be Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/127007 Commit-Queue: Rob Mohr <mohrr@google.com> Reviewed-by: Wyatt Hepler <hepler@google.com> Pigweed-Auto-Submit: Rob Mohr <mohrr@google.com>
Diffstat (limited to 'pw_presubmit')
-rw-r--r--pw_presubmit/py/ninja_parser_test.py1
-rw-r--r--pw_presubmit/py/pw_presubmit/ninja_parser.py11
2 files changed, 12 insertions, 0 deletions
diff --git a/pw_presubmit/py/ninja_parser_test.py b/pw_presubmit/py/ninja_parser_test.py
index 2d65e1bb2..4710f5ea3 100644
--- a/pw_presubmit/py/ninja_parser_test.py
+++ b/pw_presubmit/py/ninja_parser_test.py
@@ -27,6 +27,7 @@ _REAL_TEST_INPUT = """
[1169/1797] ACTION //pw_presubmit/py:py.lint.mypy(//pw_build/python_toolchain:python)
FAILED: python/gen/pw_presubmit/py/py.lint.mypy.pw_pystamp
python ../../pw_build/py/pw_build/python_runner.py --gn-root ../../ --current-path ../../pw_presubmit/py --default-toolchain=//pw_toolchain/default:default --current-toolchain=//pw_build/python_toolchain:python --env=MYPY_FORCE_COLOR=1 --touch python/gen/pw_presubmit/py/py.lint.mypy.pw_pystamp --capture-output --module mypy --python-virtualenv-config python/gen/pw_env_setup/pigweed_build_venv/venv_metadata.json --python-dep-list-files python/gen/pw_presubmit/py/py.lint.mypy_metadata_path_list.txt -- --pretty --show-error-codes ../../pw_presubmit/py/pw_presubmit/__init__.py ../../pw_presubmit/py/pw_presubmit/build.py ../../pw_presubmit/py/pw_presubmit/cli.py ../../pw_presubmit/py/pw_presubmit/cpp_checks.py ../../pw_presubmit/py/pw_presubmit/format_code.py ../../pw_presubmit/py/pw_presubmit/git_repo.py ../../pw_presubmit/py/pw_presubmit/inclusive_language.py ../../pw_presubmit/py/pw_presubmit/install_hook.py ../../pw_presubmit/py/pw_presubmit/keep_sorted.py ../../pw_presubmit/py/pw_presubmit/ninja_parser.py ../../pw_presubmit/py/pw_presubmit/npm_presubmit.py ../../pw_presubmit/py/pw_presubmit/pigweed_presubmit.py ../../pw_presubmit/py/pw_presubmit/presubmit.py ../../pw_presubmit/py/pw_presubmit/python_checks.py ../../pw_presubmit/py/pw_presubmit/shell_checks.py ../../pw_presubmit/py/pw_presubmit/todo_check.py ../../pw_presubmit/py/pw_presubmit/tools.py ../../pw_presubmit/py/git_repo_test.py ../../pw_presubmit/py/keep_sorted_test.py ../../pw_presubmit/py/ninja_parser_test.py ../../pw_presubmit/py/presubmit_test.py ../../pw_presubmit/py/tools_test.py ../../pw_presubmit/py/setup.py
+ Requirement already satisfied: pyserial in c:\\b\\s\\w\\ir\\x\\w\\co\\environment\\pigweed-venv\\lib\\site-packages (from pigweed==0.0.13+20230126212203) (3.5)
../../pw_presubmit/py/presubmit_test.py:63: error: Module has no attribute
"Filter" [attr-defined]
TestData(presubmit.Filter(suffix=('.a', '.b')), 'foo.c', False...
diff --git a/pw_presubmit/py/pw_presubmit/ninja_parser.py b/pw_presubmit/py/pw_presubmit/ninja_parser.py
index 2c6009573..131137df6 100644
--- a/pw_presubmit/py/pw_presubmit/ninja_parser.py
+++ b/pw_presubmit/py/pw_presubmit/ninja_parser.py
@@ -25,6 +25,8 @@ _FAILED_END_RE = re.compile(r'^\s*ninja: build stopped:.*')
def parse_ninja_stdout(ninja_stdout: Path) -> str:
+ """Extract an error summary from ninja output."""
+
failure_begins = False
failure_lines = []
last_line = ''
@@ -49,5 +51,14 @@ def parse_ninja_stdout(ninja_stdout: Path) -> str:
failure_lines.extend([last_line, line])
last_line = line
+ # Remove "Requirement already satisfied:" lines since many of those might
+ # be printed during Python installation, and they usually have no relevance
+ # to the actual error.
+ failure_lines = [
+ x
+ for x in failure_lines
+ if not x.lstrip().startswith('Requirement already satisfied:')
+ ]
+
result = '\n'.join(failure_lines)
return re.sub(r'\n+', '\n', result)