1 |
On 09/02/2016 01:49 PM, Mike Gilbert wrote: |
2 |
> Display-If-Installed already supported EAPI 5 atoms. |
3 |
> Use fnmatch for wildcard support on Display-If-Profile. |
4 |
> --- |
5 |
> pym/portage/news.py | 4 ++-- |
6 |
> 1 file changed, 2 insertions(+), 2 deletions(-) |
7 |
> |
8 |
> diff --git a/pym/portage/news.py b/pym/portage/news.py |
9 |
> index 177f9db..d6d2f07 100644 |
10 |
> --- a/pym/portage/news.py |
11 |
> +++ b/pym/portage/news.py |
12 |
> @@ -271,7 +271,7 @@ class NewsItem(object): |
13 |
> # will never match |
14 |
> format_match = _formatRE.match(line) |
15 |
> if (format_match is not None and |
16 |
> - not fnmatch.fnmatch(format_match.group(1), '1.*')): |
17 |
> + not fnmatch.fnmatch(format_match.group(1), '[12].*')): |
18 |
> invalids.append((i + 1, line.rstrip('\n'))) |
19 |
> break |
20 |
> if not line.startswith('D'): |
21 |
> @@ -325,7 +325,7 @@ class DisplayProfileRestriction(DisplayRestriction): |
22 |
> self.profile = profile |
23 |
> |
24 |
> def checkRestriction(self, **kwargs): |
25 |
> - if self.profile == kwargs['profile']: |
26 |
> + if fnmatch.fnmatch(kwargs['profile'], self.profile): |
27 |
> return True |
28 |
> return False |
29 |
> |
30 |
> |
31 |
|
32 |
Looks good. |
33 |
|
34 |
If we wanted to be more strict about the input that we accept, we could |
35 |
limit the profile wildcard match to so that it only works if the format |
36 |
is 2.* and only supports a terminal /* since that's all that the spec |
37 |
says is supported. |
38 |
-- |
39 |
Thanks, |
40 |
Zac |