def external_packages(self):
    'Facts on external packages, as read from packages.yaml'
    packages_yaml = spack.config.get('packages')
    packages_yaml = _normalize_packages_yaml(packages_yaml)
    self.gen.h1('External packages')
    for (pkg_name, data) in packages_yaml.items():
        if (pkg_name == 'all'):
            continue
        if (pkg_name not in spack.repo.path):
            continue
        self.gen.h2('External package: {0}'.format(pkg_name))
        external_buildable = data.get('buildable', True)
        if (not external_buildable):
            self.gen.fact(fn.external_only(pkg_name))
        externals = data.get('externals', [])
        external_specs = [spack.spec.Spec(x['spec']) for x in externals]
        external_versions = [(x.version, external_id) for (external_id, x) in enumerate(external_specs)]
        external_versions = [(v, idx, external_id) for (idx, (v, external_id)) in enumerate(sorted(external_versions, reverse=True))]
        for (version, idx, external_id) in external_versions:
            self.declared_versions[pkg_name].append(DeclaredVersion(version=version, idx=idx, origin=version_provenance.external))
        for (local_idx, spec) in enumerate(external_specs):
            condition_id = self.condition(spec)
            self.gen.fact(fn.possible_external(condition_id, pkg_name, local_idx))
            self.possible_versions[spec.name].add(spec.version)
            self.gen.newline()
Facts on external packages, as read from packages.yaml
def external_packages(self):
    
    packages_yaml = spack.config.get('packages')
    packages_yaml = _normalize_packages_yaml(packages_yaml)
    self.gen.h1('External packages')
    for (pkg_name, data) in packages_yaml.items():
        if (pkg_name == 'all'):
            continue
        if (pkg_name not in spack.repo.path):
            continue
        self.gen.h2('External package: {0}'.format(pkg_name))
        external_buildable = data.get('buildable', True)
        if (not external_buildable):
            self.gen.fact(fn.external_only(pkg_name))
        externals = data.get('externals', [])
        external_specs = [spack.spec.Spec(x['spec']) for x in externals]
        external_versions = [(x.version, external_id) for (external_id, x) in enumerate(external_specs)]
        external_versions = [(v, idx, external_id) for (idx, (v, external_id)) in enumerate(sorted(external_versions, reverse=True))]
        for (version, idx, external_id) in external_versions:
            self.declared_versions[pkg_name].append(DeclaredVersion(version=version, idx=idx, origin=version_provenance.external))
        for (local_idx, spec) in enumerate(external_specs):
            condition_id = self.condition(spec)
            self.gen.fact(fn.possible_external(condition_id, pkg_name, local_idx))
            self.possible_versions[spec.name].add(spec.version)
            self.gen.newline()