diff options
| author | PJ Eby <distutils-sig@python.org> | 2005-07-16 17:25:35 +0000 |
|---|---|---|
| committer | PJ Eby <distutils-sig@python.org> | 2005-07-16 17:25:35 +0000 |
| commit | 8fffda12af6b5121972e94016e5b1168814e77e5 (patch) | |
| tree | 998e7bbb1edbec47b82d7a6739356265471d5c3f | |
| parent | 811182ed59bb1b233e2c4589ce15133bd5dad4e5 (diff) | |
| download | python-setuptools-git-8fffda12af6b5121972e94016e5b1168814e77e5.tar.gz | |
Fixed some problems using ``pkg_resources`` w/PEP 302 loaders other than
``zipimport``. Fixed ``pkg_resources.resource_exists()`` not working
correctly.
--HG--
branch : setuptools
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4041130
| -rw-r--r-- | pkg_resources.py | 60 | ||||
| -rwxr-xr-x | setuptools.txt | 10 |
2 files changed, 40 insertions, 30 deletions
diff --git a/pkg_resources.py b/pkg_resources.py index 8d45bbd1..c81db3d1 100644 --- a/pkg_resources.py +++ b/pkg_resources.py @@ -377,7 +377,7 @@ class ResourceManager: 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 @@ class NullProvider: 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 @@ class NullProvider: register_loader_type(object, NullProvider) - - - - - - - - - - - - - - - - - - - - - - - - - - - - class DefaultProvider(NullProvider): """Provides access to package resources in the filesystem""" @@ -721,12 +693,17 @@ class DefaultProvider(NullProvider): 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 @@ class DefaultProvider(NullProvider): register_loader_type(type(None), DefaultProvider) + + + + + + + + + + + + + + + + + + + + + + + class ZipProvider(DefaultProvider): """Resource support for zips and eggs""" diff --git a/setuptools.txt b/setuptools.txt index 8e364bf6..96091864 100755 --- a/setuptools.txt +++ b/setuptools.txt @@ -1332,6 +1332,16 @@ XXX 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. |
