From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <gentoo-commits+bounces-1482559-garchives=archives.gentoo.org@lists.gentoo.org> Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id C76E815800F for <garchives@archives.gentoo.org>; Tue, 31 Jan 2023 17:08:53 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0646EE0CDA; Tue, 31 Jan 2023 17:08:53 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id E0A32E0CDA for <gentoo-commits@lists.gentoo.org>; Tue, 31 Jan 2023 17:08:52 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 1AAF1340D5F for <gentoo-commits@lists.gentoo.org>; Tue, 31 Jan 2023 17:08:52 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id A4BEB889 for <gentoo-commits@lists.gentoo.org>; Tue, 31 Jan 2023 17:08:50 +0000 (UTC) From: "Arthur Zamarin" <arthurzam@gentoo.org> To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Arthur Zamarin" <arthurzam@gentoo.org> Message-ID: <1675184820.e8a4b35b90c6c3ab1b7029770d2e47c4be0dbeb2.arthurzam@gentoo> Subject: [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/ X-VCS-Repository: proj/pkgcore/pkgcheck X-VCS-Files: src/pkgcheck/checks/python.py X-VCS-Directories: src/pkgcheck/checks/ X-VCS-Committer: arthurzam X-VCS-Committer-Name: Arthur Zamarin X-VCS-Revision: e8a4b35b90c6c3ab1b7029770d2e47c4be0dbeb2 X-VCS-Branch: master Date: Tue, 31 Jan 2023 17:08:50 +0000 (UTC) Precedence: bulk List-Post: <mailto:gentoo-commits@lists.gentoo.org> List-Help: <mailto:gentoo-commits+help@lists.gentoo.org> List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org> List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org> List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org> X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 93f108d5-dca7-4350-8591-53fddaa743e2 X-Archives-Hash: 53bdc90c4f3b6d34a272c004b003d81d commit: e8a4b35b90c6c3ab1b7029770d2e47c4be0dbeb2 Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org> AuthorDate: Tue Jan 31 17:07:00 2023 +0000 Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org> CommitDate: Tue Jan 31 17:07:00 2023 +0000 URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=e8a4b35b checks.python: small modernization Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org> src/pkgcheck/checks/python.py | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/src/pkgcheck/checks/python.py b/src/pkgcheck/checks/python.py index 41edac21..2b20ee93 100644 --- a/src/pkgcheck/checks/python.py +++ b/src/pkgcheck/checks/python.py @@ -41,7 +41,7 @@ def is_python_interpreter(pkg): # ignore python:2.7 deps since they are being phased out from eclass # support return pkg.slot is None or not pkg.slot.startswith("2") - return pkg.key in ["dev-python/pypy3"] + return pkg.key in ("dev-python/pypy3",) class MissingPythonEclass(results.VersionResult, results.Warning): @@ -74,9 +74,7 @@ class PythonMissingRequiredUse(results.VersionResult, results.Warning): used conditionally, it can be wrapped in appropriate USE conditionals. """ - @property - def desc(self): - return 'missing REQUIRED_USE="${PYTHON_REQUIRED_USE}"' + desc = 'missing REQUIRED_USE="${PYTHON_REQUIRED_USE}"' class PythonMissingDeps(results.VersionResult, results.Warning): @@ -138,9 +136,7 @@ class PythonEclassError(results.VersionResult, results.Error): class DistutilsNonPEP517Build(results.VersionResult, results.Warning): """Ebuild uses the deprecated non-PEP517 build""" - @property - def desc(self): - return "uses deprecated non-PEP517 build mode, please switch to " "DISTUTILS_USE_PEP517=..." + desc = "uses deprecated non-PEP517 build mode, please switch to DISTUTILS_USE_PEP517=..." class PythonHasVersionUsage(results.LinesResult, results.Style): @@ -173,7 +169,7 @@ class PythonHasVersionMissingPythonUseDep(results.LineResult, results.Error): @property def desc(self): return ( - f'line: {self.lineno}: missing [${{PYTHON_USEDEP}}] suffix for argument "{self.line}"' + f"line: {self.lineno}: missing [${{PYTHON_USEDEP}}] suffix for argument {self.line!r}" ) @@ -270,8 +266,7 @@ class PythonCheck(Check): def scan_tree_recursively(self, deptree, expected_cls): for x in deptree: if not isinstance(x, expected_cls): - for y in self.scan_tree_recursively(x, expected_cls): - yield y + yield from self.scan_tree_recursively(x, expected_cls) yield deptree def check_required_use(self, requse, flags, prefix, container_cls): @@ -576,12 +571,12 @@ class PythonCompatCheck(Check): def deps(self, pkg, attrs=None): """Set of dependencies for a given package's attributes.""" attrs = attrs if attrs is not None else pkg.eapi.dep_keys - deps = set() - for attr in (x.lower() for x in attrs): - for p in iflatten_instance(getattr(pkg, attr), atom): - if not p.blocks: - deps.add(p) - return deps + return { + p + for attr in (x.lower() for x in attrs) + for p in iflatten_instance(getattr(pkg, attr), atom) + if not p.blocks + } def feed(self, pkg): try: