Skip to content

Commit 5688029

Browse files
committed
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@gentoo.org>
1 parent 59cfd9b commit 5688029

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/pkgcheck/checks/git.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Various git-related checks."""
22

3+
import contextlib
34
import os
45
import re
56
import subprocess
@@ -440,13 +441,14 @@ def found_pep517_lines(cmp_pkg):
440441
else:
441442
yield MissingSlotmove(old_slot, new_slot, pkg=new_pkg)
442443

443-
for env_line in new_pkg.environment.data.splitlines():
444-
if mo := self.python_compat_declare_regex.match(env_line):
445-
if old_compat := {
446-
m.group("val")
447-
for m in re.finditer(self.env_array_elem_regex, mo.group("value"))
448-
}.difference(self.valid_python_targets):
449-
yield OldPythonCompat(sorted(old_compat), pkg=new_pkg)
444+
with contextlib.suppress(Exception):
445+
for env_line in new_pkg.environment.data.splitlines():
446+
if mo := self.python_compat_declare_regex.match(env_line):
447+
if old_compat := {
448+
m.group("val")
449+
for m in re.finditer(self.env_array_elem_regex, mo.group("value"))
450+
}.difference(self.valid_python_targets):
451+
yield OldPythonCompat(sorted(old_compat), pkg=new_pkg)
450452

451453
def _fetchable_str(self, fetch: fetchable) -> tuple[str, str]:
452454
uri = tuple(fetch.uri._uri_source)[0]

0 commit comments

Comments
 (0)