Exemplo n.º 1
0
    def load_package(self, package_name, version_spec):
        fixed_versions = self._fixations[package_name]
        version = version_spec.select(fixed_versions)
        if version:
            version_spec = helpers.parse_version_spec(version)

        packages = self._package_cache.get(package_name)
        if packages:
            version = version_spec.select(packages.keys())
            if version:
                return packages[version]

        filter_opts = {'fqn': package_name,
                       'version': helpers.breakdown_spec_to_query(
                           version_spec)}
        try:
            package_definition = self._get_definition(filter_opts)
            self._lock_usage(package_definition)
        except LookupError:
            exc_info = sys.exc_info()
            six.reraise(exceptions.NoPackageFound,
                        exceptions.NoPackageFound(package_name),
                        exc_info[2])
        else:
            package = self._get_package_by_definition(package_definition)
            self._fixations[package_name].add(package.version)
            self._new_fixations[package_name].add(package.version)
            return self._to_dsl_package(package)
Exemplo n.º 2
0
    def load_package(self, package_name, version_spec):
        fixed_versions = self._fixations[package_name]
        version = version_spec.select(fixed_versions)
        if version:
            version_spec = helpers.parse_version_spec(version)

        packages = self._package_cache.get(package_name)
        if packages:
            version = version_spec.select(six.iterkeys(packages))
            if version:
                return packages[version]

        filter_opts = {'fqn': package_name,
                       'version': helpers.breakdown_spec_to_query(
                           version_spec)}
        try:
            package_definition = self._get_definition(filter_opts)
            self._lock_usage(package_definition)
        except LookupError:
            exc_info = sys.exc_info()
            six.reraise(exceptions.NoPackageFound(package_name),
                        None, exc_info[2])
        else:
            package = self._get_package_by_definition(package_definition)
            self._fixations[package_name].add(package.version)
            self._new_fixations[package_name].add(package.version)
            return self._to_dsl_package(package)
Exemplo n.º 3
0
    def load_class_package(self, class_name, version_spec):
        packages = self._class_cache.get(class_name)
        if packages:
            version = version_spec.select(six.iterkeys(packages))
            if version:
                return packages[version]

        filter_opts = {"class_name": class_name, "version": helpers.breakdown_spec_to_query(version_spec)}
        try:
            package_definition = self._get_definition(filter_opts)
            self._lock_usage(package_definition)
        except LookupError:
            exc_info = sys.exc_info()
            raise (exceptions.NoPackageForClassFound(class_name), None, exc_info[2])
        return self._to_dsl_package(self._get_package_by_definition(package_definition))
Exemplo n.º 4
0
    def load_package(self, package_name, version_spec):
        packages = self._package_cache.get(package_name)
        if packages:
            version = version_spec.select(packages.iterkeys())
            if version:
                return packages[version]

        filter_opts = {'fqn': package_name,
                       'version': helpers.breakdown_spec_to_query(
                           version_spec)}
        try:
            package_definition = self._get_definition(filter_opts)
        except LookupError:
            exc_info = sys.exc_info()
            raise exceptions.NoPackageFound(package_name), None, exc_info[2]
        return self._to_dsl_package(
            self._get_package_by_definition(package_definition))
Exemplo n.º 5
0
    def load_package(self, package_name, version_spec):
        packages = self._package_cache.get(package_name)
        if packages:
            version = version_spec.select(packages.iterkeys())
            if version:
                return packages[version]

        filter_opts = {
            'fqn': package_name,
            'version': helpers.breakdown_spec_to_query(version_spec)
        }
        try:
            package_definition = self._get_definition(filter_opts)
        except LookupError:
            exc_info = sys.exc_info()
            raise exceptions.NoPackageFound(package_name), None, exc_info[2]
        return self._to_dsl_package(
            self._get_package_by_definition(package_definition))
Exemplo n.º 6
0
    def load_class_package(self, class_name, version_spec):
        packages = self._class_cache.get(class_name)
        if packages:
            version = version_spec.select(six.iterkeys(packages))
            if version:
                return packages[version]

        filter_opts = {'class_name': class_name,
                       'version': helpers.breakdown_spec_to_query(
                           version_spec)}
        try:
            package_definition = self._get_definition(filter_opts)
            self._lock_usage(package_definition)
        except LookupError:
            exc_info = sys.exc_info()
            six.reraise(exceptions.NoPackageForClassFound,
                        exceptions.NoPackageForClassFound(class_name),
                        exc_info[2])
        return self._to_dsl_package(
            self._get_package_by_definition(package_definition))