Commit 6c25a62d authored by PJ Eby's avatar PJ Eby

Fix more zipped-egg directory resource bugs reported by Ryan Tomayko.

--HG--
branch : setuptools
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4041063
parent a085f661
......@@ -738,7 +738,7 @@ class ZipProvider(DefaultProvider):
def _extract_resource(self, manager, resource_name):
if self.resource_isdir(resource_name):
return self._extract_directory(resource_name)
return self._extract_directory(manager, resource_name)
parts = resource_name.split('/')
zip_path = os.path.join(self.module_path, *parts)
......@@ -801,23 +801,23 @@ class ZipProvider(DefaultProvider):
return self._short_name(path) in self.zipinfo or self._isdir(path)
def _isdir(self,path):
path = self._short_name(path).replace(os.sep, '/')
if path.endswith('/'): path = path[:-1]
return path in self._index()
return self._dir_name(path) in self._index()
def _listdir(self,path):
path = self._short_name(path).replace(os.sep, '/')
return list(self._index().get(self._dir_name(path), ()))
def _dir_name(self,path):
if path.startswith(self.module_path+os.sep):
path = path[len(self.module_path+os.sep):]
path = path.replace(os.sep,'/')
if path.endswith('/'): path = path[:-1]
return list(self._index().get(path, ()))
return path
_get = NullProvider._get
register_loader_type(zipimport.zipimporter, ZipProvider)
class PathMetadata(DefaultProvider):
"""Metadata provider for egg directories
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment