'Return set of possible transitive dependencies of this package.
Args:
transitive (bool): include all transitive dependencies if True,
only direct dependencies if False.'

def possible_dependencies(self, transitive=True, visited=None):

    if (visited is None):
        visited = set()
    visited.add(self.name)
    for name in self.dependencies:
        spec = spack.spec.Spec(name)
        if (not spec.virtual):
            visited.add(name)
            if transitive:
                pkg = spack.repo.get(name)
                pkg.possible_dependencies(transitive, visited)
        else:
            for provider in spack.repo.providers_for(spec):
                visited.add(provider.name)
                if transitive:
                    pkg = spack.repo.get(provider.name)
                    pkg.possible_dependencies(transitive, visited)
    return visited
