Changeset 5945

Show
Ignore:
Timestamp:
10/09/08 16:53:12 (2 months ago)
Author:
jarrod.millman
Message:

back ported Pauli Virtanen's fix for py 2.4 compatible lookfor (see r5862)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.2.x/numpy/lib/utils.py

    r5660 r5945  
    11import os 
    22import sys 
    3 import pkgutil 
    43import types 
    54import re 
     
    683682            except AttributeError: 
    684683                _all = None 
     684 
    685685            # import sub-packages 
    686686            if import_modules and hasattr(item, '__path__'): 
    687                 for m in pkgutil.iter_modules(item.__path__): 
    688                     if _all is not None and m[1] not in _all: 
    689                         continue 
    690                     try: 
    691                         __import__("%s.%s" % (name, m[1])) 
    692                     except ImportError: 
    693                         continue 
     687                for pth in item.__path__:  
     688                    for mod_path in os.listdir(pth):  
     689                        init_py = os.path.join(pth, mod_path, '__init__.py')  
     690                        if not os.path.isfile(init_py): 
     691                            continue  
     692                        if _all is not None and mod_path not in _all: 
     693                            continue 
     694                        try: 
     695                            __import__("%s.%s" % (name, mod_path)) 
     696                        except ImportError: 
     697                            continue 
     698 
    694699            for n, v in inspect.getmembers(item): 
    695700                if _all is not None and n not in _all: