From 4089aebfbaf5b5aa403dd50b5b0f67e58c632b1a Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Wed, 28 Mar 2018 13:41:39 +0300 Subject: [PATCH] dvc: dynamic version Fixes #566 Signed-off-by: Ruslan Kuprieiev --- dvc/__init__.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/dvc/__init__.py b/dvc/__init__.py index 8c166489e..72769e611 100644 --- a/dvc/__init__.py +++ b/dvc/__init__.py @@ -3,5 +3,20 @@ DVC ---- Make your data science projects reproducible and shareable. """ +import os + VERSION = '0.9.3' + +if os.getenv('APPVEYOR_REPO_TAG', '').lower() != 'true' and os.getenv('TRAVIS_TAG', '') == '': + # Dynamically update version + try: + import git + repo = git.Repo(os.curdir, search_parent_directories=True) + sha = repo.head.object.hexsha + short_sha = repo.git.rev_parse(sha, short=6) + dirty = '.mod' if repo.is_dirty() else '' + VERSION = '{}+{}{}'.format(VERSION, short_sha, dirty) + except: + pass + __version__ = VERSION