Bug 1293579 - Use the new `dependable` function in a few places. r=chmanchester

--HG--
extra : rebase_source : 7062361fdb8e61b43a4044a3a7b1bf04f6ef3143
This commit is contained in:
Mike Hommey 2016-08-09 15:55:10 +09:00
Родитель 3e4c324c93
Коммит 4eba7db364
8 изменённых файлов: 25 добавлений и 37 удалений

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

@ -14,9 +14,7 @@ js_option('--with-android-toolchain', nargs=1,
js_option('--with-android-gnu-compiler-version', nargs=1,
help='GNU compiler version to use')
@depends('--help')
def min_android_version(_):
return '9'
min_android_version = dependable('9')
js_option('--with-android-version',
nargs=1,

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

@ -93,7 +93,6 @@ def checking(what, callback=None):
# use that value instead.
@template
@imports(_from='mozbuild.shellutil', _import='quote')
@imports(_from='mozbuild.configure', _import='DependsFunction')
def check_prog(var, progs, what=None, input=None, allow_missing=False,
paths=None):
if input:
@ -115,10 +114,8 @@ def check_prog(var, progs, what=None, input=None, allow_missing=False,
what = what or var.lower()
# Trick to make a @depends function out of an immediate value.
if not isinstance(progs, DependsFunction):
progs = depends('--help')(lambda h: progs)
if not isinstance(paths, DependsFunction):
paths = depends('--help')(lambda h: paths)
progs = dependable(progs)
paths = dependable(paths)
@depends_if(input, progs, paths)
@checking('for %s' % what, lambda x: quote(x) if x else 'not found')

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

@ -44,7 +44,7 @@ def try_compile(includes=None, body='', language='C++', flags=None, check_msg=No
# conditional on the value of that function.
@template
def check_header(header, language='C++', flags=None, includes=None, when=None):
when = when or depends('--help')(lambda _: True)
when = when or always
if includes:
includes = includes[:]
@ -104,8 +104,7 @@ def check_and_add_gcc_warning(warning, compiler=None, when=None, check=True):
else:
compilers = (c_compiler, cxx_compiler)
if not when:
when = depends('--help')(lambda _: True)
when = when or always
for c in compilers:
assert c in (c_compiler, cxx_compiler)

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

@ -125,21 +125,18 @@ set_config('MOZCONFIG', depends(mozconfig)(lambda m: m['path']))
# Hacks related to old-configure
# ==============================
@depends('--help')
def old_configure_assignments(help):
@dependable
def old_configure_assignments():
return []
@depends('--help')
def extra_old_configure_args(help):
@dependable
def extra_old_configure_args():
return []
@template
@imports(_from='mozbuild.configure', _import='DependsFunction')
def add_old_configure_assignment(var, value):
if not isinstance(var, DependsFunction):
var = depends('--help')(lambda x: var)
if not isinstance(value, DependsFunction):
value = depends('--help')(lambda x: value)
var = dependable(var)
value = dependable(value)
@depends(old_configure_assignments, var, value)
@imports(_from='mozbuild.shellutil', _import='quote')
@ -248,9 +245,9 @@ add_old_configure_assignment('PYTHON', virtualenv_python)
# below, so collect them.
@template
def early_options():
@depends('--help')
@dependable
@imports('__sandbox__')
def early_options(help):
def early_options():
return set(
option.env
for option in __sandbox__._options.itervalues()
@ -804,8 +801,8 @@ add_old_configure_assignment('PKG_CONFIG', pkg_config)
# actual implementation is located in b2g/moz.configure.
# Remove this function as soon as 'android_ndk_include'
# depends on 'target.'
@depends('--help')
def gonkdir(_):
@dependable
def gonkdir():
return None
include(include_project_configure)

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

@ -145,8 +145,8 @@ def old_configure_options(*options):
for opt in options:
option(opt, nargs='*', help='Help missing for old configure options')
@depends('--help')
def all_options(help):
@dependable
def all_options():
return list(options)
return depends(prepare_configure, extra_old_configure_args, all_options,
@ -438,10 +438,10 @@ def post_old_configure(raw_config):
# them. We only do so for options that haven't been declared so far,
# which should be a proxy for the options that old-configure handles
# and that we don't know anything about.
@depends('--help')
@dependable
@imports('__sandbox__')
@imports(_from='mozbuild.configure.options', _import='Option')
def remaining_mozconfig_options(_):
def remaining_mozconfig_options():
helper = __sandbox__._helper
for arg in helper:
if helper._origins[arg] != 'mozconfig':

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

@ -25,14 +25,11 @@ def pkg_config_version(pkg_config):
# will be returned to the caller.
# Returns `True` when the package description is fulfilled.
@template
@imports(_from='mozbuild.configure', _import='DependsFunction')
def pkg_check_modules(var, package_desc,
condition=depends('--help')(lambda _: True),
def pkg_check_modules(var, package_desc, condition=always,
allow_missing=False):
if isinstance(package_desc, (tuple, list)):
package_desc = ' '.join(package_desc)
if not isinstance(package_desc, DependsFunction):
package_desc = depends('--help')(lambda _: package_desc)
package_desc = dependable(package_desc)
@depends_when(pkg_config, pkg_config_version, when=condition)
def check_pkg_config(pkg_config, version):

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

@ -62,8 +62,8 @@ set_config('HAVE_YASM', have_yasm)
# Until the YASM variable is not necessary in old-configure.
add_old_configure_assignment('YASM', have_yasm)
@depends('--help')
def extra_toolchain_flags(_):
@dependable
def extra_toolchain_flags():
# This value will be overriden for android builds, where
# extra flags are required to do basic checks.
return []

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

@ -102,9 +102,9 @@ include_when('build/moz.configure/headers.configure',
include_when('build/moz.configure/warnings.configure',
when='--enable-compile-environment')
@depends('--help')
@dependable
@imports(_from='mozbuild.backend', _import='backends')
def build_backends_choices(help):
def build_backends_choices():
return tuple(backends)