diff options
| author | Alex Grönholm <alex.gronholm@nextday.fi> | 2018-11-19 01:30:29 +0200 |
|---|---|---|
| committer | Alex Grönholm <alex.gronholm@nextday.fi> | 2018-11-19 01:32:38 +0200 |
| commit | 0ea86b3d4844d5bd039f70f4d7246b9852bc6721 (patch) | |
| tree | 923bfe37201eee00da0afc7cf1a87b3d3a50f534 | |
| parent | f5667b5d9d7346f9ffe32f039df122cdc261ad37 (diff) | |
| download | wheel-git-0ea86b3d4844d5bd039f70f4d7246b9852bc6721.tar.gz | |
Fixed compatibility Python 2.7.3 and older
Apparently ZipFile was and old style class before 2.7.4, so super() will not work there.
Fixes #277.
| -rw-r--r-- | .travis.yml | 4 | ||||
| -rw-r--r-- | docs/news.rst | 4 | ||||
| -rw-r--r-- | wheel/wheelfile.py | 8 |
3 files changed, 12 insertions, 4 deletions
diff --git a/.travis.yml b/.travis.yml index 1edf640..8190b45 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,6 +23,10 @@ jobs: - stage: test env: TOXENV=py27 + python: "2.7.0" + + - stage: test + env: TOXENV=py27 python: "2.7" - stage: test diff --git a/docs/news.rst b/docs/news.rst index 1dee607..9641d10 100644 --- a/docs/news.rst +++ b/docs/news.rst @@ -1,6 +1,10 @@ Release Notes ============= +**UNRELEASED** + +- Fixed compatibility with Python 2.7.0 – 2.7.3 + **0.32.2** - Fixed build number appearing in the ``.dist-info`` directory name diff --git a/wheel/wheelfile.py b/wheel/wheelfile.py index d8234a5..635aa77 100644 --- a/wheel/wheelfile.py +++ b/wheel/wheelfile.py @@ -39,7 +39,7 @@ class WheelFile(ZipFile): if not basename.endswith('.whl') or self.parsed_filename is None: raise WheelError("Bad wheel filename {!r}".format(basename)) - super(WheelFile, self).__init__(file, mode, compression=ZIP_DEFLATED, allowZip64=True) + ZipFile.__init__(self, file, mode, compression=ZIP_DEFLATED, allowZip64=True) self.dist_info_path = '{}.dist-info'.format(self.parsed_filename.group('namever')) self.record_path = self.dist_info_path + '/RECORD' @@ -88,7 +88,7 @@ class WheelFile(ZipFile): if eof and running_hash.digest() != expected_hash: raise WheelError("Hash mismatch for file '{}'".format(native(ef_name))) - ef = super(WheelFile, self).open(name_or_info, mode, pwd) + ef = ZipFile.open(self, name_or_info, mode, pwd) ef_name = as_unicode(name_or_info.filename if isinstance(name_or_info, ZipInfo) else name_or_info) if mode == 'r' and not ef_name.endswith('/'): @@ -136,7 +136,7 @@ class WheelFile(ZipFile): self.writestr(zinfo, data, compress_type) def writestr(self, zinfo_or_arcname, bytes, compress_type=None): - super(WheelFile, self).writestr(zinfo_or_arcname, bytes, compress_type) + ZipFile.writestr(self, zinfo_or_arcname, bytes, compress_type) fname = (zinfo_or_arcname.filename if isinstance(zinfo_or_arcname, ZipInfo) else zinfo_or_arcname) logger.info("adding '%s'", fname) @@ -157,4 +157,4 @@ class WheelFile(ZipFile): zinfo.external_attr = 0o664 << 16 self.writestr(zinfo, as_bytes(content)) - super(WheelFile, self).close() + ZipFile.close(self) |
