Commits

Daniel Holth  committed b6d824b

skip zip verification on Python < 2.7

  • Participants
  • Parent commits 15e99d8

Comments (0)

Files changed (3)

     markerlib
     coverage
     wheel[tool,signatures]
+    distribute>=0.6.28

File wheel/install.py

 # XXX see patched pip to install
 
 import sys
+import warnings
 import os.path
 import re
 import zipfile
         if (name in self._expected_hashes 
             and self._expected_hashes[name] != None):
             expected_hash = self._expected_hashes[name]
-            _update_crc_orig = ef._update_crc
+            try:
+                _update_crc_orig = ef._update_crc
+            except AttributeError:
+                warnings.warn('Need ZipExtFile._update_crc to implement '
+                              'file hash verification (in Python >= 2.7)')
+                return ef
             running_hash = self._hash_algorithm()
             def _update_crc(newdata, eof):
                 _update_crc_orig(newdata, eof)

File wheel/test/test_wheelfile.py

 except ImportError:
     from io import BytesIO as StringIO
 import zipfile
+from nose import SkipTest
 
 def test_verifying_zipfile():
+    if not hasattr(zipfile.ZipExtFile, '_update_crc'):
+        raise SkipTest('No ZIP verification. Missing ZipExtFile._update_crc.')
+    
     sio = StringIO()
     zf = zipfile.ZipFile(sio, 'w')
     zf.writestr("one", b"first file")