summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorBen Hutchings <ben@decadent.org.uk>2019-03-28 01:47:36 +0000
committerBen Hutchings <ben@decadent.org.uk>2019-03-28 01:47:36 +0000
commit3199b6545c57d2f98539343780fbabaf4b9ac233 (patch)
tree970ada19f66683947c94abcc1483432ddba49f3d /scripts
parent277a09cc62c16bddb322f80b764b93b35d734ac3 (diff)
Convert filter-active.py to Python 3
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/filter-active.py35
1 files changed, 20 insertions, 15 deletions
diff --git a/scripts/filter-active.py b/scripts/filter-active.py
index 885ae7b2..afe583af 100755
--- a/scripts/filter-active.py
+++ b/scripts/filter-active.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
import os, re, sys, curses
from optparse import OptionParser
@@ -18,7 +18,7 @@ class issue(deb822.Deb822):
self.name = os.path.basename(path)
def status(self, release):
- if self.d.has_key(release):
+ if release in self.d:
return self.d[release]
else:
return ""
@@ -90,6 +90,11 @@ def filter_out_states(issues, inc_releases, exc_releases, states, notstates):
return filteredissues
+
+def tparm_unicode(*args):
+ return curses.tparm(*args).decode('ascii')
+
+
if __name__ == '__main__':
parser = OptionParser()
parser.add_option("-d", "--dirs", action="append")
@@ -114,7 +119,7 @@ if __name__ == '__main__':
else:
print('I: Excluding EOL releases')
inc_releases = None
- with file('eol_releases') as eol_file:
+ with open('eol_releases') as eol_file:
exc_releases = set(line.strip()
for line in eol_file
if not line.startswith('#'))
@@ -122,17 +127,17 @@ if __name__ == '__main__':
options.color = sys.stdout.isatty()
if options.color:
curses.setupterm()
- status_color = {"needed": curses.tparm(curses.tigetstr("setaf"),
- curses.COLOR_RED),
- "ignored": curses.tparm(curses.tigetstr("setaf"),
- curses.COLOR_YELLOW),
- "pending": curses.tparm(curses.tigetstr("setaf"),
- curses.COLOR_MAGENTA),
- "released": curses.tparm(curses.tigetstr("setaf"),
- curses.COLOR_GREEN),
- "N/A": curses.tparm(curses.tigetstr("setaf"),
- curses.COLOR_GREEN)}
- color_off = curses.tparm(curses.tigetstr("op"))
+ status_color = {"needed": tparm_unicode(curses.tigetstr("setaf"),
+ curses.COLOR_RED),
+ "ignored": tparm_unicode(curses.tigetstr("setaf"),
+ curses.COLOR_YELLOW),
+ "pending": tparm_unicode(curses.tigetstr("setaf"),
+ curses.COLOR_MAGENTA),
+ "released": tparm_unicode(curses.tigetstr("setaf"),
+ curses.COLOR_GREEN),
+ "N/A": tparm_unicode(curses.tigetstr("setaf"),
+ curses.COLOR_GREEN)}
+ color_off = tparm_unicode(curses.tigetstr("op"))
else:
color_off = ''
@@ -168,7 +173,7 @@ if __name__ == '__main__':
for release in list_releases:
status = i.status(release) or "unknown"
status_short = status.split(' ')[0]
- if options.color and status_color.has_key(status_short):
+ if options.color and status_short in status_color:
color_on = status_color[status_short]
else:
color_on = ''

© 2014-2024 Faster IT GmbH | imprint | privacy policy