summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2019-10-06 15:34:44 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2020-11-17 10:04:13 -0800
commit3f93553a0852502ef10b9d698de219687f22b381 (patch)
tree75d1cbca7ce942e7280ecba5d4c0750bdddf8382 /lib
parent8a6207aa70221070724944529956b49fbfbbb4e2 (diff)
downloadspack-3f93553a0852502ef10b9d698de219687f22b381.tar.gz
spack-3f93553a0852502ef10b9d698de219687f22b381.tar.bz2
spack-3f93553a0852502ef10b9d698de219687f22b381.tar.xz
spack-3f93553a0852502ef10b9d698de219687f22b381.zip
concretizer: print out virtuals
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/package.py8
-rw-r--r--lib/spack/spack/solver/asp.py6
2 files changed, 12 insertions, 2 deletions
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 @@ class PackageBase(with_metaclass(PackageMeta, PackageViewMixin, object)):
@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 @@ class PackageBase(with_metaclass(PackageMeta, PackageViewMixin, object)):
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 @@ class PackageBase(with_metaclass(PackageMeta, PackageViewMixin, object)):
# 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 @@ class PackageBase(with_metaclass(PackageMeta, PackageViewMixin, object)):
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 @@ class AspGenerator(object):
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 @@ class AspGenerator(object):
self.h1('General Constraints')
self.compiler_defaults()
self.arch_defaults()
+ self.virtual_providers(virtuals)
self.h1('Package Constraints')
for pkg in pkgs: