From 9de779f50a272d9d1cf077f87b3a6643235ccc75 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Wed, 1 Feb 2017 16:25:29 +0900 Subject: [PATCH] Bug 1335666 - Remove @depends_when. r=chmanchester In bug 1296530, we made @depends take a when argument, it can now replace all uses of @depends_when. --HG-- extra : rebase_source : d090723fcbf3a56e06bd9c2defc3301cac04d8b0 --- build/moz.configure/compilers-util.configure | 2 +- build/moz.configure/headers.configure | 10 +++++----- build/moz.configure/pkg.configure | 12 ++++++------ build/moz.configure/util.configure | 20 -------------------- js/ffi.configure | 2 +- 5 files changed, 13 insertions(+), 33 deletions(-) diff --git a/build/moz.configure/compilers-util.configure b/build/moz.configure/compilers-util.configure index 32271a010d14..0d99dde47d4f 100644 --- a/build/moz.configure/compilers-util.configure +++ b/build/moz.configure/compilers-util.configure @@ -43,7 +43,7 @@ def compiler_class(compiler): def checking_fn(fn): return fn - @depends_when(self, dependable(flags), extra_toolchain_flags, when=when) + @depends(self, dependable(flags), extra_toolchain_flags, when=when) @checking_fn def func(compiler, flags, extra_flags): flags = flags or [] diff --git a/build/moz.configure/headers.configure b/build/moz.configure/headers.configure index 52ffa2f89e30..5bc2056b7dd8 100644 --- a/build/moz.configure/headers.configure +++ b/build/moz.configure/headers.configure @@ -74,11 +74,11 @@ js_option('--with-linux-headers', passed_linux_header_flags = depends_if('--with-linux-headers')(lambda v: ['-I%s' % v[0]]) -@depends_when(try_compile(includes=['asm/unistd.h'], - body='return sizeof(__NR_perf_event_open);', - flags=passed_linux_header_flags, - check_msg='for perf_event_open system call'), - when=have_perf_event_h) +@depends(try_compile(includes=['asm/unistd.h'], + body='return sizeof(__NR_perf_event_open);', + flags=passed_linux_header_flags, + check_msg='for perf_event_open system call'), + when=have_perf_event_h) def have_perf_event_open(have_perf_event_open): if have_perf_event_open: return True diff --git a/build/moz.configure/pkg.configure b/build/moz.configure/pkg.configure index 991f401ae053..258afd602861 100644 --- a/build/moz.configure/pkg.configure +++ b/build/moz.configure/pkg.configure @@ -40,8 +40,8 @@ def pkg_check_modules(var, package_desc, when=always, def when_and_compile_environment(when, compile_environment): return when and compile_environment - @depends_when(pkg_config, pkg_config_version, - when=when_and_compile_environment) + @depends(pkg_config, pkg_config_version, + when=when_and_compile_environment) def check_pkg_config(pkg_config, version): min_version = '0.9.0' if pkg_config is None: @@ -52,7 +52,7 @@ def pkg_check_modules(var, package_desc, when=always, die("*** Your version of pkg-config is too old. You need version %s or newer.", min_version) - @depends_when(pkg_config, package_desc, when=when_and_compile_environment) + @depends(pkg_config, package_desc, when=when_and_compile_environment) @imports('subprocess') @imports('sys') @imports(_from='mozbuild.configure.util', _import='LineIO') @@ -74,20 +74,20 @@ def pkg_check_modules(var, package_desc, when=always, if not allow_missing: sys.exit(1) - @depends_when(pkg_config, package_desc, when=package) + @depends(pkg_config, package_desc, when=package) @checking('%s_CFLAGS' % var, callback=lambda t: ' '.join(t)) def pkg_cflags(pkg_config, package_desc): flags = check_cmd_output(pkg_config, '--cflags', package_desc) return tuple(flags.split()) - @depends_when(pkg_config, package_desc, when=package) + @depends(pkg_config, package_desc, when=package) @checking('%s_LIBS' % var, callback=lambda t: ' '.join(t)) def pkg_libs(pkg_config, package_desc): libs = check_cmd_output(pkg_config, '--libs', package_desc) # Remove evil flags like -Wl,--export-dynamic return tuple(libs.replace('-Wl,--export-dynamic', '').split()) - @depends_when(pkg_cflags, pkg_libs, when=package) + @depends(pkg_cflags, pkg_libs, when=package) def pkg_info(cflags, libs): return namespace(cflags=cflags, libs=libs) diff --git a/build/moz.configure/util.configure b/build/moz.configure/util.configure index 852e6541916d..896d1aad2fcc 100644 --- a/build/moz.configure/util.configure +++ b/build/moz.configure/util.configure @@ -399,26 +399,6 @@ def depends_if(*args): return wrapper return decorator -# Like @depends_if, but a distinguished value passed as a keyword argument -# "when" is truth tested instead of every argument. This value is not passed -# to the function if it is called. -@template -def depends_when(*args, **kwargs): - if not len(kwargs) == 1 and kwargs.get('when'): - die('depends_when requires a single keyword argument, "when"') - when = kwargs['when'] - if not when: - return depends(*args) - - def decorator(fn): - @depends(when, *args) - def wrapper(val, *args): - if val: - return fn(*args) - return wrapper - return decorator - - # Hacks related to old-configure # ============================== diff --git a/js/ffi.configure b/js/ffi.configure index 3945529da294..d926c1b1651a 100644 --- a/js/ffi.configure +++ b/js/ffi.configure @@ -26,7 +26,7 @@ set_config('MOZ_SYSTEM_FFI', depends_if(system_ffi)(lambda _: True)) add_old_configure_assignment('MOZ_SYSTEM_FFI', depends_if(system_ffi)(lambda _: True)) # Target selection, based on ffi/configure.ac. -@depends_when(target, when=building_ffi) +@depends(target, when=building_ffi) def ffi_target(target): if target.cpu not in ('x86', 'x86_64', 'arm', 'aarch64'): die('Building libffi from the tree is not supported on this platform. '