[Distutils] comparing version strings?

P.J. Eby pje at telecommunity.com
Fri Jun 25 15:09:55 CEST 2010


At 10:34 AM 6/25/2010 +0100, Chris Withers wrote:
>Hi All,
>
>Is there any any in setuptools/distutils/anything else that I can 
>use to compare version strings using the same rules as setuptools?
>
>ie: sort the following list of versions:
>
>1.0
>2.0dev-r22542-20100623
>2.0dev-r22553-20100624
>2.0
>
>...etc

http://peak.telecommunity.com/DevCenter/PkgResources#parsing-utilities

from pkg_resources import parse_version

sort(versions, key=parse_version)




>cheers,
>
>Chris
>
>_______________________________________________
>Distutils-SIG maillist  -  Distutils-SIG at python.org
>http://mail.python.org/mailman/listinfo/distutils-sig



More information about the Distutils-SIG mailing list