The answers to this question have helped me to compare two version number strings and see which version is "greater", i.e. newer.
What I now need to do is to calculate the actual difference between two version numbers. Mostly to see if a new major version has been released, or only a minor version.
"1.3.6" - "1.3.3"
should return "0.0.3"
"5.2.0" - "4.0.0"
should return "1.2.0"
I could write a function that calculates the difference myself (easy in theory), but it would be a hassle to include all the cases pkg_resources already considered, like letters between or at the end of version numbers.
I've looked into the documentary of pkg_resources, but simple subtraction doesn't seem to work. Are there any other already implemented solutions for this problem?
Edit: Okay, simple subtraction doesn't make much sense, now that I think about it. It will dilute the borders between major and minor versions (e.g. "2.1" - "1.2" = "0.9" which isn't helpful at all). (Thanks @Jeremy Banks)