diff --git a/installsystems/image.py b/installsystems/image.py index fbef6318c4efa53c9ca66a4fd605da6ea5097e36..8fb8d3921ef0a3fc9416eaa8658b1cf5876cc7a6 100644 --- a/installsystems/image.py +++ b/installsystems/image.py @@ -415,7 +415,7 @@ class PackageImage(Image): else: fileobj = PipeFile(mode="r", fileobj=fileobj) memfile = cStringIO.StringIO() - shutil.copyfileobj(fileobj, memfile) + fileobj.consume(memfile) # close source fileobj.close() # get donwloaded size and md5 @@ -558,7 +558,7 @@ class PackageImage(Image): raise Exception("Downloading image %s failed: Invalid announced size" % self.name) # open destination fd = open(self.filename, "wb") - shutil.copyfileobj(fs, fd) + fs.consume(fd) fs.close() fd.close() if self.size != fs.consumed_size: @@ -798,7 +798,7 @@ class Payload(object): if fs.size is not None and self.size != fs.size: raise Exception("Downloading payload %s failed: Invalid announced size" % self.name) fd = open(dest, "wb") - shutil.copyfileobj(fs, fd) + fs.consume(fd) # closing fo fs.close() fd.close() diff --git a/installsystems/repository.py b/installsystems/repository.py index bcf7d295c46bad81d2f7fb501e9f71d134c5b6d6..8c02c2d9866def1f412e2e023a40b28c8f7869e6 100644 --- a/installsystems/repository.py +++ b/installsystems/repository.py @@ -391,7 +391,7 @@ class Repository(object): memfile = cStringIO.StringIO() try: fo = PipeFile(path, "r") - shutil.copyfileobj(fo, memfile) + fo.consume(memfile) fo.close() except Exception as e: raise Exception("Loading image %s v%s failed: %s" % (name, version, e))