Java – Python module for handling software versions
•
Java
I am looking for a python module / library that will run on the 'software version'... Which means, for example:
>Compare versions "1.0-snapshot" and "1.1-snapshot" and tell which update > increase "1.0.1-snapshot" to "1.0.2-snapshot" > make "1.0" from "1.0-snapshot" and the same as "- release"
Yes, version naming comes from the Java (Maven) world - my Python part should operate on them
Any ideas?
Solution
Distutils has some support for this
>>> from distutils.version import LooseVersion # or StrictVersion >>> LooseVersion("1.0-SNAPSHOT") < LooseVersion("1.1-SNAPSHOT") True >>> v = LooseVersion("1.0.1-SNAPSHOT") >>> v.version [1,1,'-SNAPSHOT']
You have to do incremental and other operations yourself
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码