--- /dev/null
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+
+import subprocess
+import time
+
+class VersionInfoFromGit():
+ """Return arvados version from git
+ """
+ def git_latest_tag(self):
+ gitinfo = subprocess.check_output(
+ ['git', 'describe', '--abbrev=0']).strip()
+ return str(gitinfo.decode('utf-8'))
+
+ def git_timestamp_tag(self):
+ gitinfo = subprocess.check_output(
+ ['git', 'log', '--first-parent', '--max-count=1',
+ '--format=format:%ct', '.']).strip()
+ return str(time.strftime('.%Y%m%d%H%M%S', time.gmtime(int(gitinfo))))
def git_latest_tag(self):
gitinfo = subprocess.check_output(
['git', 'describe', '--abbrev=0']).strip()
- return str(gitinfo)
+ return str(gitinfo.decode('utf-8'))
def git_timestamp_tag(self):
gitinfo = subprocess.check_output(
tagger = egg_info_cmd.egg_info
version = os.environ.get("ARVADOS_BUILDING_VERSION")
if not version:
- version = "1.0"
try:
- import gittaggers
- tagger = gittaggers.EggInfoFromGit
+ import arvados_version
+ vtag = arvados_version.VersionInfoFromGit()
+ version = vtag.git_latest_tag() + vtag.git_timestamp_tag()
except ImportError:
pass
def git_latest_tag(self):
gitinfo = subprocess.check_output(
['git', 'describe', '--abbrev=0']).strip()
- return str(gitinfo)
+ return str(gitinfo.decode('utf-8'))
def git_timestamp_tag(self):
gitinfo = subprocess.check_output(