diff options
author | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2012-10-12 14:33:30 +0100 |
---|---|---|
committer | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2012-10-12 17:01:54 +0100 |
commit | d0111fbd2de1d046b14046f2cb0ded14d058cfdd (patch) | |
tree | 2e531268b9b9aee9ea6a5ecfd5efeb5fe6b4bf0b /morphlib/plugins | |
parent | e3aa8ba25847397a03a665492a0cbe4541814246 (diff) | |
download | morph-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.py | 5 |
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 |