From 4a7ef82bf88efa579f6c1b102f96c5185b0400db Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 16 Feb 2017 23:16:16 +0100 Subject: [PATCH] cant depend on build-helper to have cdist.version module Signed-off-by: Steven Armstrong --- setup.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index f29a8998..b79e8340 100644 --- a/setup.py +++ b/setup.py @@ -1,9 +1,20 @@ from distutils.core import setup -import cdist import os import re +# Ensure version is present - the bundled/shipped version contains a static version, +# the git version contains a dynamic version +try: + import cdist.version +except ImportError: + import subprocess + version = subprocess.getoutput('git describe') + with open('cdist/version.py', 'w') as fd: + fd.write('VERSION = "%s"\n' % version) + +import cdist + def data_finder(data_dir): entries = [] for name in os.listdir(data_dir):