commit: 56880290ded28c7cca414a958b48be4e8d12a4e1 Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org> AuthorDate: Sat Jul 15 10:14:59 2023 +0000 Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org> CommitDate: Sat Jul 15 10:14:59 2023 +0000 URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=56880290
GitPkgCommitsCheck: fix failure during compute of environment In rare cases, ebd might fail for some ebuilds during the compute of `.environment` property. For now let's eat up all of those cases since other checks will catch the issues. Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org> src/pkgcheck/checks/git.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/pkgcheck/checks/git.py b/src/pkgcheck/checks/git.py index 8a80fb90..525bf693 100644 --- a/src/pkgcheck/checks/git.py +++ b/src/pkgcheck/checks/git.py @@ -1,5 +1,6 @@ """Various git-related checks.""" +import contextlib import os import re import subprocess @@ -440,13 +441,14 @@ class GitPkgCommitsCheck(GentooRepoCheck, GitCommitsCheck): else: yield MissingSlotmove(old_slot, new_slot, pkg=new_pkg) - for env_line in new_pkg.environment.data.splitlines(): - if mo := self.python_compat_declare_regex.match(env_line): - if old_compat := { - m.group("val") - for m in re.finditer(self.env_array_elem_regex, mo.group("value")) - }.difference(self.valid_python_targets): - yield OldPythonCompat(sorted(old_compat), pkg=new_pkg) + with contextlib.suppress(Exception): + for env_line in new_pkg.environment.data.splitlines(): + if mo := self.python_compat_declare_regex.match(env_line): + if old_compat := { + m.group("val") + for m in re.finditer(self.env_array_elem_regex, mo.group("value")) + }.difference(self.valid_python_targets): + yield OldPythonCompat(sorted(old_compat), pkg=new_pkg) def _fetchable_str(self, fetch: fetchable) -> tuple[str, str]: uri = tuple(fetch.uri._uri_source)[0]