From b78a4e45de0bafad60bc47a119eb77214e45fb5a Mon Sep 17 00:00:00 2001 From: Gregory Szorc Date: Thu, 15 Mar 2018 09:43:35 -0700 Subject: [PATCH] Bug 1446019 - Improve error message for LOCAL_INCLUDES pointing to topobjdir; r=froydnj The old message is ambiguous as to why it failed. The new one tells you why and hopefully gives you enough info to fix it. MozReview-Commit-ID: 9cBpYLpCFmt --HG-- extra : rebase_source : cf0899e8c5f5330d31c645cba27d1bd3fb19e814 --- python/mozbuild/mozbuild/frontend/emitter.py | 4 ++-- python/mozbuild/mozbuild/test/frontend/test_emitter.py | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/python/mozbuild/mozbuild/frontend/emitter.py b/python/mozbuild/mozbuild/frontend/emitter.py index 15cf218e1ba1..574d46244247 100644 --- a/python/mozbuild/mozbuild/frontend/emitter.py +++ b/python/mozbuild/mozbuild/frontend/emitter.py @@ -1135,8 +1135,8 @@ class TreeMetadataEmitter(LoggingMixin): if (full_path == context.config.topsrcdir or full_path == context.config.topobjdir): raise SandboxValidationError('Path specified in LOCAL_INCLUDES ' - 'is not allowed: %s (resolved to %s)' % (local_include, - full_path), context) + '(%s) resolves to the topsrcdir or topobjdir (%s), which is ' + 'not allowed' % (local_include, full_path), context) include_obj = LocalInclude(context, local_include) local_includes.append(include_obj.path.full_path) yield include_obj diff --git a/python/mozbuild/mozbuild/test/frontend/test_emitter.py b/python/mozbuild/mozbuild/test/frontend/test_emitter.py index ba4d0fec72b5..a6a4f0399a08 100644 --- a/python/mozbuild/mozbuild/test/frontend/test_emitter.py +++ b/python/mozbuild/mozbuild/test/frontend/test_emitter.py @@ -1041,14 +1041,16 @@ class TestEmitterBasic(unittest.TestCase): with self.assertRaisesRegexp( SandboxValidationError, - 'Path specified in LOCAL_INCLUDES is not allowed:'): + 'Path specified in LOCAL_INCLUDES.*resolves to the ' + 'topsrcdir or topobjdir'): objs = self.read_topsrcdir(reader) reader = self.reader('local_includes-invalid/objdir') with self.assertRaisesRegexp( SandboxValidationError, - 'Path specified in LOCAL_INCLUDES is not allowed:'): + 'Path specified in LOCAL_INCLUDES.*resolves to the ' + 'topsrcdir or topobjdir'): objs = self.read_topsrcdir(reader) def test_generated_includes(self):