commit 40f20dde22bf8668b7407ebaf8972138348ca0c8
parent 087b357d3b6c479b11bf3fd1d04fc74ffb833a21
Author: KΓ©vin Le Gouguec <kevin.legouguec@gmail.com>
Date: Sun, 24 Jun 2018 12:28:11 +0200
Add openFATE to recognized bug trackers
openFATE references are sometimes capitalized (eg Fate#β¦); this means
the captured tracker cannot be used as key directly.
I considered going back to the subclasses and class variables, but
AFAICT
1. case-insensitivity might be desirable for all trackers anyway,
2. references to other trackers will remain simple enough to parse
that they can also be described by a short identifier and a URL
template.
Diffstat:
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/.config/terminator/plugins/susechangelog.py b/.config/terminator/plugins/susechangelog.py
@@ -4,27 +4,29 @@ import re
from terminatorlib.plugin import URLHandler
-AVAILABLE = ['SuseChangelogURLHandler']
+AVAILABLE = ['SuseTrackersURLHandler']
_TRACKERS = {
'bsc': 'https://bugzilla.suse.com/show_bug.cgi?id={}',
+ 'fate': 'https://features.opensuse.org/{}',
'fdo': 'https://bugs.freedesktop.org/show_bug.cgi?id={}'
}
-_MATCH = r'(?P<tracker>{t})#(?P<id>{i})'.format(
+_MATCH = r'(?i)(?P<tracker>{t})#(?P<id>{i})'.format(
t='|'.join(_TRACKERS),
i='[0-9]+(?:#c[0-9]+)?'
)
-class SuseChangelogURLHandler(URLHandler):
+class SuseTrackersURLHandler(URLHandler):
capabilities = ['url_handler']
+ handler_name = 'suse_rpm_trackers'
match = r'\b'+_MATCH+r'\b'
def callback(self, ref):
fields = re.match(_MATCH, ref).groupdict()
- template = _TRACKERS[fields['tracker']]
+ template = _TRACKERS[fields['tracker'].lower()]
bug_id = fields['id']
return template.format(bug_id)
@@ -38,6 +40,5 @@ class SuseChangelogURLHandler(URLHandler):
# bsc#N
# bug#N
# commit#X
-# [Ff]ate#N
# glgo#GNOME/GTK#N
# kde#N