Skip to content
Snippets Groups Projects
Commit af908094 authored by Dariusz Kędzierski's avatar Dariusz Kędzierski
Browse files

Cleanup and comments in GitRevisionProvider class

parent f59714be
No related branches found
No related tags found
4 merge requests!456Release candidate v1 24,!230Setup monitoring with pghero,!135Enable postgres monitoring on CI server,!84Upgrade of setup.py
......@@ -12,10 +12,16 @@ assert sys.version_info[0] == 3 and sys.version_info[1] >= 6, "hive requires Pyt
VERSION = '0.0.1'
class GitRevisionProvider(object):
_GIT_REVISION = None
""" Static class to provide version and git revision information"""
@staticmethod
def provide_git_revision():
""" Evaluate version and git revision and save it to a version file
Evaluation is based on VERSION variable and git describe if
.git directory is present in tree.
In case when .git is not available version and git_revision is taken
from get_distribution call
"""
if os.path.exists(".git"):
from subprocess import check_output
command = 'git describe --tags --long --dirty'
......@@ -33,6 +39,7 @@ class GitRevisionProvider(object):
@staticmethod
def _save_version_file(hivemind_version, git_revision):
""" Helper method to save version.py with current version and git_revision """
with open("hive/version.py", 'w') as version_file:
version_file.write("# generated by setup.py\n")
version_file.write("# contents will be overwritten\n")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment