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:07:03 +0100
commita4a8e5ab6217e5301bf09873a9ee7baea21641aa (patch)
tree8a063dc2263b411f0b1b480150cd13c1a6c4169c
parent1d48dee98225189ee6868700ca4838577c1abe4c (diff)
downloadbuildstream-a4a8e5ab6217e5301bf09873a9ee7baea21641aa.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 9546f13cd..eecc820f2 100644
--- a/buildstream/utils.py
+++ b/buildstream/utils.py
@@ -481,7 +481,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