Skip to content

Instantly share code, notes, and snippets.

@cchurch
Created October 31, 2013 17:33
Show Gist options
  • Save cchurch/7253760 to your computer and use it in GitHub Desktop.
Save cchurch/7253760 to your computer and use it in GitHub Desktop.
Generate sortable version number...
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