def preferred_targets(self, pkg_name):
    key_fn = spack.package_prefs.PackagePrefs(pkg_name, 'target')
    if (not self.target_specs_cache):
        self.target_specs_cache = [spack.spec.Spec('target={0}'.format(target_name)) for target_name in archspec.cpu.TARGETS]
    target_specs = self.target_specs_cache
    preferred_targets = [x for x in target_specs if (key_fn(x) < 0)]
    if (not preferred_targets):
        return
    preferred = preferred_targets[0]
    self.gen.fact(fn.package_target_weight(str(preferred.architecture.target), pkg_name, (- 30)))
def preferred_targets(self, pkg_name):
    key_fn = spack.package_prefs.PackagePrefs(pkg_name, 'target')
    if (not self.target_specs_cache):
        self.target_specs_cache = [spack.spec.Spec('target={0}'.format(target_name)) for target_name in archspec.cpu.TARGETS]
    target_specs = self.target_specs_cache
    preferred_targets = [x for x in target_specs if (key_fn(x) < 0)]
    if (not preferred_targets):
        return
    preferred = preferred_targets[0]
    self.gen.fact(fn.package_target_weight(str(preferred.architecture.target), pkg_name, (- 30)))