1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-26 22:56:15 +01:00

- store tmpfiles in the default tmpdir

- minor cleanup
This commit is contained in:
Marcus Huewe 2010-04-30 15:14:00 +02:00
parent d02655b026
commit 6a83f2e3f0

View File

@ -2766,12 +2766,9 @@ def download(url, filename, progress_obj = None):
import tempfile, shutil
o = None
try:
if filename[0] != '/':
prefix = os.getcwd() + '/' + filename
else:
prefix = filename
(fd, tmpfile) = tempfile.mkstemp(prefix = prefix, suffix = '.osc')
os.chmod(tmpfile, 0644)
prefix = os.path.basename(filename)
(fd, tmpfile) = tempfile.mkstemp(prefix = prefix, suffix = '.osc')
os.chmod(tmpfile, 0644)
try:
o = os.fdopen(fd, 'wb')
for buf in streamfile(url, http_GET, BUFSIZE, progress_obj=progress_obj):
@ -2791,7 +2788,7 @@ def get_source_file(apiurl, prj, package, filename, targetfilename=None, revisio
if revision:
query = { 'rev': revision }
u = makeurl(apiurl, ['source', prj, package, pathname2url(filename)], query=query)
return download(u, targetfilename, progress_obj)
download(u, targetfilename, progress_obj)
def get_binary_file(apiurl, prj, repo, arch,
filename,
@ -2808,7 +2805,7 @@ def get_binary_file(apiurl, prj, repo, arch,
where = package or '_repository'
u = makeurl(apiurl, ['build', prj, repo, arch, where, filename])
return download(u, target_filename, progress_obj)
download(u, target_filename, progress_obj)
def dgst_from_string(str):
# Python 2.5 depracates the md5 modules