'Instantiate a package repository from a filesystem path.
Arguments:
root        The root directory of the repository.
namespace   A super-namespace that will contain the repo-defined
namespace (this is generally jsut `spack.pkg`). The
super-namespace is Spack\'s way of separating repositories
from other python namespaces.'

def __init__(self, root, namespace=repo_namespace):

    self.root = canonicalize_path(root)
    self.super_namespace = namespace
    def check(condition, msg):
        if (not condition):
            raise BadRepoError(msg)
    self.config_file = join_path(self.root, repo_config_name)
    check(os.path.isfile(self.config_file), ("No    %s    found    in    '%s'" % (repo_config_name, root)))
    self.packages_path = join_path(self.root, packages_dir_name)
    check(os.path.isdir(self.packages_path), ("No    directory    '%s'    found    in    '%s'" % (repo_config_name, root)))
    config = self._read_config()
    check(('namespace' in config), ('%s    must    define    a    namespace.' % join_path(root, repo_config_name)))
    self.namespace = config['namespace']
    check(re.match('[a-zA-Z][a-zA-Z0-9_.]+', self.namespace), (("Invalid    namespace    '%s'    in    repo    '%s'.    " % (self.namespace, self.root)) + "Namespaces    must    be    valid    python    identifiers    separated    by    '.'"))
    if self.super_namespace:
        self.full_namespace = ('%s.%s' % (self.super_namespace, self.namespace))
    else:
        self.full_namespace = self.namespace
    self._names = self.full_namespace.split('.')
    self._modules = {}
    self._classes = {}
    self._instances = {}
    self._needs_update = []
    self._provider_index = None
    self._all_package_names = None
    self._create_namespace()
    self._cache_file = ('providers/%s-index.yaml' % self.namespace)
