summaryrefslogtreecommitdiff
path: root/numpy/lib/utils.py
diff options
context:
space:
mode:
authorDavid Cournapeau <cournape@gmail.com>2008-09-30 04:40:13 +0000
committerDavid Cournapeau <cournape@gmail.com>2008-09-30 04:40:13 +0000
commit9ae2bfa7bca6dcf9cec7de47b997e4c7999aba1b (patch)
tree7f6c660323a1a7888330d55cfcb504bec455dd6c /numpy/lib/utils.py
parentc43202e0bf9571ed4b7d9152fedd5497e270a813 (diff)
parent5916fc4ab60b69148b3c4e33cd218da71d64d8ce (diff)
downloadnumpy-9ae2bfa7bca6dcf9cec7de47b997e4c7999aba1b.tar.gz
Merged revisions 5861-5881 via svnmerge from
http://svn.scipy.org/svn/numpy/trunk ........ r5862 | ptvirtan | 2008-09-24 20:50:38 +0900 (Wed, 24 Sep 2008) | 1 line Fix python2.5 dependency in lookfor ........ r5869 | pierregm | 2008-09-29 02:27:37 +0900 (Mon, 29 Sep 2008) | 3 lines core: * added __rmul and __radd__ * fixed concatenate for flexible-dtype ........ r5878 | ptvirtan | 2008-09-30 02:23:43 +0900 (Tue, 30 Sep 2008) | 1 line Umath tests: remove signed zero check on branch cut for log* as it fails on some platforms. ........ r5879 | pierregm | 2008-09-30 05:24:29 +0900 (Tue, 30 Sep 2008) | 1 line use if ...: raise AssertionError instead of assert ........ r5880 | pierregm | 2008-09-30 05:24:56 +0900 (Tue, 30 Sep 2008) | 1 line replaced assert with self.failUnless ........
Diffstat (limited to 'numpy/lib/utils.py')
-rw-r--r--numpy/lib/utils.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/numpy/lib/utils.py b/numpy/lib/utils.py
index 1c88fb3f1..0b2731005 100644
--- a/numpy/lib/utils.py
+++ b/numpy/lib/utils.py
@@ -1,6 +1,5 @@
import os
import sys
-import pkgutil
import types
import re
@@ -680,15 +679,21 @@ def _lookfor_generate_cache(module, import_modules, regenerate):
_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