Re: [gentoo-portage-dev] [PATCH v2] news.py: Check only for major version when parsing
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Pushed as 68ad3c50221023f6919d66a1d07d4976da037552. - -- Alexander berna...@gentoo.org https://secure.plaimi.net/~alexander -BEGIN PGP SIGNATURE- Version: GnuPG v2 iQIcBAEBCgAGBQJXPtJyAAoJENQqWdRUGk8BTlsQALGGBrKfwv3VpCRYnhn+nONx 8U75FF8ZJQetIIa9aZJFTpNXDmizvrbSL0LRIZqaB7Ymd4uQcQcL3l+4CZF/+px5 Opru24HvOLsXwCohsVgMBUrQaa+11IQDicgn81Q+ziM0FYKJrJCSjeX22j5n4M4N Yj1ieoUYudN2G0k3fhPAI3CADDvGwEH6t8z/C5K4vf+2odE56JUy5vQkJx2UCvI4 xBtdjj8PAx7DZhVvKS0O5bODyhjAJgg6273eKnuJA8NNxa9NQycI3L7/cM+G07Cp lziIGCBCGZrEbI9kbPbiYNIXYkvlCeUptP9PjAQ30cHbMu3Xt/mQyX+jiX9HZug7 VAseEE5g7wXIqGM7ds7/saGAkHwRarwlT+xHHY0GcOnO3MMUDZmVwGE+JVlejA1p OerC7Uc/U1llNS4l/HTdmWRr2aabN+gt02xFp7VSDcpougreQmedMI/3YnL6FXGd qZnLHerkhreCjibHcbacLjHk9uFK6qnUU90Bh8fwcQfn9mYBPMYlfd1Vjuw9ehst iRhUsT+ezl/MqrIHk7tDTihEV7TfyafV7NofOgJHu2bLzoa8Y1MfxXyxGO9em1/m iX+suc4e2qwiIGUPI+4yxiil/va5r9S9bUhU/RpGazB7jRyaqKKQV1+4XTzWj5ws 2M1+7vSYPzWhDAJErREB =wmCB -END PGP SIGNATURE-
Re: [gentoo-portage-dev] [PATCH v2] news.py: Check only for major version when parsing
On 05/19/2016 03:12 AM, Alexander Berntsen wrote: > Only check the major version of news items, as GLEP 42 specifies an > upgrade path for them. Future revisions to news item formats may yield > minor number increments. GLEP 42 further ensures that only > forwards-compatible changes may incur, as incompatible changes demand a > major version increment. > > Suggested-by: Ulrich Müller > Signed-off-by: Alexander Berntsen > --- > pym/portage/news.py | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/pym/portage/news.py b/pym/portage/news.py > index 784ba70..ea1b947 100644 > --- a/pym/portage/news.py > +++ b/pym/portage/news.py > @@ -9,6 +9,7 @@ __all__ = ["NewsManager", "NewsItem", "DisplayRestriction", > "DisplayInstalledRestriction", > "count_unread_news", "display_news_notifications"] > > +import fnmatch > import io > import logging > import os as _os > @@ -270,7 +271,8 @@ class NewsItem(object): > # Optimization to ignore regex matchines on lines that > # will never match > format_match = _formatRE.match(line) > - if format_match is not None and format_match.group(1) > != '1.0': > + if (format_match is not None and > + not > fnmatch.fnmatch(format_match.group(1), '1.*')): > invalids.append((i + 1, line.rstrip('\n'))) > break > if not line.startswith('D'): > Looks good. -- Thanks, Zac
[gentoo-portage-dev] [PATCH v2] news.py: Check only for major version when parsing
Only check the major version of news items, as GLEP 42 specifies an upgrade path for them. Future revisions to news item formats may yield minor number increments. GLEP 42 further ensures that only forwards-compatible changes may incur, as incompatible changes demand a major version increment. Suggested-by: Ulrich Müller Signed-off-by: Alexander Berntsen --- pym/portage/news.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pym/portage/news.py b/pym/portage/news.py index 784ba70..ea1b947 100644 --- a/pym/portage/news.py +++ b/pym/portage/news.py @@ -9,6 +9,7 @@ __all__ = ["NewsManager", "NewsItem", "DisplayRestriction", "DisplayInstalledRestriction", "count_unread_news", "display_news_notifications"] +import fnmatch import io import logging import os as _os @@ -270,7 +271,8 @@ class NewsItem(object): # Optimization to ignore regex matchines on lines that # will never match format_match = _formatRE.match(line) - if format_match is not None and format_match.group(1) != '1.0': + if (format_match is not None and + not fnmatch.fnmatch(format_match.group(1), '1.*')): invalids.append((i + 1, line.rstrip('\n'))) break if not line.startswith('D'): -- 2.7.3