1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-09-20 09:16:16 +02:00

- always close the file

This commit is contained in:
Marcus Huewe 2010-02-05 15:17:45 +01:00
parent 8d1c1804bf
commit f1a04bc50d

View File

@ -2706,6 +2706,7 @@ def get_source_file(apiurl, prj, package, filename, targetfilename=None, revisio
if revision:
query = { 'rev': revision }
o = None
try:
try:
(fd, tmpfile) = tempfile.mkstemp(prefix = filename, suffix = '.osc')
o = os.fdopen(fd, 'wb')
@ -2715,11 +2716,11 @@ def get_source_file(apiurl, prj, package, filename, targetfilename=None, revisio
o.close()
shutil.move(tmpfile, targetfilename or filename)
except:
if o is not None:
o.close()
os.unlink(tmpfile)
raise
finally:
if o is not None:
o.close()
def get_binary_file(apiurl, prj, repo, arch,
filename,