Skip to content

Commit 7865153

Browse files
committed
skip annotations for version results
Add support for an ebuild to declare a skip annotation for a class of *version* results. This skip annotation must be declared before any non-comment non-empty line (most of the times it would be before the EAPI declaration). Empty lines between the copyright and the annotation are allowed. The annotation line must be precise, only one class per line and every space is required. For example, it would look like: # Copyright 2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # pkgcheck skip: PythonCompatUpdate EAPI=8 Resolves: #478 Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
1 parent 4d74d90 commit 7865153

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

src/pkgcheck/results.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,21 @@ def __init__(self, pkg, **kwargs):
225225
self.version = pkg.fullver
226226
self._attr = "version"
227227

228+
if hasattr(pkg, "lines"):
229+
lines = pkg.lines
230+
elif ebuild := getattr(pkg, "ebuild", None):
231+
with ebuild.text_fileobj() as fileobj:
232+
lines = tuple(fileobj)
233+
else:
234+
lines = ()
235+
236+
for line in map(str.rstrip, lines):
237+
if line and not line.startswith("#"):
238+
break # stop after first non-comment non-empty line
239+
elif line == f"# pkgcheck skip: {self.__class__.__name__}":
240+
self._filtered = True
241+
break
242+
228243
@klass.jit_attr
229244
def ver_rev(self):
230245
version, _, revision = self.version.partition("-r")

0 commit comments

Comments
 (0)