Created
August 16, 2011 18:00
-
-
Save stefanfoulis/1149730 to your computer and use it in GitHub Desktop.
PEP386 StrictVersion compliant __version__
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
#-*- coding: utf-8 -*- | |
__version_info__ = { | |
'major': 0, | |
'minor': 1, | |
'micro': 0, | |
'releaselevel': 'alpha', | |
'serial': 1 | |
} | |
def get_version(short=False): | |
assert __version_info__['releaselevel'] in ('alpha', 'beta', 'final') | |
vers = ["%(major)i.%(minor)i" % __version_info__, ] | |
if __version_info__['micro']: | |
vers.append(".%(micro)i" % __version_info__) | |
if __version_info__['releaselevel'] != 'final' and not short: | |
vers.append('%s%i' % (__version_info__['releaselevel'][0], __version_info__['serial'])) | |
return ''.join(vers) | |
__version__ = get_version() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment