summaryrefslogtreecommitdiff
path: root/morphlib/plugins
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-10-12 14:33:30 +0100
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-10-12 17:01:54 +0100
commitd0111fbd2de1d046b14046f2cb0ded14d058cfdd (patch)
tree2e531268b9b9aee9ea6a5ecfd5efeb5fe6b4bf0b /morphlib/plugins
parente3aa8ba25847397a03a665492a0cbe4541814246 (diff)
downloadmorph-d0111fbd2de1d046b14046f2cb0ded14d058cfdd.tar.gz
Fix use of GzipFile to not assume "with" protocol
This fixes a bunch of tests so they pass on squeeze, which has a version of Python whose GzipFile doesn't support the "with" protocol.
Diffstat (limited to 'morphlib/plugins')
-rw-r--r--morphlib/plugins/trebuchet_plugin.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/morphlib/plugins/trebuchet_plugin.py b/morphlib/plugins/trebuchet_plugin.py
index 1c44bf29..4fa25e91 100644
--- a/morphlib/plugins/trebuchet_plugin.py
+++ b/morphlib/plugins/trebuchet_plugin.py
@@ -40,8 +40,9 @@ class MountableImage(object):
try:
with os.fdopen(tempfd, "wb") as outfh:
- with gzip.open(path, "rb") as infh:
- morphlib.util.copyfileobj(infh, outfh)
+ infh = gzip.open(path, "rb")
+ morphlib.util.copyfileobj(infh, outfh)
+ infh.close()
except:
os.unlink(self.temp_path)
raise