diff options
| author | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2018-06-24 12:28:11 +0200 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2018-06-24 12:28:11 +0200 |
| commit | 40f20dde22bf8668b7407ebaf8972138348ca0c8 (patch) | |
| tree | 8b2f627f9c002ded7e9c23e9be983d2b6573894a | |
| parent | 087b357d3b6c479b11bf3fd1d04fc74ffb833a21 (diff) | |
| download | dotfiles-40f20dde22bf8668b7407ebaf8972138348ca0c8.tar.xz | |
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.
| -rw-r--r-- | .config/terminator/plugins/susechangelog.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/.config/terminator/plugins/susechangelog.py b/.config/terminator/plugins/susechangelog.py index 626f483..95fc5ec 100644 --- 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 |
