Bug 1692939 - Turn namespace() into a builtin in python configure. r=firefox-build-system-reviewers,mhentges

This removes the need for some --help dependencies.

Differential Revision: https://phabricator.services.mozilla.com/D105263
This commit is contained in:
Mike Hommey 2021-02-18 22:44:40 +00:00
Родитель 5e19605601
Коммит fa35a4b8c7
7 изменённых файлов: 12 добавлений и 15 удалений

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

@ -46,8 +46,8 @@ def android_sdk_root(value):
) )
@depends("--help") @dependable
def android_sdk_version(_): def android_sdk_version():
return namespace(build_tools_version="29.0.3", target_sdk_version="29") return namespace(build_tools_version="29.0.3", target_sdk_version="29")

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

@ -5,8 +5,8 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
@depends(target.os, "--help") @depends(target.os)
def arm_option_defaults(os, _): def arm_option_defaults(os):
if os == "Android": if os == "Android":
arch = "armv7-a" arch = "armv7-a"
thumb = "yes" thumb = "yes"

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

@ -10,8 +10,8 @@
option("--disable-optimize", nargs="?", help="Disable optimizations via compiler flags") option("--disable-optimize", nargs="?", help="Disable optimizations via compiler flags")
@depends("--enable-optimize", "--help") @depends("--enable-optimize")
def moz_optimize(option, _): def moz_optimize(option):
flags = None flags = None
if len(option): if len(option):

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

@ -403,12 +403,6 @@ def deprecated_option(*args, **kwargs):
return decorator return decorator
# from mozbuild.util import ReadOnlyNamespace as namespace
@imports(_from="mozbuild.util", _import="ReadOnlyNamespace")
def namespace(**kwargs):
return ReadOnlyNamespace(**kwargs)
# Turn an object into an object that can be used as an argument to @depends. # Turn an object into an object that can be used as an argument to @depends.
# The given object can be a literal value, a function that takes no argument, # The given object can be a literal value, a function that takes no argument,
# or, for convenience, a @depends function. # or, for convenience, a @depends function.

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

@ -168,8 +168,8 @@ option(
) )
@depends("--enable-jit", "--enable-simulator", target, "--help") @depends("--enable-jit", "--enable-simulator", target)
def simulator(jit_enabled, simulator_enabled, target, _): def simulator(jit_enabled, simulator_enabled, target):
if not jit_enabled or not simulator_enabled: if not jit_enabled or not simulator_enabled:
return return
@ -183,7 +183,7 @@ def simulator(jit_enabled, simulator_enabled, target, _):
if target.cpu != "x86_64": if target.cpu != "x86_64":
die("The %s simulator only works on x86-64." % sim_cpu) die("The %s simulator only works on x86-64." % sim_cpu)
return namespace(**{sim_cpu: True}) return namespace(sim_cpu=True)
set_config("JS_SIMULATOR", depends_if(simulator)(lambda x: True)) set_config("JS_SIMULATOR", depends_if(simulator)(lambda x: True))

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

@ -1258,6 +1258,7 @@ class ConfigureSandbox(dict):
__name__=self._paths[-1] if self._paths else "", __name__=self._paths[-1] if self._paths else "",
os=self.OS, os=self.OS,
log=self.log_impl, log=self.log_impl,
namespace=ReadOnlyNamespace,
) )
if update_globals: if update_globals:
update_globals(glob) update_globals(glob)

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

@ -177,6 +177,8 @@ class LintSandbox(ConfigureSandbox):
continue continue
if instr.argval in self.BUILTINS: if instr.argval in self.BUILTINS:
continue continue
if instr.argval in "namespace":
continue
return True return True
return False return False