Use sortable versioning scheme
Please use easily sortable versions (e.g. "3.1.0", "3.1.0.1", "3.1.1", "3.1.2"). Many tools treat "3.101" as newer than "3.11". (The master branch now has version "3.11 dev".)
$ python -c 'from distutils.version import LooseVersion; print(LooseVersion("3.101") > LooseVersion("3.11"))'
True
$ python -c 'from distutils.version import StrictVersion; print(StrictVersion("3.101") > StrictVersion("3.11"))'
True
Examples from a function used by Portage (main package manager for Gentoo Linux):
$ python -c 'from portage import vercmp; print(vercmp("1", "2"))'
-1
$ python -c 'from portage import vercmp; print(vercmp("1", "1"))'
0
$ python -c 'from portage import vercmp; print(vercmp("2", "1"))'
1
$ python -c 'from portage import vercmp; print(vercmp("3.101", "3.11"))'
1
Well, decimals are sortable, but they're clearly nonstandard. I think I'll release the next version as 4.0 and do it with multiple-periods from then on; that should be clear to everyone.
Arfrever: My solution in Debian was to put decimals between every number, e.g. 3.1.0.1. I do it pretty hackily with a pair of regexes, I don't know if Gentoo has any similar mechanism. http://anonscm.debian.org/viewvc/python-modules/packages/python-html2text/trunk/debian/watch?view=markup
I can use something similar to:
$ version="3.101"
$ version="${version//./}"
$ parsed_version=
$ for ((i=0; i<${#version}; i++)); do parsed_version+="${parsed_version:+.}${version:${i}:1}"; done
$ echo "${parsed_version}"
3.1.0.1