From c194bda8ce249f069853a99da574877ccf113ef8 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Sat, 5 Jan 2013 02:58:18 +0000 Subject: [PATCH] Handle version with text such as '-alpha' number in const.py svn: r20992 --- gramps/gen/const.py.in | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gramps/gen/const.py.in b/gramps/gen/const.py.in index 8d29c7ca4..fe6863d43 100644 --- a/gramps/gen/const.py.in +++ b/gramps/gen/const.py.in @@ -54,7 +54,16 @@ PROGRAM_NAME = "Gramps" VERSION = "@VERSIONSTRING@" if VERSION == "@" + "VERSIONSTRING" + "@": raise Exception("Please run 'python setup.py build'") -VERSION_TUPLE = tuple(map(int, VERSION.split("."))) +def get_version_tuple(v): + """ Get the numeric-dotted part of version number""" + retval = "" + for c in v: + if c.isdigit() or (c == "." and retval.count(".") <= 1): + retval += c + else: + break + return tuple(map(int, retval.split("."))) +VERSION_TUPLE = get_version_tuple(VERSION) major_version = "%s.%s" % (VERSION_TUPLE[0], VERSION_TUPLE[1]) VERSION += get_svn_revision()