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 386BC158020 for ; Mon, 26 Dec 2022 17:28:08 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 18C1EE0953; Mon, 26 Dec 2022 17:28:07 +0000 (UTC) Received: from smtp.gentoo.org (smtp.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)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id D3156E0953 for ; Mon, 26 Dec 2022 17:28:06 +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 EFB3F341104 for ; Mon, 26 Dec 2022 17:28:05 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 2BCBC7F2 for ; Mon, 26 Dec 2022 17:28:04 +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: <1672075644.621c460b9be22c14d42fa8ca229e60582aee8067.arthurzam@gentoo> Subject: [gentoo-commits] proj/pkgcore/pkgcore:master commit in: src/pkgcore/ebuild/ X-VCS-Repository: proj/pkgcore/pkgcore X-VCS-Files: src/pkgcore/ebuild/eapi.py X-VCS-Directories: src/pkgcore/ebuild/ X-VCS-Committer: arthurzam X-VCS-Committer-Name: Arthur Zamarin X-VCS-Revision: 621c460b9be22c14d42fa8ca229e60582aee8067 X-VCS-Branch: master Date: Mon, 26 Dec 2022 17:28:04 +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: 454ba8a1-f0bd-4824-89b3-895edfbc5d22 X-Archives-Hash: 50ccb7ea60ae072150772f68c42dcc3d commit: 621c460b9be22c14d42fa8ca229e60582aee8067 Author: Brian Harring gmail com> AuthorDate: Mon Dec 26 00:19:43 2022 +0000 Commit: Arthur Zamarin gentoo org> CommitDate: Mon Dec 26 17:27:24 2022 +0000 URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcore.git/commit/?id=621c460b Add a constant of the latest PMS version, and add use flag validation to EAPI. Currently no EAPI varies the use flag parsing rules, but if it ever comes up, this will address it. In the process, this also will be used to move some logic out of atom.py whilst introducing the concept of 'latest PMS' as the 'latest' rules to parse under in the absense of an explicit directive. Signed-off-by: Brian Harring gmail.com> Signed-off-by: Arthur Zamarin gentoo.org> src/pkgcore/ebuild/eapi.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/pkgcore/ebuild/eapi.py b/src/pkgcore/ebuild/eapi.py index 2ec7557e0..85ba43be7 100644 --- a/src/pkgcore/ebuild/eapi.py +++ b/src/pkgcore/ebuild/eapi.py @@ -12,10 +12,19 @@ from snakeoil.mappings import ImmutableDict, OrderedFrozenSet, inject_getitem_as from snakeoil.osutils import pjoin from snakeoil.process.spawn import bash_version +LATEST_PMS_EAPI_VER = "8" + + +def get_latest_PMS_eapi(): + """return the latest PMS EAPI object known to this version of pkgcore""" + return get_eapi(LATEST_PMS_EAPI_VER) + + from ..log import logger from . import atom, const demand_compile_regexp("_valid_EAPI_regex", r"^[A-Za-z0-9_][A-Za-z0-9+_.-]*$") +demand_compile_regexp("_valid_use_flag", r"^[A-Za-z0-9][A-Za-z0-9+_@-]*$") eapi_optionals = ImmutableDict( { @@ -461,6 +470,10 @@ class EAPI(metaclass=klass.immutable_instance): d["EAPI"] = self._magic return ImmutableDict(d) + def is_valid_use_flag(self, s: str) -> bool: + """returns True if the flag is parsable under this EAPI""" + return _valid_use_flag.match(s) is not None + def get_eapi(magic, suppress_unsupported=True): """Return EAPI object for a given identifier."""