aboutsummaryrefslogtreecommitdiff
path: root/mesonast.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2016-11-19 22:11:20 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2016-11-19 22:11:20 +0200
commitc41805f012fe7305dfba978f6cb70741d782c57f (patch)
tree1eb0ed9af19cd6f4eed82a0637a6330da2034a71 /mesonast.py
parent7e8872236d1c8b8baca910a3c03b0399ed94dbea (diff)
downloadmeson-c41805f012fe7305dfba978f6cb70741d782c57f.zip
meson-c41805f012fe7305dfba978f6cb70741d782c57f.tar.gz
meson-c41805f012fe7305dfba978f6cb70741d782c57f.tar.bz2
Moved more stuff, can now parse all of common tests.
Diffstat (limited to 'mesonast.py')
-rwxr-xr-xmesonast.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/mesonast.py b/mesonast.py
index 7f5fd90..e24c31e 100755
--- a/mesonast.py
+++ b/mesonast.py
@@ -24,8 +24,9 @@
# - reindent?
import mesonbuild.astinterpreter
-
-import sys
+from mesonbuild.mesonlib import MesonException
+from mesonbuild import mlog
+import sys, traceback
if __name__ == '__main__':
if len(sys.argv) == 1:
@@ -33,4 +34,15 @@ if __name__ == '__main__':
else:
source_root = sys.argv[1]
ast = mesonbuild.astinterpreter.AstInterpreter(source_root, '')
- ast.dump()
+ try:
+ ast.dump()
+ except Exception as e:
+ if isinstance(e, MesonException):
+ if hasattr(e, 'file') and hasattr(e, 'lineno') and hasattr(e, 'colno'):
+ mlog.log(mlog.red('\nMeson encountered an error in file %s, line %d, column %d:' % (e.file, e.lineno, e.colno)))
+ else:
+ mlog.log(mlog.red('\nMeson encountered an error:'))
+ mlog.log(e)
+ else:
+ traceback.print_exc()
+ sys.exit(1)