mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-10 06:46:15 +01:00
- added missing close() to streamfile() (TODO: is this really needed?)
- get_source_file: use streamfile() retrieve the data
This commit is contained in:
parent
8282e232d8
commit
f4fd8ac0fe
11
osc/core.py
11
osc/core.py
@ -2067,17 +2067,11 @@ 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)
|
||||
# print 'url: %s' % u
|
||||
f = http_GET(u)
|
||||
|
||||
o = open(targetfilename or filename, 'w')
|
||||
while 1:
|
||||
buf = f.read(BUFSIZE)
|
||||
if not buf: break
|
||||
u = makeurl(apiurl, ['source', prj, package, pathname2url(filename)], query=query)
|
||||
for buf in streamfile(u, http_GET, BUFSIZE):
|
||||
o.write(buf)
|
||||
o.close()
|
||||
f.close()
|
||||
|
||||
|
||||
def get_binary_file(apiurl, prj, repo, arch,
|
||||
@ -2802,6 +2796,7 @@ def streamfile(url, http_meth = http_GET, bufsize=8192):
|
||||
while len(data):
|
||||
yield data
|
||||
data = f.read(bufsize)
|
||||
f.close()
|
||||
|
||||
|
||||
def print_buildlog(apiurl, prj, package, platform, arch, offset = 0):
|
||||
|
Loading…
Reference in New Issue
Block a user