# Path: mpiimport.py
# class Importer:
#     def __init__(self, path=None):
#         if path is not None and not os.path.isdir(path):
#             raise ImportError
#         self.path = path
# 
#     def find_module(self, fullname, path=None):
#         rank = MPI.COMM_WORLD.Get_rank()
#         #        print "[%d] find_module %s %s" % (rank, fullname, path)
# 
#         subname = fullname.split(".")[-1]
#         if subname != fullname and path is None:
#             return None
#         try:
#             file, filename, stuff = mpiimporter.find_module(subname, path)
#         except ImportError:
#             #            print ImportError
#             return None
# 
#         #        print "[%d] find_module found: %s %s" % (rank, file, filename)
# 
#         ignore, ext = os.path.splitext(filename)
# 
#         if ext == '.so':
#             file, filename, stuff = imp.find_module(subname, path)
#             return ImpLoader(file, filename, stuff)
#         
#         return Loader(file, filename, stuff)


from mpiimport import Importer
from mpi4py import MPI
import sys
import numpy
#!/usr/bin/python -B


sys.meta_path.insert(0, Importer())
sys.path_hooks.append(Importer)

#import numpy
 
mnames = ("colorsys", "urlparse", "distutils.core", "compiler.misc", "numpy")

for mname in mnames:

# Path: mpiimport.py
# class Importer:
#     def __init__(self, path=None):
#         if path is not None and not os.path.isdir(path):
#             raise ImportError
#         self.path = path
# 
#     def find_module(self, fullname, path=None):
#         rank = MPI.COMM_WORLD.Get_rank()
#         #        print "[%d] find_module %s %s" % (rank, fullname, path)
# 
#         subname = fullname.split(".")[-1]
#         if subname != fullname and path is None:
#             return None
#         try:
#             file, filename, stuff = mpiimporter.find_module(subname, path)
#         except ImportError:
#             #            print ImportError
#             return None
# 
#         #        print "[%d] find_module found: %s %s" % (rank, file, filename)
# 
#         ignore, ext = os.path.splitext(filename)
# 
#         if ext == '.so':
#             file, filename, stuff = imp.find_module(subname, path)
#             return ImpLoader(file, filename, stuff)
#         
#         return Loader(file, filename, stuff)


# Path: test_import_numpy.py
from mpiimport import Importer
from mpi4py import MPI
import sys
import numpy

#!/usr/bin/python -B


sys.meta_path.insert(0, Importer())
sys.path_hooks.append(Importer)

#import numpy
 
mnames = ("colorsys", "urlparse", "distutils.core", "compiler.misc", "numpy")

for mname in mnames:

    m = __import__(mname, globals(), locals(), ["__dummy__"])