From c3c2bfc408b7e260da47daa79d7a7432a0fb5181 Mon Sep 17 00:00:00 2001 From: Jim Chen Date: Fri, 1 Sep 2017 14:02:30 -0400 Subject: [PATCH] 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 --- build/docs/mozbuild-files.rst | 8 ++++---- python/mozbuild/mozbuild/frontend/sandbox.py | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/build/docs/mozbuild-files.rst b/build/docs/mozbuild-files.rst index 3550c51ef939..60f3dae9a06c 100644 --- a/build/docs/mozbuild-files.rst +++ b/build/docs/mozbuild-files.rst @@ -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 diff --git a/python/mozbuild/mozbuild/frontend/sandbox.py b/python/mozbuild/mozbuild/frontend/sandbox.py index dfc69d246954..1f7f3acaf15e 100644 --- a/python/mozbuild/mozbuild/frontend/sandbox.py +++ b/python/mozbuild/mozbuild/frontend/sandbox.py @@ -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):