'Read the DependencySpec portion of a YAML-formatted Spec.
This needs to be backward-compatible with older spack spec
formats so that reindex will work on old specs/databases.'

@staticmethod
def read_yaml_dep_specs(dependency_dict):

    for (dep_name, elt) in dependency_dict.items():
        if isinstance(elt, string_types):
            (dag_hash, deptypes) = (elt, ['build', 'link'])
        elif isinstance(elt, tuple):
            (dag_hash, deptypes) = elt
        elif isinstance(elt, dict):
            (dag_hash, deptypes) = (elt['hash'], elt['type'])
        else:
            raise SpecError("Couldn't    parse    dependency    types    in    spec.")
        (yield (dep_name, dag_hash, list(deptypes)))
