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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 2A104138330 for ; Sat, 3 Sep 2016 22:13:09 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 98337E0B3D; Sat, 3 Sep 2016 22:13:05 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 03501E0B3C for ; Sat, 3 Sep 2016 22:13:04 +0000 (UTC) Received: from mail-it0-f41.google.com (mail-it0-f41.google.com [209.85.214.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: floppym) by smtp.gentoo.org (Postfix) with ESMTPSA id C4711340A6A for ; Sat, 3 Sep 2016 22:13:03 +0000 (UTC) Received: by mail-it0-f41.google.com with SMTP id e124so95974410ith.0 for ; Sat, 03 Sep 2016 15:13:03 -0700 (PDT) X-Gm-Message-State: AE9vXwMzHoxyKc6ZOSmor9XvFCD/xvTuJ3UJZp2yfHWd0gHwFZHncrf0YWtMWVuabDh/zkXpiatF7SEoQbxwEw== X-Received: by 10.36.74.138 with SMTP id k132mr13267913itb.85.1472940781577; Sat, 03 Sep 2016 15:13:01 -0700 (PDT) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org MIME-Version: 1.0 Received: by 10.79.103.196 with HTTP; Sat, 3 Sep 2016 15:12:41 -0700 (PDT) In-Reply-To: <94e0a255-b785-6694-aea5-7017a90f6078@gentoo.org> References: <20160902204924.6863-1-floppym@gentoo.org> <94e0a255-b785-6694-aea5-7017a90f6078@gentoo.org> From: Mike Gilbert Date: Sat, 3 Sep 2016 18:12:41 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [gentoo-portage-dev] [PATCH] news: Support News-Item-Format 2.0 To: gentoo-portage-dev@lists.gentoo.org Content-Type: text/plain; charset=UTF-8 X-Archives-Salt: 3dc9e9ef-d34a-41d0-ac81-ee3c73280519 X-Archives-Hash: 2bf22760395e13104a27af21300fbb82 On Sat, Sep 3, 2016 at 11:50 AM, Zac Medico wrote: > On 09/02/2016 01:49 PM, Mike Gilbert wrote: >> Display-If-Installed already supported EAPI 5 atoms. >> Use fnmatch for wildcard support on Display-If-Profile. >> --- >> pym/portage/news.py | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/pym/portage/news.py b/pym/portage/news.py >> index 177f9db..d6d2f07 100644 >> --- a/pym/portage/news.py >> +++ b/pym/portage/news.py >> @@ -271,7 +271,7 @@ class NewsItem(object): >> # will never match >> format_match = _formatRE.match(line) >> if (format_match is not None and >> - not fnmatch.fnmatch(format_match.group(1), '1.*')): >> + not fnmatch.fnmatch(format_match.group(1), '[12].*')): >> invalids.append((i + 1, line.rstrip('\n'))) >> break >> if not line.startswith('D'): >> @@ -325,7 +325,7 @@ class DisplayProfileRestriction(DisplayRestriction): >> self.profile = profile >> >> def checkRestriction(self, **kwargs): >> - if self.profile == kwargs['profile']: >> + if fnmatch.fnmatch(kwargs['profile'], self.profile): >> return True >> return False >> >> > > Looks good. > > If we wanted to be more strict about the input that we accept, we could > limit the profile wildcard match to so that it only works if the format > is 2.* and only supports a terminal /* since that's all that the spec > says is supported. I don't know how to implement such a thing off the top if my head. Feel free to replace my code with something more strict.