mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-13 08:01:09 +00:00
grab-attachments: download the attachments to a folder named after the bug
number e.g. bug-1
This commit is contained in:
commit
344cf5b718
4
debian/changelog
vendored
4
debian/changelog
vendored
@ -7,6 +7,10 @@ ubuntu-dev-tools (0.122) UNRELEASED; urgency=low
|
|||||||
[ Benjamin Drung ]
|
[ Benjamin Drung ]
|
||||||
* data/ubuntu.csv: Update end-of-life dates.
|
* data/ubuntu.csv: Update end-of-life dates.
|
||||||
|
|
||||||
|
[ Brian Murray ]
|
||||||
|
* grab-attachments: download the attachments to a folder named after the bug
|
||||||
|
number e.g. bug-1
|
||||||
|
|
||||||
-- Benjamin Drung <bdrung@debian.org> Wed, 20 Apr 2011 00:25:03 +0200
|
-- Benjamin Drung <bdrung@debian.org> Wed, 20 Apr 2011 00:25:03 +0200
|
||||||
|
|
||||||
ubuntu-dev-tools (0.121) unstable; urgency=low
|
ubuntu-dev-tools (0.121) unstable; urgency=low
|
||||||
|
@ -7,7 +7,7 @@ grab\-attachments \- downloads attachments from a Launchpad bug
|
|||||||
.B grab\-attachments \-h
|
.B grab\-attachments \-h
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
\fBgrab\-attachments\fR is a script to download all attachments from a
|
\fBgrab\-attachments\fR is a script to download all attachments from a
|
||||||
Launchpad bug report into the current directory.
|
Launchpad bug report into the a directory named after the bug e.g. bug-1.
|
||||||
|
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
Listed below are the command line options for grab\-attachments:
|
Listed below are the command line options for grab\-attachments:
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
# ##################################################################
|
# ##################################################################
|
||||||
|
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
import errno
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@ -56,9 +57,18 @@ def main():
|
|||||||
|
|
||||||
bug = launchpad.bugs[number]
|
bug = launchpad.bugs[number]
|
||||||
|
|
||||||
|
bug_folder_name = 'bug-%s' % number
|
||||||
|
|
||||||
|
try:
|
||||||
|
os.mkdir(bug_folder_name)
|
||||||
|
except OSError, error:
|
||||||
|
if error.errno == errno.EEXIST:
|
||||||
|
continue
|
||||||
|
|
||||||
for attachment in bug.attachments:
|
for attachment in bug.attachments:
|
||||||
f = attachment.data.open()
|
f = attachment.data.open()
|
||||||
filename = os.path.join(os.getcwd(), f.filename)
|
filename = os.path.join(os.getcwd(), bug_folder_name,
|
||||||
|
f.filename)
|
||||||
local_file = open(filename, "w")
|
local_file = open(filename, "w")
|
||||||
local_file.write(f.read())
|
local_file.write(f.read())
|
||||||
f.close()
|
f.close()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user