[Python-checkins] python/nondist/sandbox/setuptools pkg_resources.py, 1.41, 1.42 setuptools.txt, 1.14, 1.15

pje@users.sourceforge.net pje at users.sourceforge.net
Sat Jul 16 19:25:38 CEST 2005


Update of /cvsroot/python/python/nondist/sandbox/setuptools
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32676

Modified Files:
	pkg_resources.py setuptools.txt 
Log Message:
Fixed some problems using ``pkg_resources`` w/PEP 302 loaders other than
``zipimport``.  Fixed ``pkg_resources.resource_exists()`` not working
correctly.


Index: pkg_resources.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/pkg_resources.py,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- pkg_resources.py	15 Jul 2005 04:11:37 -0000	1.41
+++ pkg_resources.py	16 Jul 2005 17:25:35 -0000	1.42
@@ -377,7 +377,7 @@
 
     def resource_exists(self, package_name, resource_name):
         """Does the named resource exist in the named package?"""
-        return get_provider(package_name).has_resource(self, resource_name)
+        return get_provider(package_name).has_resource(resource_name)
 
     def resource_isdir(self, package_name, resource_name):
         """Does the named resource exist in the named package?"""
@@ -587,7 +587,7 @@
         return self._fn(self.module_path, resource_name)
 
     def get_resource_stream(self, manager, resource_name):
-        return open(self._fn(self.module_path, resource_name), 'rb')
+        return StringIO(self.get_resource_string(manager, resource_name))
 
     def get_resource_string(self, manager, resource_name):
         return self._get(self._fn(self.module_path, resource_name))
@@ -667,34 +667,6 @@
 register_loader_type(object, NullProvider)
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 class DefaultProvider(NullProvider):
     """Provides access to package resources in the filesystem"""
 
@@ -721,12 +693,17 @@
     def _has(self, path):
         return os.path.exists(path)
 
+
+
     def _isdir(self,path):
         return os.path.isdir(path)
 
     def _listdir(self,path):
         return os.listdir(path)
 
+    def get_resource_stream(self, manager, resource_name):
+        return open(self._fn(self.module_path, resource_name), 'rb')
+
     def _get(self, path):
         stream = open(path, 'rb')
         try:
@@ -736,6 +713,29 @@
 
 register_loader_type(type(None), DefaultProvider)
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 class ZipProvider(DefaultProvider):
     """Resource support for zips and eggs"""
 

Index: setuptools.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools.txt,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- setuptools.txt	16 Jul 2005 16:17:29 -0000	1.14
+++ setuptools.txt	16 Jul 2005 17:25:35 -0000	1.15
@@ -1332,6 +1332,16 @@
 Release Notes/Change History
 ----------------------------
 
+0.6a1
+ * Fixed the ``--tag-svn-revision`` option of ``egg_info`` not finding the
+   latest revision number; it was using the revision number of the directory
+   containing ``setup.py``, not the highest revision number in the project.
+   
+ * Fixed some problems using ``pkg_resources`` w/PEP 302 loaders other than
+   ``zipimport``.
+   
+ * Fixed ``pkg_resources.resource_exists()`` not working correctly.
+
 0.5a13
  * Fixed a bug in resource extraction from nested packages in a zipped egg.
 



More information about the Python-checkins mailing list