[Python-checkins] python/nondist/sandbox/setuptools pkg_resources.py, 1.19, 1.20

pje@users.sourceforge.net pje at users.sourceforge.net
Wed May 25 05:22:34 CEST 2005


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

Modified Files:
	pkg_resources.py 
Log Message:
Fix some typos and a missing import


Index: pkg_resources.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/pkg_resources.py,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- pkg_resources.py	25 May 2005 03:06:53 -0000	1.19
+++ pkg_resources.py	25 May 2005 03:22:32 -0000	1.20
@@ -24,7 +24,7 @@
     'split_sections', # 'glob_resources'
 ]
 
-import sys, os, zipimport, time, re
+import sys, os, zipimport, time, re, imp
 from sets import ImmutableSet
 
 class ResolutionError(Exception):
@@ -842,6 +842,8 @@
 def _handle_ns(packageName, path_item):
     """Ensure that named package includes a subpath of path_item (if needed)"""
     importer = get_importer(path_item)
+    if importer is None:
+        return None
     loader = importer.find_module(packageName)
     if loader is None:
         return None
@@ -850,12 +852,10 @@
     if not hasattr(module,'__path__'):
         raise TypeError("Not a package:", packageName)
 
-    handler = _find_adapter(_distribution_finders, importer)
+    handler = _find_adapter(_namespace_handlers, importer)
     subpath = handler(importer,path_item,packageName,module)
-
     if subpath is not None:
         module.__path__.append(subpath)
-
     return subpath
 
 
@@ -876,12 +876,12 @@
                 path = sys.modules[parent].__path__
             except AttributeError:
                 raise TypeError("Not a package:", parent)
-    
+
         for path_item in path:
             # Ensure all the parent's path items are reflected in the child,
             # if they apply
             _handle_ns(packageName, path_item)
-    
+
         # Track what packages are namespaces, so when new path items are added,
         # they can be updated
         _namespace_packages.setdefault(parent,[]).append(packageName)
@@ -916,10 +916,10 @@
 register_namespace_handler(zipimport.zipimporter,file_ns_handler)
 
 
+def null_ns_handler(importer, path_item, packageName, module):
+    return None
 
-
-
-
+register_namespace_handler(object,null_ns_handler)
 
 
 



More information about the Python-checkins mailing list