* grab-attachments, setup.py: added grab-attachments tool. You give it bug

numbers, it gets you their attachments. Useful for sponsoring.
This commit is contained in:
Daniel Holbach 2008-03-10 11:36:17 +01:00
parent 2e08014414
commit 6026f45410
3 changed files with 46 additions and 1 deletions

7
debian/changelog vendored
View File

@ -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 <daniel.holbach@ubuntu.com> Mon, 10 Mar 2008 11:31:50 +0100
ubuntu-dev-tools (0.28) hardy; urgency=low ubuntu-dev-tools (0.28) hardy; urgency=low
[ Adrien Cunin ] [ Adrien Cunin ]

37
grab-attachments Executable file
View File

@ -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 <bug numbers>"
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()

View File

@ -30,7 +30,8 @@ setup(name='ubuntu-dev-tools',
'massfile', 'massfile',
'submittodebian', 'submittodebian',
'get-build-deps', 'get-build-deps',
'dgetlp' 'dgetlp',
'grab-attachments'
], ],
packages=['ubuntutools'], packages=['ubuntutools'],
) )