diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index ab03368135..11e64e9061 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -678,7 +678,7 @@ def installed_upstream(self): @classmethod def possible_dependencies( cls, transitive=True, expand_virtuals=True, deptype='all', - visited=None, missing=None): + visited=None, missing=None, virtuals=None): """Return dict of possible dependencies of this package. Args: @@ -691,6 +691,7 @@ def possible_dependencies( far, mapped to their immediate dependencies' names. missing (dict, optional): dict to populate with packages and their *missing* dependencies. + virtuals (set): if provided, populate with virtuals seen so far. Returns: (dict): dictionary mapping dependency names to *their* @@ -727,6 +728,8 @@ def possible_dependencies( # expand virtuals if enabled, otherwise just stop at virtuals if spack.repo.path.is_virtual(name): + if virtuals is not None: + virtuals.add(name) if expand_virtuals: providers = spack.repo.path.providers_for(name) dep_names = [spec.name for spec in providers] @@ -759,7 +762,8 @@ def possible_dependencies( continue dep_cls.possible_dependencies( - transitive, expand_virtuals, deptype, visited, missing) + transitive, expand_virtuals, deptype, visited, missing, + virtuals) return visited diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py index 9a80dbe83f..b102863446 100644 --- a/lib/spack/spack/solver/asp.py +++ b/lib/spack/spack/solver/asp.py @@ -346,6 +346,11 @@ def arch_defaults(self): self.fact(fn.arch_os_default(default_arch.os)) self.fact(fn.arch_target_default(default_arch.target)) + def virtual_providers(self, virtuals): + for vspec in virtuals: + providers = spack.repo.path.providers_for(vspec) + print("PROVIDE", providers, [type(t) for t in providers]) + def generate_asp_program(self, specs): """Write an ASP program for specs. @@ -373,6 +378,7 @@ def generate_asp_program(self, specs): self.h1('General Constraints') self.compiler_defaults() self.arch_defaults() + self.virtual_providers(virtuals) self.h1('Package Constraints') for pkg in pkgs: