[Numpy-svn] r5862 - trunk/numpy/lib

numpy-svn@scip... numpy-svn@scip...
Wed Sep 24 06:50:45 CDT 2008


Author: ptvirtan
Date: 2008-09-24 06:50:38 -0500 (Wed, 24 Sep 2008)
New Revision: 5862

Modified:
   trunk/numpy/lib/utils.py
Log:
Fix python2.5 dependency in lookfor

Modified: trunk/numpy/lib/utils.py
===================================================================
--- trunk/numpy/lib/utils.py	2008-09-23 03:48:01 UTC (rev 5861)
+++ trunk/numpy/lib/utils.py	2008-09-24 11:50:38 UTC (rev 5862)
@@ -1,6 +1,5 @@
 import os
 import sys
-import pkgutil
 import types
 import re
 
@@ -680,15 +679,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