From: Zac Medico <zmedico@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Subject: Re: [gentoo-portage-dev] [PATCH] news: Support News-Item-Format 2.0
Date: Sat, 3 Sep 2016 08:50:32 -0700 [thread overview]
Message-ID: <94e0a255-b785-6694-aea5-7017a90f6078@gentoo.org> (raw)
In-Reply-To: <20160902204924.6863-1-floppym@gentoo.org>
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.
--
Thanks,
Zac
next prev parent reply other threads:[~2016-09-03 15:50 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-02 20:49 [gentoo-portage-dev] [PATCH] news: Support News-Item-Format 2.0 Mike Gilbert
2016-09-03 15:50 ` Zac Medico [this message]
2016-09-03 18:27 ` Ulrich Mueller
2016-09-03 22:12 ` Mike Gilbert
2016-09-04 16:58 ` [gentoo-portage-dev] [PATCH v2] " Mike Gilbert
2016-09-04 17:04 ` [gentoo-portage-dev] [PATCH v3] " Mike Gilbert
2016-09-07 7:26 ` Zac Medico
2016-09-07 21:03 ` [gentoo-portage-dev] [PATCH v4] " Mike Gilbert
2016-09-08 0:31 ` Zac Medico
2016-09-08 5:31 ` [gentoo-portage-dev] [PATCH v5] " Mike Gilbert
2016-09-10 22:05 ` Zac Medico
2016-09-07 21:06 ` [gentoo-portage-dev] [PATCH v3] " Mike Gilbert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=94e0a255-b785-6694-aea5-7017a90f6078@gentoo.org \
--to=zmedico@gentoo.org \
--cc=gentoo-portage-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox