From 946782425c85c828d2467844b1f1566f6469fa7e Mon Sep 17 00:00:00 2001 From: Tim Vieira Date: Mon, 1 Jul 2013 01:20:59 -0400 Subject: [PATCH] hide ugly filenames from users. --- src/Dyna/Backend/Python/errors.py | 1 + src/Dyna/Backend/Python/utils.py | 4 +++- test/repl/aggregator-conflict.expect | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Dyna/Backend/Python/errors.py b/src/Dyna/Backend/Python/errors.py index aed9e25..7d31fb4 100644 --- a/src/Dyna/Backend/Python/errors.py +++ b/src/Dyna/Backend/Python/errors.py @@ -11,6 +11,7 @@ class DynaCompilerError(Exception): class AggregatorError(Exception): pass + class DynaInitializerException(Exception): def __init__(self, exception, init): rule = parse_attrs(init)['rule'] diff --git a/src/Dyna/Backend/Python/utils.py b/src/Dyna/Backend/Python/utils.py index 9e96aac..75e07dc 100644 --- a/src/Dyna/Backend/Python/utils.py +++ b/src/Dyna/Backend/Python/utils.py @@ -72,10 +72,12 @@ def dynac(f, out, anf=None, compiler_args=()): stdout, stderr = p.communicate() if p.returncode: assert not stdout.strip(), [stdout, stderr] + # hide our temporary file's ugly sha1 file names from users. + ugly_file_name = dotdynadir + '[a-z0-9/.]+\.dyna\S*' + stderr = re.sub(ugly_file_name, '', stderr) raise DynaCompilerError(stderr) - def lexer(term): return re.findall('"[^"]*"' # string '|[a-z][a-zA-Z_0-9]*' # functor diff --git a/test/repl/aggregator-conflict.expect b/test/repl/aggregator-conflict.expect index a20ae70..6b34765 100644 --- a/test/repl/aggregator-conflict.expect +++ b/test/repl/aggregator-conflict.expect @@ -2,7 +2,7 @@ a => 1. > DynaCompilerError: Encountered error in input program: - Conflicting aggregators; rule /home/timv/.dyna/tmp/27792/966093dc38b755a6f17b02774b5c656931163a3a.dyna:5:1-/home/timv/.dyna/tmp/27792/966093dc38b755a6f17b02774b5c656931163a3a.dyna:5:3 + Conflicting aggregators; rule uses '|=' for a/0 but I had been lead to expect '+='. Everything was syntactically valid, but we could not see it through. -- 2.50.1