mirror of
https://github.com/openSUSE/osc.git
synced 2025-02-05 02:56:17 +01:00
- store tmpfiles in the default tmpdir
- minor cleanup
This commit is contained in:
parent
d02655b026
commit
6a83f2e3f0
13
osc/core.py
13
osc/core.py
@ -2766,12 +2766,9 @@ def download(url, filename, progress_obj = None):
|
|||||||
import tempfile, shutil
|
import tempfile, shutil
|
||||||
o = None
|
o = None
|
||||||
try:
|
try:
|
||||||
if filename[0] != '/':
|
prefix = os.path.basename(filename)
|
||||||
prefix = os.getcwd() + '/' + filename
|
(fd, tmpfile) = tempfile.mkstemp(prefix = prefix, suffix = '.osc')
|
||||||
else:
|
os.chmod(tmpfile, 0644)
|
||||||
prefix = filename
|
|
||||||
(fd, tmpfile) = tempfile.mkstemp(prefix = prefix, suffix = '.osc')
|
|
||||||
os.chmod(tmpfile, 0644)
|
|
||||||
try:
|
try:
|
||||||
o = os.fdopen(fd, 'wb')
|
o = os.fdopen(fd, 'wb')
|
||||||
for buf in streamfile(url, http_GET, BUFSIZE, progress_obj=progress_obj):
|
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:
|
if revision:
|
||||||
query = { 'rev': revision }
|
query = { 'rev': revision }
|
||||||
u = makeurl(apiurl, ['source', prj, package, pathname2url(filename)], query=query)
|
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,
|
def get_binary_file(apiurl, prj, repo, arch,
|
||||||
filename,
|
filename,
|
||||||
@ -2808,7 +2805,7 @@ def get_binary_file(apiurl, prj, repo, arch,
|
|||||||
|
|
||||||
where = package or '_repository'
|
where = package or '_repository'
|
||||||
u = makeurl(apiurl, ['build', prj, repo, arch, where, filename])
|
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):
|
def dgst_from_string(str):
|
||||||
# Python 2.5 depracates the md5 modules
|
# Python 2.5 depracates the md5 modules
|
||||||
|
Loading…
Reference in New Issue
Block a user