Bug 1446019 - Improve error message for LOCAL_INCLUDES pointing to topobjdir; r?build-peer
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
--- a/python/mozbuild/mozbuild/frontend/emitter.py
+++ b/python/mozbuild/mozbuild/frontend/emitter.py
@@ -1125,18 +1125,18 @@ class TreeMetadataEmitter(LoggingMixin):
if (not isinstance(local_include, ObjDirPath) and
not os.path.exists(full_path)):
raise SandboxValidationError('Path specified in LOCAL_INCLUDES '
'does not exist: %s (resolved to %s)' % (local_include,
full_path), context)
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
computed_flags.resolve_flags('LOCAL_INCLUDES', ['-I%s' % p for p in local_includes])
computed_as_flags.resolve_flags('LOCAL_INCLUDES', ['-I%s' % p for p in local_includes])
computed_host_flags.resolve_flags('LOCAL_INCLUDES', ['-I%s' % p for p in local_includes])
--- a/python/mozbuild/mozbuild/test/frontend/test_emitter.py
+++ b/python/mozbuild/mozbuild/test/frontend/test_emitter.py
@@ -1000,24 +1000,26 @@ class TestEmitterBasic(unittest.TestCase
self.assertEqual(local_includes, expected)
def test_local_includes_invalid(self):
"""Test that invalid LOCAL_INCLUDES are properly detected."""
reader = self.reader('local_includes-invalid/srcdir')
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):
"""Test that GENERATED_INCLUDES is emitted correctly."""
reader = self.reader('generated_includes')
objs = self.read_topsrcdir(reader)
generated_includes = [o.path for o in objs if isinstance(o, LocalInclude)]