Bug 1229241 - Allow moz.build special variables to be set, as long as the value is not modified. r=gps

This will allow a new kind of special variable where it is possible to do
  FOO += ['bar']

All the current special variables are either strings (for which __setitem__ would
be called with a different string object), or a read-only dict (which doesn't
allow modifications).
This commit is contained in:
Mike Hommey 2015-11-27 21:01:28 +09:00
Родитель e5b1bb9e4e
Коммит 1c6231c29c
1 изменённых файлов: 2 добавлений и 0 удалений

Просмотреть файл

@ -219,6 +219,8 @@ class MozbuildSandbox(Sandbox):
return Sandbox.__contains__(self, key)
def __setitem__(self, key, value):
if key in self.special_variables and value is self[key]:
return
if key in self.special_variables or key in self.functions or key in self.subcontext_types:
raise KeyError('Cannot set "%s" because it is a reserved keyword'
% key)