Example #1
0
    def get_egg_distribution_links(self,
                                   package,
                                   version=None,
                                   py_version=sys.version_info,
                                   dev=False,
                                   strict=False):
        """
        Return links to available egg distributions.

        Parameters
        ----------
        package : `str`
            name of the package
        version : `str` or `bool`
            version of the package. Optional, if not provided links for all
            available versions of the package will be returned.
        py_version : `str` or `distutils.version.Version`
            target Python version for distributions. Only those distributions
            which are compatible with the version of Python will be returned.
            Defaults to the Python version of the current interpreter. If
            None is provided will return distributions for all Python
            platforms.
        dev: `bool`
            If set, will only return dev versions. Otherwise, return
            only released versions.
        strict: `bool`
            If set, matches dev versions strictly.
            Eg: 0.0.dev OK, 2.33.dev3 -not OK.

        Returns
        -------
        dists : `dict`
            a map of `str`->`pkg_resources.Distribution`
            (distribution URL -> distribution object)
        """

        fn = ((util.is_strict_dev_version if strict else util.is_dev_version)
              if dev else (lambda v: not util.is_dev_version(v)))
        py_version = py_version and util.short_version(py_version, max_parts=2)
        dists = {}

        for l in self.get_links(package):
            if not l.endswith(".egg"):
                continue

            d = Distribution.from_filename(l.rsplit("/", 1)[-1])

            if py_version and d.py_version != py_version:
                continue

            if not fn(d.version):
                continue

            if version and d.version != version:
                continue

            dists[l] = d

        return dists
Example #2
0
    def get_egg_distribution_links(self, package, version=None,
                                   py_version=sys.version_info,
                                   dev=False, strict=False):
        """
        Return links to available egg distributions.

        Parameters
        ----------
        package : `str`
            name of the package
        version : `str` or `bool`
            version of the package. Optional, if not provided links for all
            available versions of the package will be returned.
        py_version : `str` or `distutils.version.Version`
            target Python version for distributions. Only those distributions
            which are compatible with the version of Python will be returned.
            Defaults to the Python version of the current interpreter. If
            None is provided will return distributions for all Python
            platforms.
        dev: `bool`
            If set, will only return dev versions. Otherwise, return
            only released versions.
        strict: `bool`
            If set, matches dev versions strictly.
            Eg: 0.0.dev OK, 2.33.dev3 -not OK.

        Returns
        -------
        dists : `dict`
            a map of `str`->`pkg_resources.Distribution`
            (distribution URL -> distribution object)
        """

        fn = ((util.is_strict_dev_version if strict else util.is_dev_version) if dev
              else (lambda v: not util.is_dev_version(v)))
        py_version = py_version and util.short_version(py_version, max_parts=2)
        dists = {}

        for l in self.get_links(package):
            if not l.endswith(".egg"):
                continue

            d = Distribution.from_filename(l.rsplit("/", 1)[-1])

            if py_version and d.py_version != py_version:
                continue

            if not fn(d.version):
                continue

            if version and d.version != version:
                continue

            dists[l] = d

        return dists
Example #3
0
 def _get_active_python_versions(self):
     if CONFIG.jenkins_matrix_job_pyversions:
         return CONFIG.jenkins_matrix_job_pyversions
     return (util.short_version(sys.version_info, max_parts=3, separator='.'),)
Example #4
0
 def _get_active_python_versions(self):
     if CONFIG.jenkins_matrix_job_pyversions:
         return CONFIG.jenkins_matrix_job_pyversions
     return (util.short_version(sys.version_info,
                                max_parts=3,
                                separator='.'), )