Allow to upload and test specific versions

Issue #71 on hold
Sebastian Rahlf
created an issue

Currently, you cannot test releases other than the most recent one.

Example: I've just uploaded version 0.3.2 via devpi. Now I want to backport some of the changes to an older but still to be maintained version 0.2.8.

devpi upload && devpi test my-package 

will not work in this instance because that will test version 0.3.2!

I would need something like

devpi test my-package==0.2.8

Comments (10)

  1. Sebastian Rahlf reporter

    I've implemented a prototype with the following changes:

    # client/devpi/
    class LinkSet:
        # ...
        def getversion(self, pkgname, reqversion):
            reqversion = Version(reqversion)
            for link in self.links:
                basename = URL(link.url).basename
                name, version = splitbasename(basename)[:2]
                ver = Version(version)
                if name == pkgname and ver == reqversion:
                    return link
            return None  # not found!
    # ...
    class RemoteIndex:
        # ...
        def getbestlink(self, pkgname):
            req = list(pkg_resources.parse_requirements(pkgname))[0]
            links = self.getlinkset(req.project_name)
            if req.specs:  # specific version information is supplied
                # TODO What about other operators like <=? Or more than one?
                op, version = req.specs[0]
                return links.getversion(req.project_name, version)
            return links.getnewestversion(pkgname)

    This requires module pkg_resources which you have used elsewhere already, if I'm not mistaken.

  2. Holger Krekel repo owner

    Makes sense to rely on pkg_resources. The latter actually has code for matching requirements -- we should use it and not rely on "==" being used :)

    Could you prepare a PR, also with a test?

  3. Sebastian Rahlf reporter

    Thanks for pointing that out. I actually reimplemented the matching logic with operator functions and a dictionary. Well... Now the changes are even more concise.

  4. Log in to comment