From 3828e5033c9a251c2901e67c88e2ef2ea5f69a81 Mon Sep 17 00:00:00 2001 From: Chris Johns Date: Fri, 11 Dec 2015 17:01:51 +1100 Subject: VERSION as an INI format file. One section is supported [version] with a 'release' entry. --- wscript | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'wscript') diff --git a/wscript b/wscript index d519f06..9cbf682 100644 --- a/wscript +++ b/wscript @@ -41,11 +41,12 @@ def get_version(ctx): release = '%s.%s' % (version, revision) if os.path.exists('VERSION'): try: - with open('VERSION') as v: - release = v.readline().strip() - v.close() - except: - ctx.fatal('cannot access the VERSION file') + import configparser + except ImportError: + import ConfigParser as configparser + v = configparser.SafeConfigParser() + v.read('VERSION') + release = v.get('version', 'release') else: from rtemstoolkit import git repo = git.repo('.') @@ -55,7 +56,7 @@ def get_version(ctx): modified = '_modified' else: modified = '' - release = '%s.%s%s)' % (version, head[0:12], modified) + release = '%s.%s%s' % (version, head[0:12], modified) last_dot = release.rfind('.') if last_dot == -1: ctx.fatal('invalid VERSION file') -- cgit v1.2.3