Bug 1378410 - 2a. Expose set to moz.build sandbox; r=gps

To construct an empty set, we need to use the `set()` notation. In order
to do that, we need to expose `set` to the moz.build sandbox.

MozReview-Commit-ID: DMyKnF0FEx2

--HG--
extra : rebase_source : 5cfe8080ec333a1eca70cd3edba2aaaff6406820
This commit is contained in:
Jim Chen 2017-09-01 14:02:30 -04:00
parent f0ca31be3a
commit c3c2bfc408
2 changed files with 5 additions and 4 deletions

View File

@ -34,10 +34,10 @@ The following properties make execution of ``moz.build`` files special:
files.
The limited subset of Python is actually an extremely limited subset.
Only a few symbols from ``__builtins__`` are exposed. These include
``True``, ``False``, and ``None``. Global functions like ``import``,
``print``, and ``open`` aren't available. Without these, ``moz.build``
files can do very little. *This is by design*.
Only a few symbols from ``__builtin__`` are exposed. These include
``True``, ``False``, ``None``, ``sorted``, ``int``, and ``set``. Global
functions like ``import``, ``print``, and ``open`` aren't available.
Without these, ``moz.build`` files can do very little. *This is by design*.
The execution sandbox treats all ``UPPERCASE`` variables specially. Any
``UPPERCASE`` variable must be known to the sandbox before the script

View File

@ -110,6 +110,7 @@ class Sandbox(dict):
'True': True,
'sorted': alphabetical_sorted,
'int': int,
'set': set,
})
def __init__(self, context, builtins=None, finder=default_finder):