Skip to content

Commit

Permalink
#92 Always extract information from git as opposed to the build syste…
Browse files Browse the repository at this point in the history
…m. The params sent to the client contains the git hash regardless of if it is a release or local build.
  • Loading branch information
krichardsson committed Mar 10, 2016
1 parent bfab207 commit b601013
Showing 1 changed file with 1 addition and 42 deletions.
43 changes: 1 addition & 42 deletions tools/make/versionTemplate.py
Expand Up @@ -5,7 +5,6 @@
import os
from os import path
import re
import json

version = {}

Expand All @@ -14,20 +13,6 @@
*/
"""

BUILD_TOOL_INFO_FILE_NAME = "build_info.json"

def extract_information_from_build_tool():
with open(BUILD_TOOL_INFO_FILE_NAME, 'r') as file:
build_info = json.load(file)

version['tag'] = build_info['tag']
version['revision'] = 'NA'
version['irevision0'] = "0x" + '0'
version['irevision1'] = "0x" + '0'
version['local_revision'] = 'NA'
version['branch'] = 'NA'
version['modified'] = 'false'


def extract_information_from_git():
revision = subprocess.check_output(["git", "rev-parse", "HEAD"]).strip()
Expand Down Expand Up @@ -74,26 +59,6 @@ def extract_information_from_git():
version['modified'] = 'false'


def extract_information_from_mercurial():
identify = subprocess.check_output(["hg", "identify", "-nitb"])
identify = identify.split()
version['revision'] = identify[0]
version['irevision0'] = "0x" + identify[0][0:8]
version['irevision1'] = "0x" + identify[0][8:12]
version['local_revision'] = identify[1]
version['branch'] = identify[2]
if len(identify) > 3:
version['tag'] = identify[3]
else:
version['tag'] = ""

try:
version['local_revision'].index('+')
version['modified'] = 'true'
except Exception:
version['modified'] = 'false'


def extract_information_from_folder_name():
sourcefolder = path.basename(path.abspath(path.dirname(__file__) + '/..'))
match = re.match(".*(20[0-9][0-9]\\.[0-9][0-9]?(\\.[0-9][0-9]?)?)$",
Expand Down Expand Up @@ -123,15 +88,9 @@ def print_version():

if __name__ == "__main__":
version_source = ""
if os.path.isfile(BUILD_TOOL_INFO_FILE_NAME):
version['source'] = "build tool info file"
extract_information_from_build_tool()
elif os.path.isdir(".git"):
if os.path.isdir(".git"):
version['source'] = "git"
extract_information_from_git()
elif os.path.isdir(".hg"):
version['source'] = "mercurial"
extract_information_from_mercurial()
else:
version['source'] = "folder name"
extract_information_from_folder_name()
Expand Down

0 comments on commit b601013

Please sign in to comment.