Bug 1162826 - Display a proper error when a moz.build tries to set a "reserved keyword". r=mshal
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 08 May 2015 10:44:05 +0900
changeset 243434 3804df2cb8767956ca3f788589678aa012fd6ef2
parent 243433 18bd273a594ba40900af8a3843282bc3ae450b1b
child 243435 fbb4a7ee99905430079b3e9773626b7e38133884
push id28738
push usercbook@mozilla.com
push dateTue, 12 May 2015 14:11:31 +0000
treeherdermozilla-central@bedce1b405a3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmshal
bugs1162826
milestone40.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1162826 - Display a proper error when a moz.build tries to set a "reserved keyword". r=mshal
python/mozbuild/mozbuild/frontend/reader.py
--- a/python/mozbuild/mozbuild/frontend/reader.py
+++ b/python/mozbuild/mozbuild/frontend/reader.py
@@ -197,17 +197,18 @@ class MozbuildSandbox(Sandbox):
         if key in self.subcontext_types:
             return self._create_subcontext(self.subcontext_types[key])
         if key in self.templates:
             return self._create_template_function(self.templates[key])
         return Sandbox.__getitem__(self, key)
 
     def __setitem__(self, key, value):
         if key in self.special_variables or key in self.functions or key in self.subcontext_types:
-            raise KeyError()
+            raise KeyError('Cannot set "%s" because it is a reserved keyword'
+                           % key)
         if key in self.exports:
             self._context[key] = value
             self.exports.remove(key)
             return
         Sandbox.__setitem__(self, key, value)
 
     def exec_file(self, path):
         """Override exec_file to normalize paths and restrict file loading.