From 2bf69899da028795cfb39b9a5ff090d319c1ccea Mon Sep 17 00:00:00 2001 From: ccoffrin Date: Sun, 23 Sep 2018 00:08:32 -0600 Subject: [PATCH] adding check_version.py --- check_version.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 check_version.py diff --git a/check_version.py b/check_version.py new file mode 100755 index 0000000..13bd753 --- /dev/null +++ b/check_version.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python + +import sys +import subprocess +import grg_psse2grg + +git_describe = subprocess.check_output(['git', 'describe', '--tags']).rstrip().decode('ascii') + +py_version = grg_psse2grg.__version__ + +print('git describe: {}'.format(git_describe)) + +git_version = git_describe.split('-')[0].strip('v') +print('git version: {}'.format(git_version)) + +print('grg_psse2grg version: {}'.format(py_version)) + +py_version_parts = [int(x) for x in py_version.split('.')] +git_version_parts = [int(x) for x in git_version.split('.')] + +assert(len(py_version_parts) == len(git_version_parts)) + +for i in range(len(py_version_parts)): + if git_version_parts[i] > py_version_parts[i]: + print('git version is ahead of python version') + sys.exit(1) + + if git_version_parts[i] < py_version_parts[i]: + break