At 09:43 AM 6/14/2005 -0400, Ryan Tomayko wrote:
>It also seems to be used to figure out key names in the zip index and
>this seems to be the problem.

Actually, the problem is more subtle than that, but basically the 
same.  The right solution is not to change zip_pre, but rather to have the 
directory operations trim a different prefix.  Here's a trial change:

     def _isdir(self,path):
         return self._dir_name(path) in self._index()

     def _listdir(self,path):
         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 path

Replace these functions in ZipProvider, and then make the start of 
extract_resource look like this:

     def _extract_resource(self, manager, resource_name):
         if self.resource_isdir(resource_name):
             return self._extract_directory(manager, resource_name)

And you should get working code (works for me, IOW).  These fixes will go 
out in 0.4a4; thanks for all your help in testing.

_______________________________________________
Distutils-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to