def setup(self, driver, specs, tests=False):
    'Generate an ASP program with relevant constraints for specs.\n\n        This calls methods on the solve driver to set up the problem with\n        facts and rules from all possible dependencies of the input\n        specs, as well as constraints from the specs themselves.\n\n        Arguments:\n            specs (list): list of Specs to solve\n        '
    self._condition_id_counter = itertools.count()
    check_packages_exist(specs)
    self.possible_virtuals = set((x.name for x in specs if x.virtual))
    possible = spack.package.possible_dependencies(*specs, virtuals=self.possible_virtuals, deptype=spack.dependency.all_deptypes)
    pkgs = set(possible)
    self.gen = driver
    self.possible_compilers = self.generate_possible_compilers(specs)
    self.build_version_dict(possible, specs)
    self.gen.h1('General Constraints')
    self.available_compilers()
    self.compiler_defaults()
    self.compiler_supports_os()
    self.platform_defaults()
    self.os_defaults(specs)
    self.target_defaults(specs)
    self.virtual_providers()
    self.provider_defaults()
    self.external_packages()
    self.flag_defaults()
    self.gen.h1('Package Constraints')
    for pkg in sorted(pkgs):
        self.gen.h2(('Package rules: %s' % pkg))
        self.pkg_rules(pkg, tests=tests)
        self.gen.h2(('Package preferences: %s' % pkg))
        self.preferred_variants(pkg)
        self.preferred_targets(pkg)
    env = ev.active_environment()
    if env:
        for spec in sorted(specs):
            for dep in spec.traverse():
                _develop_specs_from_env(dep, env)
    self.gen.h1('Spec Constraints')
    for spec in sorted(specs):
        self.gen.h2(('Spec: %s' % str(spec)))
        self.gen.fact((fn.virtual_root(spec.name) if spec.virtual else fn.root(spec.name)))
        for clause in self.spec_clauses(spec):
            self.gen.fact(clause)
            if (clause.name == 'variant_set'):
                self.gen.fact(fn.variant_default_value_from_cli(*clause.args))
    self.gen.h1('Variant Values defined in specs')
    self.define_variant_values()
    self.gen.h1('Virtual Constraints')
    self.define_virtual_constraints()
    self.gen.h1('Version Constraints')
    self.define_version_constraints()
    self.gen.h1('Compiler Version Constraints')
    self.define_compiler_version_constraints()
    self.gen.h1('Target Constraints')
    self.define_target_constraints()
Generate an ASP program with relevant constraints for specs.

This calls methods on the solve driver to set up the problem with
facts and rules from all possible dependencies of the input
specs, as well as constraints from the specs themselves.

Arguments:
    specs (list): list of Specs to solve
def setup(self, driver, specs, tests=False):
    'Generate an ASP program with relevant constraints for specs.\n\n        This calls methods on the solve driver to set up the problem with\n        facts and rules from all possible dependencies of the input\n        specs, as well as constraints from the specs themselves.\n\n        Arguments:\n            specs (list): list of Specs to solve\n        '
    self._condition_id_counter = itertools.count()
    check_packages_exist(specs)
    self.possible_virtuals = set((x.name for x in specs if x.virtual))
    possible = spack.package.possible_dependencies(*specs, virtuals=self.possible_virtuals, deptype=spack.dependency.all_deptypes)
    pkgs = set(possible)
    self.gen = driver
    self.possible_compilers = self.generate_possible_compilers(specs)
    self.build_version_dict(possible, specs)
    self.gen.h1('General Constraints')
    self.available_compilers()
    self.compiler_defaults()
    self.compiler_supports_os()
    self.platform_defaults()
    self.os_defaults(specs)
    self.target_defaults(specs)
    self.virtual_providers()
    self.provider_defaults()
    self.external_packages()
    self.flag_defaults()
    self.gen.h1('Package Constraints')
    for pkg in sorted(pkgs):
        self.gen.h2(('Package rules: %s' % pkg))
        self.pkg_rules(pkg, tests=tests)
        self.gen.h2(('Package preferences: %s' % pkg))
        self.preferred_variants(pkg)
        self.preferred_targets(pkg)
    env = ev.active_environment()
    if env:
        for spec in sorted(specs):
            for dep in spec.traverse():
                _develop_specs_from_env(dep, env)
    self.gen.h1('Spec Constraints')
    for spec in sorted(specs):
        self.gen.h2(('Spec: %s' % str(spec)))
        self.gen.fact((fn.virtual_root(spec.name) if spec.virtual else fn.root(spec.name)))
        for clause in self.spec_clauses(spec):
            self.gen.fact(clause)
            if (clause.name == 'variant_set'):
                self.gen.fact(fn.variant_default_value_from_cli(*clause.args))
    self.gen.h1('Variant Values defined in specs')
    self.define_variant_values()
    self.gen.h1('Virtual Constraints')
    self.define_virtual_constraints()
    self.gen.h1('Version Constraints')
    self.define_version_constraints()
    self.gen.h1('Compiler Version Constraints')
    self.define_compiler_version_constraints()
    self.gen.h1('Target Constraints')
    self.define_target_constraints()