Bug 1257823 - Remove set_define implementation for @depends functions
--- a/python/mozbuild/mozbuild/configure/__init__.py
+++ b/python/mozbuild/mozbuild/configure/__init__.py
@@ -286,21 +286,19 @@ class ConfigureSandbox(dict):
references. The decorated function is called as soon as the decorator
is called, and the arguments it receives are the OptionValue or
function results corresponding to each of the arguments to @depends.
As an exception, when a HelpFormatter is attached, only functions that
have '--help' in their @depends argument list are called.
The decorated function is altered to use a different global namespace
for its execution. This different global namespace exposes a limited
- set of functions from os.path, and two additional functions:
- `imply_option` and `set_define`. The former allows to inject
- additional options as if they had been passed on the command line.
- The latter declares new defines, stored in a DEFINES configuration
- item.
+ set of functions from os.path, and one additional functions:
+ `imply_option`. It allows to inject additional options as if they had
+ been passed on the command line.
'''
if not args:
raise ConfigureError('@depends needs at least one argument')
with_help = False
resolved_args = []
for arg in args:
if isinstance(arg, types.StringTypes):
@@ -330,17 +328,16 @@ class ConfigureSandbox(dict):
def decorator(func):
if inspect.isgeneratorfunction(func):
raise ConfigureError(
'Cannot decorate generator functions with @depends')
func, glob = self._prepare_function(func)
result = DependsOutput()
glob.update(
imply_option=result.imply_option,
- set_define=self._set_define,
)
dummy = wraps(func)(DummyFunction())
self._depends[dummy] = func
func.with_help = with_help
if with_help:
for arg in args:
if (isinstance(arg, DummyFunction) and
not self._depends[arg].with_help):
@@ -453,22 +450,16 @@ class ConfigureSandbox(dict):
`value` can be references to @depends functions, in which case the
result from these functions is used. If the result of such functions
is None, the define is not set. If the result is False, the define is
explicitly undefined (-U).
'''
defines = self._config.setdefault('DEFINES', {})
self._resolve_and_set(defines, name, value)
- def _set_define(self, name, value):
- defines = self._config.setdefault('DEFINES', {})
- if name in defines:
- raise ConfigureError("'%s' is already defined" % name)
- defines[name] = value
-
def _prepare_function(self, func):
'''Alter the given function global namespace with the common ground
for @depends, @template and @advanced.
'''
if not inspect.isfunction(func):
raise TypeError("Unexpected type: '%s'" % type(func))
if func in self._prepared_functions:
return func, func.func_globals