def pkg_version_rules(self, pkg):
    'Output declared versions of a package.\n\n        This uses self.possible_versions so that we include any versions\n        that arise from a spec.\n        '

    def key_fn(version):
        return (version.origin, version.idx)
    pkg = packagize(pkg)
    declared_versions = self.declared_versions[pkg.name]
    most_to_least_preferred = sorted(declared_versions, key=key_fn)
    for (weight, declared_version) in enumerate(most_to_least_preferred):
        self.gen.fact(fn.version_declared(pkg.name, declared_version.version, weight, version_origin_str[declared_version.origin]))
    deprecated = self.deprecated_versions[pkg.name]
    for v in sorted(deprecated):
        self.gen.fact(fn.deprecated_version(pkg.name, v))
Output declared versions of a package.

This uses self.possible_versions so that we include any versions
that arise from a spec.
def pkg_version_rules(self, pkg):
    'Output declared versions of a package.\n\n        This uses self.possible_versions so that we include any versions\n        that arise from a spec.\n        '

    def key_fn(version):
        return (version.origin, version.idx)
    pkg = packagize(pkg)
    declared_versions = self.declared_versions[pkg.name]
    most_to_least_preferred = sorted(declared_versions, key=key_fn)
    for (weight, declared_version) in enumerate(most_to_least_preferred):
        self.gen.fact(fn.version_declared(pkg.name, declared_version.version, weight, version_origin_str[declared_version.origin]))
    deprecated = self.deprecated_versions[pkg.name]
    for v in sorted(deprecated):
        self.gen.fact(fn.deprecated_version(pkg.name, v))