Search code examples
pythonfabric

Comparing versions with Fabric


I need to compare the version of the installed maven package with a minimum version, using fabric. That's a simple x.y.z version number. Is there any fabric or python library with a function to do that, or a simple way of doing it?


Solution

  • Here's a trick to do it, used by Python itself:

    def versioncmp(current, required):
        current = [int(i) for i in current.split('.')]
        required = [int(i) for i in required.split('.')]
        return current >= required