'Create this repo\'s namespace module and insert it into sys.modules.
Ensures that modules loaded via the repo have a home, and that
we don\'t get runtime warnings from Python\'s module system.'

def _create_namespace(self):

    parent = None
    for l in range(1, (len(self._names) + 1)):
        ns = '.'.join(self._names[:l])
        if (ns not in sys.modules):
            module = SpackNamespace(ns)
            module.__loader__ = self
            sys.modules[ns] = module
            if parent:
                modname = self._names[(l - 1)]
                setattr(parent, modname, module)
        else:
            module = sys.modules[ns]
        parent = module
