summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Salmon <will.salmon@codethink.co.uk>2018-08-03 15:53:53 +0100
committerWilliam Salmon <will.salmon@codethink.co.uk>2018-08-22 09:05:28 +0100
commiteeaddbac923c49b8a9cde5aa411233d850dabbc4 (patch)
treeb2a5d4bd2a24e596b9e811882e8d1463d6d1bd6e
parentc8bafb687e1ac2c2692f69c0e6f0bb80a2cb7565 (diff)
downloadbuildstream-eeaddbac923c49b8a9cde5aa411233d850dabbc4.tar.gz
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.
-rw-r--r--buildstream/utils.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/buildstream/utils.py b/buildstream/utils.py
index 149ee7b90..943346689 100644
--- a/buildstream/utils.py
+++ b/buildstream/utils.py
@@ -484,7 +484,16 @@ 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 IndexError:
+ raise UtilError("Cannot detect Major and Minor parts of the version\n"
+ "Version: {} not in XX.YY.whatever format"
+ .format(__version__))
+ except ValueError:
+ raise UtilError("Cannot convert version to integer numbers\n"
+ "Version: {} not in Integer.Integer.whatever format"
+ .format(__version__))
@contextmanager