From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 4ED2C158020 for ; Sat, 26 Nov 2022 11:47:36 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 64E13E0886; Sat, 26 Nov 2022 11:47:35 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (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 pigeon.gentoo.org (Postfix) with ESMTPS id 460C7E0886 for ; Sat, 26 Nov 2022 11:47:35 +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) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 56B6434148F for ; Sat, 26 Nov 2022 11:47:34 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 891BE763 for ; Sat, 26 Nov 2022 11:47:32 +0000 (UTC) From: "Arthur Zamarin" 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" Message-ID: <1669462658.7485d43076c062e4eb637bcf2bcc10ed5623ef4a.arthurzam@gentoo> Subject: [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: testdata/repos/python/stub/python-dep1/, testdata/repos/python/stub/python-dep2/, ... X-VCS-Repository: proj/pkgcore/pkgcheck X-VCS-Files: src/pkgcheck/checks/python.py testdata/repos/python/stub/python-dep1/python-dep1-0.ebuild testdata/repos/python/stub/python-dep2/python-dep2-0.ebuild testdata/repos/python/stub/python2-locked/python2-locked-0.ebuild testdata/repos/python/stub/python2-locked/python2-locked-1.ebuild testdata/repos/python/stub/python2-locked/python2-locked-2.ebuild tests/checks/test_python.py X-VCS-Directories: testdata/repos/python/stub/python-dep2/ src/pkgcheck/checks/ testdata/repos/python/stub/python2-locked/ tests/checks/ testdata/repos/python/stub/python-dep1/ X-VCS-Committer: arthurzam X-VCS-Committer-Name: Arthur Zamarin X-VCS-Revision: 7485d43076c062e4eb637bcf2bcc10ed5623ef4a X-VCS-Branch: master Date: Sat, 26 Nov 2022 11:47:32 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 3d889651-eac3-4fdf-94d3-f15a760d9974 X-Archives-Hash: 070bfd13bb804511a1bafcec07c6be27 commit: 7485d43076c062e4eb637bcf2bcc10ed5623ef4a Author: Michał Górny gentoo org> AuthorDate: Thu Nov 24 19:18:38 2022 +0000 Commit: Arthur Zamarin gentoo org> CommitDate: Sat Nov 26 11:37:38 2022 +0000 URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=7485d430 PythonCheck: stop warning about eclass use on python:2.7 deps The python2_7 target support are phased out from the eclass, so stop warning about direct dependencies. Signed-off-by: Michał Górny gentoo.org> src/pkgcheck/checks/python.py | 22 +++++++++++--------- .../python/stub/python-dep1/python-dep1-0.ebuild | 2 +- .../python/stub/python-dep2/python-dep2-0.ebuild | 2 +- .../stub/python2-locked/python2-locked-0.ebuild | 15 -------------- .../stub/python2-locked/python2-locked-1.ebuild | 12 ----------- .../stub/python2-locked/python2-locked-2.ebuild | 11 ---------- tests/checks/test_python.py | 24 ++++++++-------------- 7 files changed, 22 insertions(+), 66 deletions(-) diff --git a/src/pkgcheck/checks/python.py b/src/pkgcheck/checks/python.py index 918b5d5b..d8f7eb0b 100644 --- a/src/pkgcheck/checks/python.py +++ b/src/pkgcheck/checks/python.py @@ -17,12 +17,6 @@ from . import Check # NB: distutils-r1 inherits one of the first two ECLASSES = frozenset(['python-r1', 'python-single-r1', 'python-any-r1']) -# NB: dev-java/jython omitted as not supported by the eclasses atm -INTERPRETERS = frozenset([ - 'dev-lang/python', - 'dev-python/pypy3', -]) - IUSE_PREFIX = 'python_targets_' IUSE_PREFIX_S = 'python_single_target_' @@ -41,6 +35,14 @@ def get_python_eclass(pkg): return next(iter(eclasses)) if eclasses else None +def is_python_interpreter(pkg): + if pkg.key == "dev-lang/python": + # 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"] + + class MissingPythonEclass(results.VersionResult, results.Warning): """Package depends on Python but does not use the eclasses. @@ -300,7 +302,7 @@ class PythonCheck(Check): flag = next(iter(x.restriction.vals)) if not flag.startswith(prefix): continue - if not any(y.key in INTERPRETERS for y in x if isinstance(y, atom)): + if not any(is_python_interpreter(y) for y in x if isinstance(y, atom)): continue matched.add(flag[len(prefix):]) if matched == flags: @@ -436,7 +438,7 @@ class PythonCheck(Check): highest_found = None for attr in (x.lower() for x in pkg.eapi.dep_keys): for p in iflatten_instance(getattr(pkg, attr), atom): - if not p.blocks and p.key in INTERPRETERS: + if not p.blocks and is_python_interpreter(p): highest_found = (attr, p) # break scanning packages, go to next attr break @@ -466,11 +468,11 @@ class PythonCheck(Check): else: # python-any-r1 for attr in ("rdepend", "pdepend"): for p in iflatten_instance(getattr(pkg, attr), atom): - if not p.blocks and p.key in INTERPRETERS: + if not p.blocks and is_python_interpreter(p): yield PythonRuntimeDepInAnyR1(attr.upper(), str(p), pkg=pkg) break if not any( - not p.blocks and p.key in INTERPRETERS + not p.blocks and is_python_interpreter(p) for attr in ("depend", "bdepend") for p in iflatten_instance(getattr(pkg, attr), atom) ): diff --git a/testdata/repos/python/stub/python-dep1/python-dep1-0.ebuild b/testdata/repos/python/stub/python-dep1/python-dep1-0.ebuild index 55c455d9..a06d41df 100644 --- a/testdata/repos/python/stub/python-dep1/python-dep1-0.ebuild +++ b/testdata/repos/python/stub/python-dep1/python-dep1-0.ebuild @@ -1,5 +1,5 @@ EAPI=7 -PYTHON_COMPAT=( python2_7 python3_{7,8,9,10} ) +PYTHON_COMPAT=( python3_{7,8,9,10} ) inherit python-r1 diff --git a/testdata/repos/python/stub/python-dep2/python-dep2-0.ebuild b/testdata/repos/python/stub/python-dep2/python-dep2-0.ebuild index 55c455d9..a06d41df 100644 --- a/testdata/repos/python/stub/python-dep2/python-dep2-0.ebuild +++ b/testdata/repos/python/stub/python-dep2/python-dep2-0.ebuild @@ -1,5 +1,5 @@ EAPI=7 -PYTHON_COMPAT=( python2_7 python3_{7,8,9,10} ) +PYTHON_COMPAT=( python3_{7,8,9,10} ) inherit python-r1 diff --git a/testdata/repos/python/stub/python2-locked/python2-locked-0.ebuild b/testdata/repos/python/stub/python2-locked/python2-locked-0.ebuild deleted file mode 100644 index 2e5edb6b..00000000 --- a/testdata/repos/python/stub/python2-locked/python2-locked-0.ebuild +++ /dev/null @@ -1,15 +0,0 @@ -EAPI=7 -PYTHON_COMPAT=( python2_7 ) - -inherit python-r1 - -DESCRIPTION="Ebuild locked on python2" -HOMEPAGE="https://github.com/pkgcore/pkgcheck" -LICENSE="BSD" -SLOT="0" -REQUIRED_USE="${PYTHON_REQUIRED_USE}" - -RDEPEND=" - ${PYTHON_DEPS} - stub/python-dep1[${PYTHON_USEDEP}] -" diff --git a/testdata/repos/python/stub/python2-locked/python2-locked-1.ebuild b/testdata/repos/python/stub/python2-locked/python2-locked-1.ebuild deleted file mode 100644 index 4766cdfe..00000000 --- a/testdata/repos/python/stub/python2-locked/python2-locked-1.ebuild +++ /dev/null @@ -1,12 +0,0 @@ -EAPI=7 -PYTHON_COMPAT=( python2_7 ) - -inherit python-single-r1 - -DESCRIPTION="Ebuild locked on python2" -HOMEPAGE="https://github.com/pkgcore/pkgcheck" -LICENSE="BSD" -SLOT="0" -REQUIRED_USE="${PYTHON_REQUIRED_USE}" - -RDEPEND="${PYTHON_DEPS}" diff --git a/testdata/repos/python/stub/python2-locked/python2-locked-2.ebuild b/testdata/repos/python/stub/python2-locked/python2-locked-2.ebuild deleted file mode 100644 index fff2a3b4..00000000 --- a/testdata/repos/python/stub/python2-locked/python2-locked-2.ebuild +++ /dev/null @@ -1,11 +0,0 @@ -EAPI=7 -PYTHON_COMPAT=( python2_7 ) - -inherit python-any-r1 - -DESCRIPTION="Ebuild locked on python2" -HOMEPAGE="https://github.com/pkgcore/pkgcheck" -LICENSE="BSD" -SLOT="0" - -DEPEND="${PYTHON_DEPS}" diff --git a/tests/checks/test_python.py b/tests/checks/test_python.py index ec48a378..843975b5 100644 --- a/tests/checks/test_python.py +++ b/tests/checks/test_python.py @@ -29,9 +29,7 @@ class TestPythonCheck(misc.ReportTestCase): assert isinstance(r, python.MissingPythonEclass) assert 'missing python-any-r1 eclass usage for DEPEND="dev-lang/python"' in str(r) - assert isinstance( - self.assertReport(self.check, self.mk_pkg(DEPEND='dev-lang/python:2.7')), - python.MissingPythonEclass) + self.assertNoReport(self.check, self.mk_pkg(DEPEND='dev-lang/python:2.7')) assert isinstance( self.assertReport(self.check, self.mk_pkg(DEPEND='dev-lang/python:*')), python.MissingPythonEclass) @@ -53,9 +51,7 @@ class TestPythonCheck(misc.ReportTestCase): assert isinstance( self.assertReport(self.check, self.mk_pkg(BDEPEND='dev-lang/python')), python.MissingPythonEclass) - assert isinstance( - self.assertReport(self.check, self.mk_pkg(BDEPEND='dev-lang/python:2.7')), - python.MissingPythonEclass) + self.assertNoReport(self.check, self.mk_pkg(BDEPEND='dev-lang/python:2.7')) assert isinstance( self.assertReport(self.check, self.mk_pkg(BDEPEND='dev-lang/python:*')), python.MissingPythonEclass) @@ -71,19 +67,17 @@ class TestPythonCheck(misc.ReportTestCase): def test_missing_eclass_rdepend(self): self.assertNoReport( self.check, - self.mk_pkg(_eclasses_=['python-r1'], RDEPEND='dev-lang/python:2.7')) + self.mk_pkg(_eclasses_=['python-r1'], RDEPEND='dev-lang/python:3.7')) self.assertNoReport( self.check, - self.mk_pkg(_eclasses_=['python-single-r1'], RDEPEND='dev-lang/python:2.7')) + self.mk_pkg(_eclasses_=['python-single-r1'], RDEPEND='dev-lang/python:3.7')) self.assertNoReport(self.check, self.mk_pkg(RDEPEND='dev-foo/frobnicate')) r = self.assertReport(self.check, self.mk_pkg(RDEPEND='dev-lang/python')) assert isinstance(r, python.MissingPythonEclass) assert 'missing python-r1 or python-single-r1 eclass' in str(r) - assert isinstance( - self.assertReport(self.check, self.mk_pkg(RDEPEND='dev-lang/python:2.7')), - python.MissingPythonEclass) + self.assertNoReport(self.check, self.mk_pkg(RDEPEND='dev-lang/python:2.7')) assert isinstance( self.assertReport(self.check, self.mk_pkg(RDEPEND='dev-lang/python:=')), python.MissingPythonEclass) @@ -99,18 +93,16 @@ class TestPythonCheck(misc.ReportTestCase): def test_missing_eclass_pdepend(self): self.assertNoReport( self.check, - self.mk_pkg(_eclasses_=['python-r1'], PDEPEND='dev-lang/python:2.7')) + self.mk_pkg(_eclasses_=['python-r1'], PDEPEND='dev-lang/python:3.7')) self.assertNoReport( self.check, - self.mk_pkg(_eclasses_=['python-single-r1'], PDEPEND='dev-lang/python:2.7')) + self.mk_pkg(_eclasses_=['python-single-r1'], PDEPEND='dev-lang/python:3.7')) self.assertNoReport(self.check, self.mk_pkg(PDEPEND='dev-foo/frobnicate')) assert isinstance( self.assertReport(self.check, self.mk_pkg(PDEPEND='dev-lang/python')), python.MissingPythonEclass) - assert isinstance( - self.assertReport(self.check, self.mk_pkg(PDEPEND='dev-lang/python:2.7')), - python.MissingPythonEclass) + self.assertNoReport(self.check, self.mk_pkg(PDEPEND='dev-lang/python:2.7')) assert isinstance( self.assertReport(self.check, self.mk_pkg(PDEPEND='dev-lang/python:=')), python.MissingPythonEclass)