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 3F0EB158089 for ; Tue, 24 Oct 2023 18:37:34 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 82CB62BC021; Tue, 24 Oct 2023 18:37:33 +0000 (UTC) Received: from smtp.gentoo.org (dev.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 6C5B32BC021 for ; Tue, 24 Oct 2023 18:37:33 +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 B3187335CDF for ; Tue, 24 Oct 2023 18:37:32 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 543A412C6 for ; Tue, 24 Oct 2023 18:37:30 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1698170903.7a43de7a8ce8dc6836d998cb87a5135ba8f0bc2c.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/dbapi/ X-VCS-Repository: proj/portage X-VCS-Files: lib/portage/dbapi/__init__.py X-VCS-Directories: lib/portage/dbapi/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 7a43de7a8ce8dc6836d998cb87a5135ba8f0bc2c X-VCS-Branch: master Date: Tue, 24 Oct 2023 18:37:30 +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: e5ee4844-6654-48d5-95b4-6b2855ac224f X-Archives-Hash: a461a820b22da0308e7311b61ea4bbb0 commit: 7a43de7a8ce8dc6836d998cb87a5135ba8f0bc2c Author: Zac Medico gentoo org> AuthorDate: Tue Oct 24 18:07:53 2023 +0000 Commit: Zac Medico gentoo org> CommitDate: Tue Oct 24 18:08:23 2023 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=7a43de7a dbapi: Make _iuse_implicit_cnstr picklable for spawn compat Bug: https://bugs.gentoo.org/916235 Signed-off-by: Zac Medico gentoo.org> lib/portage/dbapi/__init__.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/portage/dbapi/__init__.py b/lib/portage/dbapi/__init__.py index 233da8d698..dd697db109 100644 --- a/lib/portage/dbapi/__init__.py +++ b/lib/portage/dbapi/__init__.py @@ -1,8 +1,9 @@ -# Copyright 1998-2020 Gentoo Authors +# Copyright 1998-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 __all__ = ["dbapi"] +import functools import re import warnings from typing import Any, Dict, List, Optional, Tuple @@ -223,6 +224,10 @@ class dbapi: yield cpv + @staticmethod + def _iuse_implicit_built(iuse_implicit_match, use, flag): + return iuse_implicit_match(flag) or flag in use + def _iuse_implicit_cnstr(self, pkg, metadata): """ Construct a callable that checks if a given USE flag should @@ -257,9 +262,11 @@ class dbapi: # This behavior is only used for EAPIs that support IUSE_EFFECTIVE, # since built USE settings for earlier EAPIs may contain a large # number of irrelevant flags. - prof_iuse = iuse_implicit_match - enabled = frozenset(metadata["USE"].split()).__contains__ - iuse_implicit_match = lambda flag: prof_iuse(flag) or enabled(flag) + iuse_implicit_match = functools.partial( + self._iuse_implicit_built, + iuse_implicit_match, + frozenset(metadata["USE"].split()), + ) return iuse_implicit_match