diff --git a/.gitignore b/.gitignore index 6c7253373..1a89206e2 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ app.db node_modules npm-debug.log yarn.lock +superset/assets/version_info.json diff --git a/setup.py b/setup.py index b4f58e2c6..ed8d08178 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,5 @@ -import imp import os +import subprocess import json from setuptools import setup, find_packages @@ -9,6 +9,28 @@ PACKAGE_FILE = os.path.join(PACKAGE_DIR, 'package.json') with open(PACKAGE_FILE) as package_file: version_string = json.load(package_file)['version'] + +def get_git_sha(): + try: + s = str(subprocess.check_output(['git', 'rev-parse', 'HEAD'])) + return s.strip() + except: + pass + +GIT_SHA = get_git_sha() +version_info = { + 'GIT_SHA': GIT_SHA, + 'version': version_string, +} +print("-==-" * 15) +print("VERSION: " + version_string) +print("GIT SHA: " + GIT_SHA) +print("-==-" * 15) + +with open(os.path.join(PACKAGE_DIR, 'version_info.json'), 'w') as version_file: + json.dump(version_info, version_file) + + setup( name='superset', description=( diff --git a/superset/templates/appbuilder/navbar.html b/superset/templates/appbuilder/navbar.html index db1a1106a..5772cc648 100644 --- a/superset/templates/appbuilder/navbar.html +++ b/superset/templates/appbuilder/navbar.html @@ -21,6 +21,11 @@ {% include 'appbuilder/navbar_menu.html' %}