summaryrefslogtreecommitdiff
path: root/pkg_resources/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'pkg_resources/__init__.py')
-rw-r--r--pkg_resources/__init__.py24
1 files changed, 2 insertions, 22 deletions
diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py
index 92503288..d8000b00 100644
--- a/pkg_resources/__init__.py
+++ b/pkg_resources/__init__.py
@@ -1611,7 +1611,7 @@ class ZipManifests(dict):
Use a platform-specific path separator (os.sep) for the path keys
for compatibility with pypy on Windows.
"""
- with ContextualZipFile(path) as zfile:
+ with zipfile.ZipFile(path) as zfile:
items = (
(
name.replace('/', os.sep),
@@ -1644,26 +1644,6 @@ class MemoizedZipManifests(ZipManifests):
return self[path].manifest
-class ContextualZipFile(zipfile.ZipFile):
- """
- Supplement ZipFile class to support context manager for Python 2.6
- """
-
- def __enter__(self):
- return self
-
- def __exit__(self, type, value, traceback):
- self.close()
-
- def __new__(cls, *args, **kwargs):
- """
- Construct a ZipFile or ContextualZipFile as appropriate
- """
- if hasattr(zipfile.ZipFile, '__exit__'):
- return zipfile.ZipFile(*args, **kwargs)
- return super(ContextualZipFile, cls).__new__(cls)
-
-
class ZipProvider(EggProvider):
"""Resource support for zips and eggs"""
@@ -1861,7 +1841,7 @@ class FileMetadata(EmptyProvider):
return metadata
def _warn_on_replacement(self, metadata):
- # Python 2.6 and 3.2 compat for: replacement_char = '�'
+ # Python 2.7 compat for: replacement_char = '�'
replacement_char = b'\xef\xbf\xbd'.decode('utf-8')
if replacement_char in metadata:
tmpl = "{self.path} could not be properly decoded in UTF-8"