From 13e213eb26b823c9368600ed58629679f5da82cb Mon Sep 17 00:00:00 2001 From: William Salmon <will.salmon@codethink.co.uk> Date: Fri, 3 Aug 2018 15:53:53 +0100 Subject: [PATCH] Catch Non Numeric versions This patch just displays a better message than the default stack trace but dose not try to fix the problem. A further patch will be created but it effects versioneer so may take longer to land as it may need to go via versioneer mainline. --- buildstream/utils.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/buildstream/utils.py b/buildstream/utils.py index 93ab6fb0ec..4c4f96e5ec 100644 --- a/buildstream/utils.py +++ b/buildstream/utils.py @@ -484,8 +484,13 @@ def get_bst_version(): raise UtilError("Your git repository has no tags - BuildStream can't " "determine its version. Please run `git fetch --tags`.") - return (int(versions[0]), int(versions[1])) - + try: + return (int(versions[0]), int(versions[1])) + except Exception: + # We should try a mitigation hear, like falling back to a previous version. + raise UtilError("Cannot detect numeric Major and Minor version numbers\n" + "Version: {} not in Interger.Interger.whatever format" + .format(__version__)) @contextmanager def save_file_atomic(filename, mode='w', *, buffering=-1, encoding=None, -- GitLab