Gentoo Archives: gentoo-portage-dev

From: Alexander Berntsen <bernalex@g.o>
To: gentoo-portage-dev@l.g.o
Cc: ulm@g.o
Subject: [gentoo-portage-dev] [PATCH v2] news.py: Check only for major version when parsing
Date: Thu, 19 May 2016 10:12:34
Message-Id: 1463652741-9290-1-git-send-email-bernalex@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH] news.py: Check only for major version when parsing by Alexander Berntsen
1 Only check the major version of news items, as GLEP 42 specifies an
2 upgrade path for them. Future revisions to news item formats may yield
3 minor number increments. GLEP 42 further ensures that only
4 forwards-compatible changes may incur, as incompatible changes demand a
5 major version increment.
6
7 Suggested-by: Ulrich Müller <ulm@g.o>
8 Signed-off-by: Alexander Berntsen <bernalex@g.o>
9 ---
10 pym/portage/news.py | 4 +++-
11 1 file changed, 3 insertions(+), 1 deletion(-)
12
13 diff --git a/pym/portage/news.py b/pym/portage/news.py
14 index 784ba70..ea1b947 100644
15 --- a/pym/portage/news.py
16 +++ b/pym/portage/news.py
17 @@ -9,6 +9,7 @@ __all__ = ["NewsManager", "NewsItem", "DisplayRestriction",
18 "DisplayInstalledRestriction",
19 "count_unread_news", "display_news_notifications"]
20
21 +import fnmatch
22 import io
23 import logging
24 import os as _os
25 @@ -270,7 +271,8 @@ class NewsItem(object):
26 # Optimization to ignore regex matchines on lines that
27 # will never match
28 format_match = _formatRE.match(line)
29 - if format_match is not None and format_match.group(1) != '1.0':
30 + if (format_match is not None and
31 + not fnmatch.fnmatch(format_match.group(1), '1.*')):
32 invalids.append((i + 1, line.rstrip('\n')))
33 break
34 if not line.startswith('D'):
35 --
36 2.7.3

Replies