Created
October 31, 2013 17:33
-
-
Save cchurch/7253760 to your computer and use it in GitHub Desktop.
Generate sortable version number...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pkg_resources import parse_version | |
def generate_sortable_version(version): | |
''' | |
Generate a flat string from a version number than can be sorted with normal | |
string comparisons. | |
''' | |
return '|'.join(['%-8s' % x for x in parse_version(version)]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment