From d645ce974565fc010f1b6d28a397c8136dea7d2c Mon Sep 17 00:00:00 2001 From: Ross Lawley Date: Fri, 24 Aug 2012 15:08:37 +0100 Subject: [PATCH] Updated version calculation --- mongoengine/__init__.py | 7 +++---- setup.py | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/mongoengine/__init__.py b/mongoengine/__init__.py index ea3dd5e6..0ace8f00 100644 --- a/mongoengine/__init__.py +++ b/mongoengine/__init__.py @@ -16,9 +16,8 @@ VERSION = (0, 6, 20) def get_version(): - version = '%s.%s' % (VERSION[0], VERSION[1]) - if VERSION[2]: - version = '%s.%s' % (version, VERSION[2]) - return version + if isinstance(VERSION[-1], basestring): + return '.'.join(map(str, VERSION[:-1])) + VERSION[-1] + return '.'.join(map(str, VERSIONs)) __version__ = get_version() diff --git a/setup.py b/setup.py index 398bd98a..dcdccae3 100644 --- a/setup.py +++ b/setup.py @@ -18,10 +18,9 @@ except: def get_version(version_tuple): - version = '%s.%s' % (version_tuple[0], version_tuple[1]) - if version_tuple[2]: - version = '%s.%s' % (version, version_tuple[2]) - return version + if isinstance(version_tuple[-1], basestring): + return '.'.join(map(str, version_tuple[:-1])) + version_tuple[-1] + return '.'.join(map(str, version_tuple)) # Dirty hack to get version number from monogengine/__init__.py - we can't # import it as it depends on PyMongo and PyMongo isn't installed until this