diff options
| author | PJ Eby <distutils-sig@python.org> | 2005-07-12 05:31:36 +0000 |
|---|---|---|
| committer | PJ Eby <distutils-sig@python.org> | 2005-07-12 05:31:36 +0000 |
| commit | 3efcdec07fa19acd77cb3a5a38ef5052b509681a (patch) | |
| tree | d506ac75836fa123fb75b5c1a91cf3fb2bac0382 /pkg_resources.py | |
| parent | cd6fbcf869468bc61cc071b2751d858054ce8549 (diff) | |
| download | python-setuptools-git-3efcdec07fa19acd77cb3a5a38ef5052b509681a.tar.gz | |
Fix bugs and implement features reported/requested by folks on the
Distutils-SIG.
--HG--
branch : setuptools
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4041117
Diffstat (limited to 'pkg_resources.py')
| -rw-r--r-- | pkg_resources.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/pkg_resources.py b/pkg_resources.py index 583a5c84..a16b67b4 100644 --- a/pkg_resources.py +++ b/pkg_resources.py @@ -69,17 +69,17 @@ def register_loader_type(loader_type, provider_factory): def get_provider(moduleName): """Return an IResourceProvider for the named module""" - module = sys.modules[moduleName] + try: + module = sys.modules[moduleName] + except KeyError: + __import__(moduleName) + module = sys.modules[moduleName] loader = getattr(module, '__loader__', None) return _find_adapter(_provider_factories, loader)(module) - - - - def get_platform(): """Return this platform's string for platform-specific distributions @@ -984,6 +984,7 @@ def StringIO(*args, **kw): def find_nothing(importer,path_item): return () + register_finder(object,find_nothing) def find_on_path(importer,path_item): @@ -1004,7 +1005,7 @@ def find_on_path(importer,path_item): fullpath = os.path.join(path_item, entry) lower = entry.lower() if lower.endswith('.egg'): - for dist in find_on_path(importer,fullpath): + for dist in find_distributions(fullpath): yield dist elif lower.endswith('.egg-info'): if os.path.isdir(fullpath): @@ -1017,12 +1018,11 @@ def find_on_path(importer,path_item): if not line.strip(): continue for item in find_distributions(line.rstrip()): yield item - elif path_item.lower().endswith('.egg'): # packed egg - metadata = EggMetadata(zipimport.zipimporter(path_item)) - yield Distribution.from_filename(path_item, metadata=metadata) register_finder(ImpWrapper,find_on_path) + + _namespace_handlers = {} _namespace_packages = {} |
