[Numpy-svn] r5945 - branches/1.2.x/numpy/lib

numpy-svn@scip... numpy-svn@scip...
Thu Oct 9 16:53:14 CDT 2008


Author: jarrod.millman
Date: 2008-10-09 16:53:12 -0500 (Thu, 09 Oct 2008)
New Revision: 5945

Modified:
   branches/1.2.x/numpy/lib/utils.py
Log:
back ported Pauli Virtanen's fix for py 2.4 compatible lookfor (see r5862)


Modified: branches/1.2.x/numpy/lib/utils.py
===================================================================
--- branches/1.2.x/numpy/lib/utils.py	2008-10-08 13:38:35 UTC (rev 5944)
+++ branches/1.2.x/numpy/lib/utils.py	2008-10-09 21:53:12 UTC (rev 5945)
@@ -1,6 +1,5 @@
 import os
 import sys
-import pkgutil
 import types
 import re
 
@@ -682,15 +681,21 @@
                 _all = item.__all__
             except AttributeError:
                 _all = None
+
             # import sub-packages
             if import_modules and hasattr(item, '__path__'):
-                for m in pkgutil.iter_modules(item.__path__):
-                    if _all is not None and m[1] not in _all:
-                        continue
-                    try:
-                        __import__("%s.%s" % (name, m[1]))
-                    except ImportError:
-                        continue
+                for pth in item.__path__: 
+                    for mod_path in os.listdir(pth): 
+                        init_py = os.path.join(pth, mod_path, '__init__.py') 
+                        if not os.path.isfile(init_py):
+                            continue 
+                        if _all is not None and mod_path not in _all:
+                            continue
+                        try:
+                            __import__("%s.%s" % (name, mod_path))
+                        except ImportError:
+                            continue
+
             for n, v in inspect.getmembers(item):
                 if _all is not None and n not in _all:
                     continue



More information about the Numpy-svn mailing list