From eb891603f9062e55809d800c0e1ee20df044a9a1 Mon Sep 17 00:00:00 2001 From: Gregory Ashton <gregory.ashton@ligo.org> Date: Mon, 28 May 2018 15:29:58 +1000 Subject: [PATCH] Fix bug when installing from tar --- setup.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/setup.py b/setup.py index f63a85f37..a82b6c257 100644 --- a/setup.py +++ b/setup.py @@ -4,17 +4,24 @@ from distutils.core import setup import subprocess # Write a version file containing the git hash and info -git_log = subprocess.check_output(['git', 'log', '-1', '--pretty=%h %ai']).decode('utf-8') -git_diff = (subprocess.check_output(['git', 'diff', '.']) - + subprocess.check_output(['git', 'diff', '--cached', '.'])).decode('utf-8') -if git_diff == '': - status = '(CLEAN) ' + git_log -else: - status = '(UNCLEAN) ' + git_log +try: + git_log = subprocess.check_output( + ['git', 'log', '-1', '--pretty=%h %ai']).decode('utf-8') + git_diff = (subprocess.check_output(['git', 'diff', '.']) + + subprocess.check_output( + ['git', 'diff', '--cached', '.'])).decode('utf-8') + if git_diff == '': + status = '(CLEAN) ' + git_log + else: + status = '(UNCLEAN) ' + git_log +except subprocess.CalledProcessError: + status = "NO VERSION INFORMATION" + version_file = '.version' with open('tupak/' + version_file, 'w+') as f: f.write(status) + setup(name='tupak', version='0.1', packages=['tupak'], -- GitLab