def compiler_defaults(self):
    'Set compiler defaults, given a list of possible compilers.'
    self.gen.h2('Default compiler preferences')
    compiler_list = self.possible_compilers.copy()
    compiler_list = sorted(compiler_list, key=(lambda x: (x.name, x.version)), reverse=True)
    ppk = spack.package_prefs.PackagePrefs('all', 'compiler', all=False)
    matches = sorted(compiler_list, key=ppk)
    for (i, cspec) in enumerate(matches):
        f = fn.default_compiler_preference(cspec.name, cspec.version, i)
        self.gen.fact(f)
    for entry in spack.compilers.all_compilers_config():
        compiler_entry = entry['compiler']
        cspec = spack.spec.CompilerSpec(compiler_entry['spec'])
        if (not compiler_entry.get('target', None)):
            continue
        self.gen.fact(fn.compiler_supports_target(cspec.name, cspec.version, compiler_entry['target']))
Set compiler defaults, given a list of possible compilers.
def compiler_defaults(self):
    
    self.gen.h2('Default compiler preferences')
    compiler_list = self.possible_compilers.copy()
    compiler_list = sorted(compiler_list, key=(lambda x: (x.name, x.version)), reverse=True)
    ppk = spack.package_prefs.PackagePrefs('all', 'compiler', all=False)
    matches = sorted(compiler_list, key=ppk)
    for (i, cspec) in enumerate(matches):
        f = fn.default_compiler_preference(cspec.name, cspec.version, i)
        self.gen.fact(f)
    for entry in spack.compilers.all_compilers_config():
        compiler_entry = entry['compiler']
        cspec = spack.spec.CompilerSpec(compiler_entry['spec'])
        if (not compiler_entry.get('target', None)):
            continue
        self.gen.fact(fn.compiler_supports_target(cspec.name, cspec.version, compiler_entry['target']))