mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-13 08:01:09 +00:00
Port hugadaylist to Python 3
This commit is contained in:
parent
3052bfcc16
commit
118f95b62e
31
hugdaylist
31
hugdaylist
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# Copyright (C) 2007 Canonical Ltd., Daniel Holbach
|
# Copyright (C) 2007 Canonical Ltd., Daniel Holbach
|
||||||
@ -57,8 +57,8 @@ def check_args():
|
|||||||
|
|
||||||
# Check that we have an URL.
|
# Check that we have an URL.
|
||||||
if not args:
|
if not args:
|
||||||
print >> sys.stderr, "An URL pointing to a Launchpad bug list is " \
|
print("An URL pointing to a Launchpad bug list is required.",
|
||||||
"required."
|
file=sys.stderr)
|
||||||
opt_parser.print_help()
|
opt_parser.print_help()
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
@ -87,24 +87,25 @@ def main():
|
|||||||
if len(url.split("?", 1)) == 2:
|
if len(url.split("?", 1)) == 2:
|
||||||
# search options not supported, because there is no mapping web ui
|
# search options not supported, because there is no mapping web ui
|
||||||
# options <-> API options
|
# options <-> API options
|
||||||
print >> sys.stderr, "Options in url are not supported, url: %s" % url
|
print("Options in url are not supported, url: %s" % url,
|
||||||
|
file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
launchpad = None
|
launchpad = None
|
||||||
try:
|
try:
|
||||||
launchpad = Launchpad.login_with("ubuntu-dev-tools", 'production')
|
launchpad = Launchpad.login_with("ubuntu-dev-tools", 'production')
|
||||||
except IOError, error:
|
except IOError as error:
|
||||||
print error
|
print(error)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
api_url = translate_web_api(url, launchpad)
|
api_url = translate_web_api(url, launchpad)
|
||||||
try:
|
try:
|
||||||
product = launchpad.load(api_url)
|
product = launchpad.load(api_url)
|
||||||
except Exception, error:
|
except Exception as error:
|
||||||
response = getattr(error, "response", {})
|
response = getattr(error, "response", {})
|
||||||
if response.get("status", None) == "404":
|
if response.get("status", None) == "404":
|
||||||
print >> sys.stderr, ("The URL at '%s' does not appear to be a "
|
print(("The URL at '%s' does not appear to be a valid url to a "
|
||||||
"valid url to a product") % url
|
"product") % url, file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
@ -112,28 +113,28 @@ def main():
|
|||||||
bug_list = [b for b in product.searchTasks() if filter_unsolved(b)]
|
bug_list = [b for b in product.searchTasks() if filter_unsolved(b)]
|
||||||
|
|
||||||
if not bug_list:
|
if not bug_list:
|
||||||
print "Bug list of %s is empty." % url
|
print("Bug list of %s is empty." % url)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
if howmany == -1:
|
if howmany == -1:
|
||||||
howmany = len(bug_list)
|
howmany = len(bug_list)
|
||||||
|
|
||||||
print """
|
print("""
|
||||||
## ||<rowbgcolor="#CCFFCC"> This task is done || somebody || ||
|
## ||<rowbgcolor="#CCFFCC"> This task is done || somebody || ||
|
||||||
## ||<rowbgcolor="#FFFFCC"> This task is assigned || somebody || <status> ||
|
## ||<rowbgcolor="#FFFFCC"> This task is assigned || somebody || <status> ||
|
||||||
## ||<rowbgcolor="#FFEBBB"> This task isn't || ... || ||
|
## ||<rowbgcolor="#FFEBBB"> This task isn't || ... || ||
|
||||||
## ||<rowbgcolor="#FFCCCC"> This task is blocked on something || somebody || <explanation> ||
|
## ||<rowbgcolor="#FFCCCC"> This task is blocked on something || somebody || <explanation> ||
|
||||||
|
|
||||||
|| Bug || Subject || Triager ||"""
|
|| Bug || Subject || Triager ||""")
|
||||||
|
|
||||||
for i in list(bug_list)[:howmany]:
|
for i in list(bug_list)[:howmany]:
|
||||||
bug = i.bug
|
bug = i.bug
|
||||||
print '||<rowbgcolor="#FFEBBB"> [%s %s] || %s || ||' % \
|
print('||<rowbgcolor="#FFEBBB"> [%s %s] || %s || ||'
|
||||||
(bug.web_link, bug.id, bug.title)
|
% (bug.web_link, bug.id, bug.title))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
try:
|
try:
|
||||||
main()
|
main()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print >> sys.stderr, "Aborted."
|
print("Aborted.", file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
2
setup.py
2
setup.py
@ -24,6 +24,7 @@ if sys.version_info[0] >= 3:
|
|||||||
'dch-repeat',
|
'dch-repeat',
|
||||||
'grab-merge',
|
'grab-merge',
|
||||||
'grep-merges',
|
'grep-merges',
|
||||||
|
'hugdaylist',
|
||||||
'mk-sbuild',
|
'mk-sbuild',
|
||||||
'pbuilder-dist-simple',
|
'pbuilder-dist-simple',
|
||||||
'pull-debian-source',
|
'pull-debian-source',
|
||||||
@ -39,7 +40,6 @@ if sys.version_info[0] >= 3:
|
|||||||
]
|
]
|
||||||
else:
|
else:
|
||||||
scripts = [
|
scripts = [
|
||||||
'hugdaylist',
|
|
||||||
'import-bug-from-debian',
|
'import-bug-from-debian',
|
||||||
'merge-changelog',
|
'merge-changelog',
|
||||||
'pbuilder-dist',
|
'pbuilder-dist',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user