Gentoo Archives: gentoo-commits

From: Arthur Zamarin <arthurzam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
Date: Tue, 31 Jan 2023 17:08:53
Message-Id: 1675184820.e8a4b35b90c6c3ab1b7029770d2e47c4be0dbeb2.arthurzam@gentoo
1 commit: e8a4b35b90c6c3ab1b7029770d2e47c4be0dbeb2
2 Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jan 31 17:07:00 2023 +0000
4 Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
5 CommitDate: Tue Jan 31 17:07:00 2023 +0000
6 URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=e8a4b35b
7
8 checks.python: small modernization
9
10 Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
11
12 src/pkgcheck/checks/python.py | 27 +++++++++++----------------
13 1 file changed, 11 insertions(+), 16 deletions(-)
14
15 diff --git a/src/pkgcheck/checks/python.py b/src/pkgcheck/checks/python.py
16 index 41edac21..2b20ee93 100644
17 --- a/src/pkgcheck/checks/python.py
18 +++ b/src/pkgcheck/checks/python.py
19 @@ -41,7 +41,7 @@ def is_python_interpreter(pkg):
20 # ignore python:2.7 deps since they are being phased out from eclass
21 # support
22 return pkg.slot is None or not pkg.slot.startswith("2")
23 - return pkg.key in ["dev-python/pypy3"]
24 + return pkg.key in ("dev-python/pypy3",)
25
26
27 class MissingPythonEclass(results.VersionResult, results.Warning):
28 @@ -74,9 +74,7 @@ class PythonMissingRequiredUse(results.VersionResult, results.Warning):
29 used conditionally, it can be wrapped in appropriate USE conditionals.
30 """
31
32 - @property
33 - def desc(self):
34 - return 'missing REQUIRED_USE="${PYTHON_REQUIRED_USE}"'
35 + desc = 'missing REQUIRED_USE="${PYTHON_REQUIRED_USE}"'
36
37
38 class PythonMissingDeps(results.VersionResult, results.Warning):
39 @@ -138,9 +136,7 @@ class PythonEclassError(results.VersionResult, results.Error):
40 class DistutilsNonPEP517Build(results.VersionResult, results.Warning):
41 """Ebuild uses the deprecated non-PEP517 build"""
42
43 - @property
44 - def desc(self):
45 - return "uses deprecated non-PEP517 build mode, please switch to " "DISTUTILS_USE_PEP517=..."
46 + desc = "uses deprecated non-PEP517 build mode, please switch to DISTUTILS_USE_PEP517=..."
47
48
49 class PythonHasVersionUsage(results.LinesResult, results.Style):
50 @@ -173,7 +169,7 @@ class PythonHasVersionMissingPythonUseDep(results.LineResult, results.Error):
51 @property
52 def desc(self):
53 return (
54 - f'line: {self.lineno}: missing [${{PYTHON_USEDEP}}] suffix for argument "{self.line}"'
55 + f"line: {self.lineno}: missing [${{PYTHON_USEDEP}}] suffix for argument {self.line!r}"
56 )
57
58
59 @@ -270,8 +266,7 @@ class PythonCheck(Check):
60 def scan_tree_recursively(self, deptree, expected_cls):
61 for x in deptree:
62 if not isinstance(x, expected_cls):
63 - for y in self.scan_tree_recursively(x, expected_cls):
64 - yield y
65 + yield from self.scan_tree_recursively(x, expected_cls)
66 yield deptree
67
68 def check_required_use(self, requse, flags, prefix, container_cls):
69 @@ -576,12 +571,12 @@ class PythonCompatCheck(Check):
70 def deps(self, pkg, attrs=None):
71 """Set of dependencies for a given package's attributes."""
72 attrs = attrs if attrs is not None else pkg.eapi.dep_keys
73 - deps = set()
74 - for attr in (x.lower() for x in attrs):
75 - for p in iflatten_instance(getattr(pkg, attr), atom):
76 - if not p.blocks:
77 - deps.add(p)
78 - return deps
79 + return {
80 + p
81 + for attr in (x.lower() for x in attrs)
82 + for p in iflatten_instance(getattr(pkg, attr), atom)
83 + if not p.blocks
84 + }
85
86 def feed(self, pkg):
87 try: