From 6026f454109cf49b4d3ab6b6a7da779fe95e1e30 Mon Sep 17 00:00:00 2001 From: Daniel Holbach Date: Mon, 10 Mar 2008 11:36:17 +0100 Subject: [PATCH] * grab-attachments, setup.py: added grab-attachments tool. You give it bug numbers, it gets you their attachments. Useful for sponsoring. --- debian/changelog | 7 +++++++ grab-attachments | 37 +++++++++++++++++++++++++++++++++++++ setup.py | 3 ++- 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100755 grab-attachments diff --git a/debian/changelog b/debian/changelog index 5bbf502..81db3f3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +ubuntu-dev-tools (0.29) hardy; urgency=low + + * grab-attachments, setup.py: added grab-attachments tool. You give it bug + numbers, it gets you their attachments. Useful for sponsoring. + + -- Daniel Holbach Mon, 10 Mar 2008 11:31:50 +0100 + ubuntu-dev-tools (0.28) hardy; urgency=low [ Adrien Cunin ] diff --git a/grab-attachments b/grab-attachments new file mode 100755 index 0000000..dbda6f2 --- /dev/null +++ b/grab-attachments @@ -0,0 +1,37 @@ +#!/usr/bin/python +# +# Copyright 2007, Canonical, Daniel Holbach +# +# GPL 3 +# + +import os +import sys +import urllib +import launchpadbugs.connector as Connector + +USAGE = "grab-attachments " + +def main(): + if len(sys.argv) == 1: + print >> sys.stderr, USAGE + sys.exit(1) + + if sys.argv[1] in ["--help", "-h"]: + print USAGE + sys.exit(0) + Bug = Connector.ConnectBug(method="Text") + for arg in sys.argv[1:]: + try: + number = int(arg) + except: + print >> sys.stderr, "'%s' is not a valid bug number." % arg + sys.exit(1) + b = Bug(number) + for a in b.attachments: + filename = os.path.join(os.getcwd(), a.url.split("/")[-1]) + urllib.urlretrieve(a.url, filename) + +if __name__ == '__main__': + main() + diff --git a/setup.py b/setup.py index 2a7bd96..82a952c 100755 --- a/setup.py +++ b/setup.py @@ -30,7 +30,8 @@ setup(name='ubuntu-dev-tools', 'massfile', 'submittodebian', 'get-build-deps', - 'dgetlp' + 'dgetlp', + 'grab-attachments' ], packages=['ubuntutools'], )