Changed version number string. Important for building portable version.
Used alpha|beta|rc without git commit hash. Added 'dev' suffix which use git hash only. It is easier to handle in file names of releases.
This commit is contained in:
parent
8ffeadfe88
commit
d9ccb02969
@ -16,7 +16,7 @@ def get_version(version=None):
|
|||||||
if version is None:
|
if version is None:
|
||||||
version = VERSION
|
version = VERSION
|
||||||
assert len(version) == 5
|
assert len(version) == 5
|
||||||
assert version[3] in ('alpha', 'beta', 'rc', 'final')
|
assert version[3] in ('dev', 'alpha', 'beta', 'rc', 'final')
|
||||||
|
|
||||||
# Now build the two parts of the version number:
|
# Now build the two parts of the version number:
|
||||||
# main = X.Y[.Z]
|
# main = X.Y[.Z]
|
||||||
@ -27,16 +27,17 @@ def get_version(version=None):
|
|||||||
main = '.'.join(str(x) for x in version[:main_parts])
|
main = '.'.join(str(x) for x in version[:main_parts])
|
||||||
|
|
||||||
if version[3] != 'final':
|
if version[3] != 'final':
|
||||||
mapping = {'alpha': 'a', 'beta': 'b', 'rc': 'c'}
|
if version[3] == 'dev':
|
||||||
sub = mapping[version[3]] + str(version[4])
|
try:
|
||||||
try:
|
git_head_path = '.git/' + open('.git/HEAD', 'r').read()[5:].rstrip()
|
||||||
git_head_path = '.git/' + open('.git/HEAD', 'r').read()[5:].rstrip()
|
except IOError:
|
||||||
except IOError:
|
git_commit_id = 'unknown'
|
||||||
git_commit_id = 'unknown'
|
else:
|
||||||
|
import os
|
||||||
|
git_commit_id = open(os.path.abspath(git_head_path), 'r').read().rstrip()
|
||||||
|
sub = '-%s%s' % (version[3], git_commit_id)
|
||||||
else:
|
else:
|
||||||
import os
|
sub = '-' + version[3] + str(version[4])
|
||||||
git_commit_id = open(os.path.abspath(git_head_path), 'r').read().rstrip()
|
|
||||||
sub = '%s commit %s' % (sub, git_commit_id)
|
|
||||||
else:
|
else:
|
||||||
sub = ''
|
sub = ''
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user