commit: 8be0a6a08313552e30bee6ddf376faba9bf57083 Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org> AuthorDate: Wed Oct 5 16:45:08 2022 +0000 Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org> CommitDate: Wed Oct 5 16:45:08 2022 +0000 URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=8be0a6a0
profiles: remove code duplication The function `traverse_parents_tree` is already implemented in pkgcore as `ProfileStack.stack`. Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org> src/pkgcheck/checks/profiles.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/pkgcheck/checks/profiles.py b/src/pkgcheck/checks/profiles.py index 73e2898e..db49cf38 100644 --- a/src/pkgcheck/checks/profiles.py +++ b/src/pkgcheck/checks/profiles.py @@ -168,14 +168,6 @@ class ProfilesCheck(Check): local_iuse | use_addon.global_iuse | use_addon.global_iuse_expand | use_addon.global_iuse_implicit) - @staticmethod - def traverse_parents_tree(profile): - def _traverse(node): - for parent in node.parents: - yield parent - yield from _traverse(parent) - return set(_traverse(profile)) - @verify_files(('parent', 'parents'), ('eapi', 'eapi')) def _pull_attr(self, *args): @@ -230,9 +222,8 @@ class ProfilesCheck(Check): @verify_files(('package.mask', 'masks'),) def _pkg_masks(self, filename, node, vals): - all_parents = self.traverse_parents_tree(node) all_masked = set().union(*(masked[1] - for p in all_parents if (masked := p.masks))) + for p in profiles_mod.ProfileStack(node.path).stack if (masked := p.masks))) unmasked, masked = vals for x in masked: