Bug 1335666 - Remove @depends_when. r=chmanchester
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 01 Feb 2017 16:25:29 +0900
changeset 378973 35967a21613ea7f0a6aca96a4042d7a2d8fdcccf
parent 378972 1b1fc1efce0ec95e111ac3b2183abf0ba14db83a
child 378974 b68c0c1ae0459763e0090aea3af446449bc1511b
push id7198
push userjlorenzo@mozilla.com
push dateTue, 18 Apr 2017 12:07:49 +0000
treeherdermozilla-beta@d57aa49c3948 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschmanchester
bugs1335666, 1296530
milestone54.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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.
build/moz.configure/compilers-util.configure
build/moz.configure/headers.configure
build/moz.configure/pkg.configure
build/moz.configure/util.configure
js/ffi.configure
--- a/build/moz.configure/compilers-util.configure
+++ b/build/moz.configure/compilers-util.configure
@@ -38,17 +38,17 @@ def compiler_class(compiler):
 
             if check_msg:
                 def checking_fn(fn):
                     return checking(check_msg)(fn)
             else:
                 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 []
                 flags += extra_flags or []
                 flags.append('-c')
 
                 if try_invoke_compiler(
                     compiler.wrapper + [compiler.compiler] + compiler.flags,
--- a/build/moz.configure/headers.configure
+++ b/build/moz.configure/headers.configure
@@ -69,21 +69,21 @@ have_perf_event_h = check_header('linux/
                                  when=building_linux)
 
 js_option('--with-linux-headers',
           help='location where the Linux kernel headers can be found',
           nargs=1)
 
 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
 
 set_config('HAVE_LINUX_PERF_EVENT_H', have_perf_event_open)
 
 @depends(passed_linux_header_flags, have_perf_event_open)
 def linux_headers_includes(passed_linux_header_flags, have_perf_event_open):
--- a/build/moz.configure/pkg.configure
+++ b/build/moz.configure/pkg.configure
@@ -35,29 +35,29 @@ def pkg_check_modules(var, package_desc,
     if isinstance(package_desc, (tuple, list)):
         package_desc = ' '.join(package_desc)
     package_desc = dependable(package_desc)
 
     @depends(when, '--enable-compile-environment')
     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:
             die("*** The pkg-config script could not be found. Make sure it is\n"
                 "*** in your path, or set the PKG_CONFIG environment variable\n"
                 "*** to the full path to pkg-config.")
         if version < min_version:
             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')
     def package(pkg_config, package_desc):
         # package_desc may start as a depends function, so we can't use
         # @checking here.
         log.info("checking for %s... " % package_desc)
         with log.queue_debug():
@@ -69,29 +69,29 @@ def pkg_check_modules(var, package_desc,
             except subprocess.CalledProcessError as e:
                 log.info("no")
                 log_writer = log.warning if allow_missing else log.error
                 with LineIO(lambda l: log_writer(l)) as o:
                     o.write(e.output)
                 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)
 
     set_config('%s_CFLAGS' % var, pkg_cflags)
     set_config('%s_LIBS' % var, pkg_libs)
 
     return pkg_info
--- a/build/moz.configure/util.configure
+++ b/build/moz.configure/util.configure
@@ -394,36 +394,16 @@ def depends_if(*args):
     def decorator(func):
         @depends(*args)
         def wrapper(*args):
             if any(arg for arg in args):
                 return func(*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
 # ==============================
 
 @dependable
 def old_configure_assignments():
     return []
 
 @dependable
--- a/js/ffi.configure
+++ b/js/ffi.configure
@@ -21,17 +21,17 @@ system_ffi = pkg_check_modules('MOZ_FFI'
                                when=use_system_ffi)
 
 building_ffi = depends(system_ffi)(lambda v: v is None)
 
 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. '
             'Use --with-system-ffi instead.')
 
     if target.os == 'WINNT':
         target_dir = 'x86'
         if target.cpu == 'x86_64':