Index: version.py =================================================================== diff -u -r5818c70699fbe02a31d136f440baee0d9f2cb39d -r8d1f61499650e23dac6f857e48daad42180db949 --- version.py (.../version.py) (revision 5818c70699fbe02a31d136f440baee0d9f2cb39d) +++ version.py (.../version.py) (revision 8d1f61499650e23dac6f857e48daad42180db949) @@ -1 +1,42 @@ -dialin/version.py \ No newline at end of file +########################################################################### +# +# Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. +# +# THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN +# WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. +# +# @file version.py +# +# @author (last) Peter Lucia +# @date (last) 18-Jun-2020 +# @author (original) Peter Lucia +# @date (original) 16-Jun-2020 +# +############################################################################ +import subprocess + + +def get_branch(): + """ + Gets the current branch name in the current git repository + + @return: The current branch name + """ + + return subprocess.check_output("git rev-parse --abbrev-ref HEAD", shell=True).decode("utf-8").strip() + + +def get_last_commit(): + """ + Gets the latest commit in the current git repository + + @return: (str) the latest commit in the current git repository + """ + return subprocess.check_output("git rev-parse --short=7 HEAD", shell=True).decode("utf-8").strip() + + +VERSION = "0.5.0-{0}-{1}".format(get_branch(), get_last_commit()) + + +if __name__ == '__main__': + print(VERSION)