diff --git a/build/moz.configure/.flake8 b/build/moz.configure/.flake8 deleted file mode 100644 index ba2490f17789..000000000000 --- a/build/moz.configure/.flake8 +++ /dev/null @@ -1,5 +0,0 @@ -[flake8] -# F821: undefined name -# This is the moz.configure style -ignore = F821 - diff --git a/build/moz.configure/android-ndk.configure b/build/moz.configure/android-ndk.configure index 3118014ad46e..8ebb087ded59 100644 --- a/build/moz.configure/android-ndk.configure +++ b/build/moz.configure/android-ndk.configure @@ -11,7 +11,6 @@ js_option('--with-android-ndk', nargs=1, js_option('--with-android-toolchain', nargs=1, help='location of the Android toolchain') - @depends(target) def min_android_version(target): if target.cpu in ['aarch64', 'x86_64', 'mips64']: @@ -19,13 +18,11 @@ def min_android_version(target): return '21' return '9' - js_option('--with-android-version', nargs=1, help='android platform version', default=min_android_version) - @depends('--with-android-version', min_android_version, '--help') @imports(_from='__builtin__', _import='ValueError') def android_version(value, min_version, _): @@ -44,10 +41,8 @@ def android_version(value, min_version, _): return version - add_old_configure_assignment('android_version', android_version) - @depends('--with-android-ndk', build_project, '--help') def ndk(value, build_project, help): if help: @@ -58,11 +53,9 @@ def ndk(value, build_project, help): if value: return value[0] - set_config('ANDROID_NDK', ndk) add_old_configure_assignment('android_ndk', ndk) - @depends(ndk) @checking('for android ndk version') @imports(_from='__builtin__', _import='open') @@ -80,7 +73,6 @@ def ndk_version(ndk): die('Unexpected Pkg.Revision line in source.properties') die('Cannot determine NDK version from source.properties') - @depends(ndk_version) def ndk_major_version(ndk_version): if not ndk_version: @@ -91,9 +83,7 @@ def ndk_major_version(ndk_version): return major die('Unexpected NDK version string: ' + ndk_version) - -set_config('ANDROID_NDK_MAJOR_VERSION', ndk_major_version) - +set_config('ANDROID_NDK_MAJOR_VERSION', ndk_major_version); @depends(ndk_version) def ndk_minor_version(ndk_version): @@ -105,9 +95,7 @@ def ndk_minor_version(ndk_version): return minor die('Unexpected NDK version string: ' + ndk_version) - -set_config('ANDROID_NDK_MINOR_VERSION', ndk_minor_version) - +set_config('ANDROID_NDK_MINOR_VERSION', ndk_minor_version); @depends(target, android_version, ndk, '--help') @checking('for android platform directory') @@ -143,10 +131,8 @@ def android_platform(target, android_version, ndk, _): return platform_dir - add_old_configure_assignment('android_platform', android_platform) - @depends(android_platform) def extra_toolchain_flags(platform_dir): if not platform_dir: @@ -154,7 +140,6 @@ def extra_toolchain_flags(platform_dir): return ['-idirafter', os.path.join(platform_dir, 'usr', 'include')] - @depends(target, host, ndk, '--with-android-toolchain', '--help') @checking('for the Android toolchain directory', lambda x: x or 'not found') @imports(_from='os.path', _import='isdir') @@ -190,10 +175,8 @@ def android_toolchain(target, host, ndk, toolchain, _): die('You have to specify --with-android-toolchain=' '/path/to/ndk/toolchain.') - set_config('ANDROID_TOOLCHAIN', android_toolchain) - @depends(target) def android_toolchain_prefix_base(target): if target.cpu == 'x86': @@ -202,13 +185,11 @@ def android_toolchain_prefix_base(target): return 'i686-linux-android' return target.toolchain - @depends(android_toolchain_prefix_base, android_toolchain) def android_toolchain_prefix(prefix_base, toolchain): if toolchain: return '%s/bin/%s-' % (toolchain, prefix_base) - imply_option('--with-toolchain-prefix', android_toolchain_prefix, reason='--with-android-ndk') @@ -216,7 +197,6 @@ option(env='STLPORT_CPPFLAGS', nargs=1, help='Options compiler should pass for standard C++ library') - @depends('STLPORT_CPPFLAGS', ndk, '--help') @imports(_from='os.path', _import='isdir') def stlport_cppflags(value, ndk, _): @@ -251,10 +231,8 @@ def stlport_cppflags(value, ndk, _): 'support', 'include'), cxxabi_include) - add_old_configure_assignment('stlport_cppflags', stlport_cppflags) - @depends(stlport_cppflags, android_platform, android_toolchain, android_toolchain_prefix_base, '--help') def bindgen_cflags_defaults(stlport_cppflags, android_platform, toolchain, @@ -262,8 +240,7 @@ def bindgen_cflags_defaults(stlport_cppflags, android_platform, toolchain, if not stlport_cppflags: return - gcc_include = os.path.join( - toolchain, 'lib', 'gcc', toolchain_prefix, '4.9') + gcc_include = os.path.join(toolchain, 'lib', 'gcc', toolchain_prefix, '4.9') cflags_format = "%s -isystem %s -gcc-toolchain %s -I%s -I%s" return cflags_format % (stlport_cppflags, diff --git a/build/moz.configure/checks.configure b/build/moz.configure/checks.configure index dc140a42058b..7e5c237fd682 100644 --- a/build/moz.configure/checks.configure +++ b/build/moz.configure/checks.configure @@ -11,8 +11,6 @@ # lot of them, let's stack them all here. When adding a new one, put it in the # _declare_exceptions template, and add it to the return statement. Then # destructure in the assignment below the function declaration. - - @template @imports(_from='__builtin__', _import='Exception') def _declare_exceptions(): @@ -23,7 +21,6 @@ def _declare_exceptions(): printed out.''' return (FatalCheckError,) - (FatalCheckError,) = _declare_exceptions() del _declare_exceptions @@ -45,8 +42,6 @@ del _declare_exceptions # ... # An optional callback can be given, that will be used to format the returned # value when displaying it. - - @template def checking(what, callback=None): def decorator(func): diff --git a/build/moz.configure/compile-checks.configure b/build/moz.configure/compile-checks.configure index c50914c33bd3..8ea4538d97a7 100644 --- a/build/moz.configure/compile-checks.configure +++ b/build/moz.configure/compile-checks.configure @@ -68,8 +68,6 @@ def check_header(header, language='C++', flags=None, includes=None, when=None): # provided headers. # - `headers` are the headers to be checked. # - `kwargs` are keyword arguments passed verbatim to check_header. - - @template def check_headers(*headers, **kwargs): checks = [] @@ -82,7 +80,6 @@ def check_headers(*headers, **kwargs): def warnings_cflags(): return [] - @dependable def warnings_cxxflags(): return [] @@ -152,8 +149,6 @@ def check_and_add_gcc_warning(warning, compiler=None, when=None, check=True): # is added for both compilers. # - `when` (optional) is a @depends function or option name conditioning # when the warning flag is wanted. - - @template def add_gcc_warning(warning, compiler=None, when=None): check_and_add_gcc_warning(warning, compiler, when, check=False) diff --git a/build/moz.configure/compilers-util.configure b/build/moz.configure/compilers-util.configure index 621a2afd8f5b..0213ceb71250 100644 --- a/build/moz.configure/compilers-util.configure +++ b/build/moz.configure/compilers-util.configure @@ -4,7 +4,6 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. - @template @imports('textwrap') @imports(_from='mozbuild.configure', _import='SandboxDependsFunction') @@ -55,10 +54,9 @@ def compiler_class(compiler, host_or_target): flags.append('-c') if try_invoke_compiler( - compiler.wrapper + - [compiler.compiler] + compiler.flags, - compiler.language, source, flags, - onerror=onerror) is not None: + compiler.wrapper + [compiler.compiler] + compiler.flags, + compiler.language, source, flags, + onerror=onerror) is not None: return True return func diff --git a/build/moz.configure/headers.configure b/build/moz.configure/headers.configure index c778d78d9789..5bc2056b7dd8 100644 --- a/build/moz.configure/headers.configure +++ b/build/moz.configure/headers.configure @@ -72,9 +72,7 @@ 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]]) - +passed_linux_header_flags = depends_if('--with-linux-headers')(lambda v: ['-I%s' % v[0]]) @depends(try_compile(includes=['asm/unistd.h'], body='return sizeof(__NR_perf_event_open);', @@ -85,14 +83,11 @@ 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): if have_perf_event_open and passed_linux_header_flags: return passed_linux_header_flags[0] - set_config('LINUX_HEADERS_INCLUDES', linux_headers_includes) diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.configure index cc892f04374e..7337eafe33b5 100644 --- a/build/moz.configure/init.configure +++ b/build/moz.configure/init.configure @@ -11,8 +11,6 @@ option(env='DIST', nargs=1, help='DIST directory') # Do not allow objdir == srcdir builds. # ============================================================== - - @depends('--help', 'DIST') @imports(_from='os.path', _import='exists') def check_build_environment(help, dist): @@ -44,7 +42,7 @@ def check_build_environment(help, dist): ' * If you are building with a mozconfig, you will need to change your\n' ' * mozconfig to point to a different object directory.\n' ' ***' - ) + ) # Check for a couple representative files in the source tree conflict_files = [ @@ -63,11 +61,10 @@ def check_build_environment(help, dist): ' * 2. gmake distclean\n' ' ***' % ('\n '.join(conflict_files), topsrcdir) - ) + ) return result - set_config('TOPSRCDIR', check_build_environment.topsrcdir) set_config('TOPOBJDIR', check_build_environment.topobjdir) set_config('MOZ_BUILD_ROOT', check_build_environment.topobjdir) @@ -94,13 +91,11 @@ option(env='MOZCONFIG', nargs=1, help='Mozconfig location') option('--with-external-source-dir', env='EXTERNAL_SOURCE_DIR', nargs=1, help='External directory containing additional build files') - @depends('--with-external-source-dir') def external_source_dir(value): if value: return value[0] - set_config('EXTERNAL_SOURCE_DIR', external_source_dir) add_old_configure_assignment('EXTERNAL_SOURCE_DIR', external_source_dir) @@ -109,8 +104,6 @@ add_old_configure_assignment('EXTERNAL_SOURCE_DIR', external_source_dir) # Note: the dependency on --help is only there to always read the mozconfig, # even when --help is passed. Without this dependency, the function wouldn't # be called when --help is passed, and the mozconfig wouldn't be read. - - @depends('MOZ_CURRENT_PROJECT', 'MOZCONFIG', 'OLD_CONFIGURE', check_build_environment, '--with-external-source-dir', '--help') @@ -150,7 +143,6 @@ def mozconfig(current_project, mozconfig, old_configure, build_env, return mozconfig - set_config('MOZCONFIG', depends(mozconfig)(lambda m: m['path'])) @@ -158,8 +150,6 @@ option(env='PYTHON', nargs=1, help='Python interpreter') # Setup python virtualenv # ============================================================== - - @depends('PYTHON', check_build_environment, mozconfig, '--help') @imports('os') @imports('sys') @@ -203,8 +193,7 @@ def virtualenv_python(env_python, build_env, mozconfig, help): # If we're not in the virtualenv, we need the which module for # find_program. if normsep(sys.executable) != normsep(manager.python_path): - sys.path.append(os.path.join( - topsrcdir, 'third_party', 'python', 'which')) + sys.path.append(os.path.join(topsrcdir, 'third_party', 'python', 'which')) found_python = find_program(python) if not found_python: die('The PYTHON environment variable does not contain ' @@ -233,7 +222,6 @@ def virtualenv_python(env_python, build_env, mozconfig, help): return python - set_config('PYTHON', virtualenv_python) add_old_configure_assignment('PYTHON', virtualenv_python) @@ -241,8 +229,6 @@ add_old_configure_assignment('PYTHON', virtualenv_python) # ============================================================== # All options defined above this point can't be injected in mozconfig_options # below, so collect them. - - @template def early_options(): @dependable @@ -255,10 +241,8 @@ def early_options(): ) return early_options - early_options = early_options() - @depends(mozconfig, 'MOZ_AUTOMATION', '--help') # This gives access to the sandbox. Don't copy this blindly. @imports('__sandbox__') @@ -309,8 +293,6 @@ option(env='CONFIG_SHELL', nargs=1, help='Path to a POSIX shell') # It feels dirty replicating this from python/mozbuild/mozbuild/mozconfig.py, # but the end goal being that the configure script would go away... - - @depends('CONFIG_SHELL', 'MOZILLABUILD') @checking('for a shell') @imports('sys') @@ -330,7 +312,6 @@ def shell(value, mozillabuild): option(env='PYTHON3', nargs=1, help='Python 3 interpreter (3.5 or later)') - @depends('PYTHON3') @checking('for Python 3', callback=lambda x: '%s (%s)' % (x.path, x.str_version) if x else 'no') @@ -367,14 +348,12 @@ def python3(env_python): str_version='.'.join(str(v) for v in version), ) - set_config('PYTHON3', depends_if(python3)(lambda p: p.path)) set_config('PYTHON3_VERSION', depends_if(python3)(lambda p: p.str_version)) # Source checkout and version control integration. # ================================================ - @depends(check_build_environment, 'MOZ_AUTOMATION', '--help') @checking('for vcs source checkout') @imports('os') @@ -390,14 +369,12 @@ def vcs_checkout_type(build_env, automation, _): # Resolve VCS binary for detected repository type. - # TODO remove hg.exe once bug 1382940 addresses ambiguous executables case. hg = check_prog('HG', ('hg.exe', 'hg',), allow_missing=True, when=depends(vcs_checkout_type)(lambda x: x == 'hg')) git = check_prog('GIT', ('git',), allow_missing=True, when=depends(vcs_checkout_type)(lambda x: x == 'git')) - @depends_if(hg) @checking('for Mercurial version') @imports('os') @@ -413,8 +390,7 @@ def hg_version(hg): match = re.search(r'Mercurial Distributed SCM \(version ([^\)]+)', out) if not match: - raise FatalCheckError( - 'unable to determine Mercurial version: %s' % out) + raise FatalCheckError('unable to determine Mercurial version: %s' % out) # The version string may be "unknown" for Mercurial run out of its own # source checkout or for bad builds. But LooseVersion handles it. @@ -424,8 +400,6 @@ def hg_version(hg): # Resolve Mercurial config items so other checks have easy access. # Do NOT set this in the config because it may contain sensitive data # like API keys. - - @depends_all(check_build_environment, hg, hg_version) @imports('os') def hg_config(build_env, hg, version): @@ -456,7 +430,6 @@ def hg_config(build_env, hg, version): return config - @depends_if(git) @checking('for Git version') @imports('re') @@ -473,8 +446,6 @@ def git_version(git): # Only set VCS_CHECKOUT_TYPE if we resolved the VCS binary. # Require resolved VCS info when running in automation so automation's # environment is more well-defined. - - @depends(vcs_checkout_type, hg_version, git_version, 'MOZ_AUTOMATION') def exposed_vcs_checkout_type(vcs_checkout_type, hg, git, automation): if vcs_checkout_type == 'hg': @@ -493,12 +464,9 @@ def exposed_vcs_checkout_type(vcs_checkout_type, hg, git, automation): elif vcs_checkout_type: raise FatalCheckError('unhandled VCS type: %s' % vcs_checkout_type) - set_config('VCS_CHECKOUT_TYPE', exposed_vcs_checkout_type) # Obtain a Repository interface for the current VCS repository. - - @depends(check_build_environment, exposed_vcs_checkout_type, hg, git) @imports(_from='mozversioncontrol', _import='get_repository_object') def vcs_repository(build_env, vcs_checkout_type, hg, git): @@ -509,13 +477,11 @@ def vcs_repository(build_env, vcs_checkout_type, hg, git): elif vcs_checkout_type: raise FatalCheckError('unhandled VCS type: %s' % vcs_checkout_type) - @depends_if(vcs_repository) @checking('for sparse checkout') def vcs_sparse_checkout(repo): return repo.sparse_checkout_present() - set_config('VCS_SPARSE_CHECKOUT', vcs_sparse_checkout) # Host and target systems @@ -526,7 +492,6 @@ option('--target', nargs=1, help='Define the system type where the resulting executables will be ' 'used') - @imports(_from='mozbuild.configure.constants', _import='CPU') @imports(_from='mozbuild.configure.constants', _import='CPU_bitness') @imports(_from='mozbuild.configure.constants', _import='Endianness') @@ -699,7 +664,6 @@ def host(value, shell): return split_triplet(config_sub(shell, host)) - host = help_host_target | host @@ -710,7 +674,6 @@ def target(value, host, shell): return host return split_triplet(config_sub(shell, value[0])) - target = help_host_target | target @@ -719,7 +682,6 @@ target = help_host_target | target def cross_compiling(host, target): return host != target - set_config('CROSS_COMPILE', cross_compiling) set_define('CROSS_COMPILE', cross_compiling) add_old_configure_assignment('CROSS_COMPILE', cross_compiling) @@ -730,32 +692,25 @@ def have_64_bit(target): if target.bitness == 64: return True - set_config('HAVE_64BIT_BUILD', have_64_bit) set_define('HAVE_64BIT_BUILD', have_64_bit) add_old_configure_assignment('HAVE_64BIT_BUILD', have_64_bit) - @depends(host) def host_os_kernel_major_version(host): versions = host.raw_os.split('.') version = ''.join(x for x in versions[0] if x.isdigit()) return version - set_config('HOST_MAJOR_VERSION', host_os_kernel_major_version) # Autoconf needs these set - - @depends(host) def host_for_old_configure(host): return '--host=%s' % host.alias - add_old_configure_arg(host_for_old_configure) - @depends(target) def target_for_old_configure(target): target_alias = target.alias @@ -765,7 +720,6 @@ def target_for_old_configure(target): target_alias = target_alias.replace('-ios', '-darwin') return '--target=%s' % target_alias - add_old_configure_arg(target_for_old_configure) @@ -796,7 +750,6 @@ def target_variables(target): INTEL_ARCHITECTURE=target.cpu in ('x86', 'x86_64') or None, ) - set_config('OS_TARGET', target_variables.OS_TARGET) add_old_configure_assignment('OS_TARGET', target_variables.OS_TARGET) @@ -823,76 +776,61 @@ def host_variables(host): HOST_OS_ARCH=os_arch, ) - set_config('HOST_CPU_ARCH', host.cpu) set_config('HOST_OS_ARCH', host_variables.HOST_OS_ARCH) add_old_configure_assignment('HOST_OS_ARCH', host_variables.HOST_OS_ARCH) - @depends(target) def target_is_windows(target): if target.kernel == 'WINNT': return True - set_define('_WINDOWS', target_is_windows) set_define('WIN32', target_is_windows) set_define('XP_WIN', target_is_windows) set_define('XP_WIN32', target_is_windows) - @depends(target) def target_is_unix(target): if target.kernel != 'WINNT': return True - set_define('XP_UNIX', target_is_unix) - @depends(target) def target_is_darwin(target): if target.kernel == 'Darwin': return True - set_define('XP_DARWIN', target_is_darwin) - @depends(target) def target_is_ios(target): if target.kernel == 'Darwin' and target.os == 'iOS': return True - set_define('XP_IOS', target_is_ios) - @depends(target) def target_is_osx(target): if target.kernel == 'Darwin' and target.os == 'OSX': return True - set_define('XP_MACOSX', target_is_osx) - @depends(target) def target_is_linux(target): if target.kernel == 'Linux': return True - set_define('XP_LINUX', target_is_linux) - @depends(target) def target_is_solaris(target): if target.kernel == 'SunOS': return True - set_define('XP_SOLARIS', target_is_solaris) # The application/project to build @@ -900,13 +838,11 @@ set_define('XP_SOLARIS', target_is_solaris) option('--enable-application', nargs=1, env='MOZ_BUILD_APP', help='Application to build. Same as --enable-project.') - @depends('--enable-application', '--help') def application(app, help): if app: return app - imply_option('--enable-project', application) @@ -916,11 +852,9 @@ def default_project(build_env, help): return 'js' return 'browser' - option('--enable-project', nargs=1, default=default_project, help='Project to build') - @depends('--enable-project', '--with-external-source-dir', check_build_environment, '--help') @imports(_from='os.path', _import='exists') @@ -944,7 +878,6 @@ def build_project(include_project_configure, build_env, help): build_env.topsrcdir)) return ret - set_config('MOZ_BUILD_APP', build_project) set_define('MOZ_BUILD_APP', build_project) add_old_configure_assignment('MOZ_BUILD_APP', build_project) @@ -975,7 +908,6 @@ def milestone(build_env, _): is_nightly=is_nightly, is_release_or_beta=is_release_or_beta) - set_config('GRE_MILESTONE', milestone.version) set_config('NIGHTLY_BUILD', milestone.is_nightly) set_define('NIGHTLY_BUILD', milestone.is_nightly) @@ -993,14 +925,12 @@ option('--enable-update-channel', help='Select application update channel', default='default') - @depends('--enable-update-channel') def update_channel(channel): if channel[0] == '': return 'default' return channel[0].lower() - set_config('MOZ_UPDATE_CHANNEL', update_channel) set_define('MOZ_UPDATE_CHANNEL', update_channel) add_old_configure_assignment('MOZ_UPDATE_CHANNEL', update_channel) @@ -1019,8 +949,7 @@ def project_flag(env=None, set_for_old_configure=False, set_as_define=False, **kwargs): if not env: - configure_error( - "A project_flag must be passed a variable name to set.") + configure_error("A project_flag must be passed a variable name to set.") opt = option(env=env, possible_origins=('implied',), **kwargs) @@ -1038,16 +967,12 @@ def project_flag(env=None, set_for_old_configure=False, add_old_configure_assignment(env, option_implementation) # milestone.is_nightly corresponds to cases NIGHTLY_BUILD is set. - - @depends(milestone, '--help') def enabled_in_nightly(milestone, _): return milestone.is_nightly # Set the MOZ_CONFIGURE_OPTIONS variable with all the options that # were passed somehow (environment, command line, mozconfig) - - @dependable @imports(_from='mozbuild.shellutil', _import='quote') @imports('__sandbox__') @@ -1079,7 +1004,6 @@ def all_configure_options(): return quote(*result) - set_config('MOZ_CONFIGURE_OPTIONS', all_configure_options) diff --git a/build/moz.configure/java.configure b/build/moz.configure/java.configure index 16b7918c2bed..4e42903a4e68 100644 --- a/build/moz.configure/java.configure +++ b/build/moz.configure/java.configure @@ -10,7 +10,6 @@ option('--with-java-bin-path', nargs=1, help='Location of Java binaries (java, javac, jar)') - @depends('--with-java-bin-path') @imports(_from='os', _import='environ') def java_search_paths(path): @@ -26,8 +25,6 @@ def java_search_paths(path): # Finds the given java tool, failing with a custom error message if we can't # find it. - - @template def check_java_tool(tool): check = check_prog(tool.upper(), (tool,), paths=java_search_paths, @@ -43,7 +40,6 @@ def check_java_tool(tool): return require_tool - check_java_tool('java') check_java_tool('javah') check_java_tool('jar') @@ -51,7 +47,6 @@ check_java_tool('jarsigner') check_java_tool('keytool') javac = check_java_tool('javac') - @depends(javac) @checking('for javac version') @imports('subprocess') diff --git a/build/moz.configure/keyfiles.configure b/build/moz.configure/keyfiles.configure index 5d51cccea280..d4135aeded19 100644 --- a/build/moz.configure/keyfiles.configure +++ b/build/moz.configure/keyfiles.configure @@ -59,6 +59,7 @@ def id_and_secret_keyfile(desc, default=None): default=default, callback=id_and_secret) + name = desc.upper().replace(' ', '_') set_config('MOZ_%s_CLIENTID' % name, content.id) set_config('MOZ_%s_KEY' % name, content.secret) diff --git a/build/moz.configure/memory.configure b/build/moz.configure/memory.configure index 94ddb86c8797..05452ed20017 100644 --- a/build/moz.configure/memory.configure +++ b/build/moz.configure/memory.configure @@ -13,7 +13,6 @@ def moz_jemalloc4(value): option('--enable-jemalloc', env='MOZ_MEMORY', help='Replace memory allocator with jemalloc') - @depends('--enable-jemalloc', target, build_project, c_compiler) def jemalloc(value, target, build_project, c_compiler): if value.origin != 'default': @@ -49,14 +48,12 @@ add_old_configure_assignment('MOZ_MEMORY', jemalloc) def jemalloc_for_old_configure(jemalloc): return '--%s-jemalloc' % ('enable' if jemalloc else 'disable') - add_old_configure_arg(jemalloc_for_old_configure) option('--enable-replace-malloc', help='Enable ability to dynamically replace the malloc implementation') - @depends('--enable-replace-malloc', jemalloc, milestone, build_project) def replace_malloc(value, jemalloc, milestone, build_project): # Enable on central for the debugging opportunities it adds. @@ -67,7 +64,6 @@ def replace_malloc(value, jemalloc, milestone, build_project): if milestone.is_nightly and jemalloc and build_project != 'js': return True - set_config('MOZ_REPLACE_MALLOC', replace_malloc) set_define('MOZ_REPLACE_MALLOC', replace_malloc) add_old_configure_assignment('MOZ_REPLACE_MALLOC', replace_malloc) diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configure index 533e4fd1e2f5..ac74ca254f57 100644 --- a/build/moz.configure/old.configure +++ b/build/moz.configure/old.configure @@ -4,7 +4,6 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. - @imports('codecs') @imports('sys') def encoded_open(path, mode): @@ -14,7 +13,6 @@ def encoded_open(path, mode): option(env='AUTOCONF', nargs=1, help='Path to autoconf 2.13') - @depends(mozconfig, 'AUTOCONF') @checking('for autoconf') @imports(_from='os.path', _import='exists') @@ -58,7 +56,6 @@ def autoconf(mozconfig, autoconf): return autoconf - set_config('AUTOCONF', autoconf) @@ -120,7 +117,6 @@ def prepare_configure(old_configure, mozconfig, autoconf, build_env, shell, cmd = [shell, old_configure] with encoded_open('old-configure.vars', 'w') as out: log.debug('Injecting the following to old-configure:') - def inject(command): print(command, file=out) log.debug('| %s', command) @@ -364,7 +360,7 @@ def old_configure(prepare_configure, extra_old_configure_args, all_options, # Every variation of the exec() function I tried led to: # SyntaxError: unqualified exec is not allowed in function 'main' it # contains a nested function with free variables - exec code in raw_config # noqa + exec code in raw_config # Ensure all the flags known to old-configure appear in the # @old_configure_options above. @@ -388,8 +384,6 @@ def set_old_configure_config(name, value): __sandbox__.set_config_impl(name, value) # Same as set_old_configure_config, but for set_define. - - @imports('__sandbox__') def set_old_configure_define(name, value): __sandbox__.set_define_impl(name, value) diff --git a/build/moz.configure/pkg.configure b/build/moz.configure/pkg.configure index 000514860336..258afd602861 100644 --- a/build/moz.configure/pkg.configure +++ b/build/moz.configure/pkg.configure @@ -4,16 +4,13 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. - @depends('--enable-compile-environment') def pkg_config(compile_env): if compile_env: return ('pkg-config',) - pkg_config = check_prog('PKG_CONFIG', pkg_config, allow_missing=True) - @depends_if(pkg_config) @checking('for pkg-config version') @imports('subprocess') @@ -32,8 +29,6 @@ def pkg_config_version(pkg_config): # will not result in an error or logged message, and any error message # will be returned to the caller. # Returns `True` when the package description is fulfilled. - - @template def pkg_check_modules(var, package_desc, when=always, allow_missing=False): diff --git a/build/moz.configure/rust.configure b/build/moz.configure/rust.configure index 36b14c05e96a..431ff5779a27 100644 --- a/build/moz.configure/rust.configure +++ b/build/moz.configure/rust.configure @@ -9,7 +9,6 @@ rustc = check_prog('RUSTC', ['rustc'], allow_missing=True) cargo = check_prog('CARGO', ['cargo'], allow_missing=True) - @depends_if(rustc) @checking('rustc version', lambda info: info.version) def rustc_info(rustc): @@ -20,7 +19,6 @@ def rustc_info(rustc): commit=info.get('commit-hash', 'unknown'), ) - @depends_if(cargo) @checking('cargo version', lambda info: info.version) @imports('re') @@ -45,7 +43,6 @@ def cargo_info(cargo): version=Version(version), ) - @depends(rustc_info, cargo_info) @imports(_from='textwrap', _import='dedent') def rust_compiler(rustc_info, cargo_info): @@ -176,8 +173,7 @@ def rust_triple_alias(host_or_target): (host_or_target.cpu, host_or_target_raw_os)) if rustc_target is None: - die("Don't know how to translate {} for rustc".format( - host_or_target.alias)) + die("Don't know how to translate {} for rustc".format(host_or_target.alias)) # Check to see whether our rustc has a reasonably functional stdlib # for our chosen target. @@ -201,7 +197,6 @@ def rust_triple_alias(host_or_target): '-o', out_path, in_path, ] - def failed(): die(dedent('''\ Cannot compile for {} with {} @@ -222,18 +217,15 @@ def rust_triple_alias(host_or_target): return rust_target - rust_target_triple = rust_triple_alias(target) rust_host_triple = rust_triple_alias(host) set_config('RUST_TARGET', rust_target_triple) set_config('RUST_HOST_TARGET', rust_host_triple) - @depends(rust_target_triple) def rust_target_env_name(triple): - return triple.upper().replace('-', '_') - + return triple.upper().replace('-','_') # We need this to form various Cargo environment variables, as there is no # uppercase function in make, and we don't want to shell out just for diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure index 4c77388a94b4..8de1009ef839 100755 --- a/build/moz.configure/toolchain.configure +++ b/build/moz.configure/toolchain.configure @@ -15,7 +15,6 @@ add_old_configure_assignment('MOZ_PGO', depends('MOZ_PGO')(lambda x: bool(x))) # ============================================================== yasm = check_prog('YASM', ['yasm'], allow_missing=True) - @depends_if(yasm) @checking('yasm version') def yasm_version(yasm): @@ -25,7 +24,6 @@ def yasm_version(yasm): ).splitlines()[0].split()[1] return Version(version) - # Until we move all the yasm consumers out of old-configure. # bug 1257904 add_old_configure_assignment('_YASM_MAJOR_VERSION', @@ -33,7 +31,6 @@ add_old_configure_assignment('_YASM_MAJOR_VERSION', add_old_configure_assignment('_YASM_MINOR_VERSION', yasm_version.minor) - @depends(yasm, target) def yasm_asflags(yasm, target): if yasm: @@ -54,16 +51,13 @@ def yasm_asflags(yasm, target): asflags += ' -rnasm -pnasm' return asflags - set_config('YASM_ASFLAGS', yasm_asflags) - @depends(yasm_asflags) def have_yasm(value): if value: return True - set_config('HAVE_YASM', have_yasm) # Until the YASM variable is not necessary in old-configure. add_old_configure_assignment('YASM', have_yasm) @@ -71,12 +65,10 @@ add_old_configure_assignment('YASM', have_yasm) # Android NDK # ============================================================== - @depends('--disable-compile-environment', build_project, '--help') def compiling_android(compile_env, build_project, _): return compile_env and build_project in ('mobile/android', 'js') - include('android-ndk.configure', when=compiling_android) # MacOS deployment target version @@ -86,7 +78,6 @@ include('android-ndk.configure', when=compiling_android) option('--enable-macos-target', env='MACOSX_DEPLOYMENT_TARGET', nargs=1, default='10.7', help='Set the minimum MacOS version needed at runtime') - @depends('--enable-macos-target', target) @imports(_from='os', _import='environ') def macos_target(value, target): @@ -106,8 +97,7 @@ add_old_configure_assignment('MACOSX_DEPLOYMENT_TARGET', macos_target) # =========== js_option('--disable-xcode-checks', - help='Do not check that Xcode is installed and properly configured') - + help='Do not check that Xcode is installed and properly configured') @depends(host, '--disable-xcode-checks') def xcode_path(host, xcode_checks): @@ -137,13 +127,12 @@ def xcode_path(host, xcode_checks): 'Xcode Command Line Tools installed, ' 'add the --disable-xcode-checks configure flag') - check_cmd_output('pkgutil', '--pkg-info', - 'com.apple.pkg.CLTools_Executables', - onerror=no_cltools) + res = check_cmd_output('pkgutil', '--pkg-info', + 'com.apple.pkg.CLTools_Executables', + onerror=no_cltools) return xcode_path - set_config('XCODE_PATH', xcode_path) @@ -159,7 +148,6 @@ option('--with-compiler-wrapper', env='COMPILER_WRAPPER', nargs=1, option('--with-ccache', env='CCACHE', nargs='?', help='Enable compiling with ccache') - @depends_if('--with-ccache') def ccache(value): if len(value): @@ -168,42 +156,32 @@ def ccache(value): # 'ccache'. return 'ccache' - ccache = check_prog('CCACHE', progs=(), input=ccache) # Distinguish ccache from sccache. - - @depends_if(ccache) def ccache_is_sccache(ccache): return check_cmd_output(ccache, '--version').startswith('sccache') - @depends(ccache, ccache_is_sccache) def using_ccache(ccache, ccache_is_sccache): return ccache and not ccache_is_sccache - @depends_if(ccache, ccache_is_sccache) def using_sccache(ccache, ccache_is_sccache): return ccache and ccache_is_sccache - set_config('MOZ_USING_CCACHE', using_ccache) set_config('MOZ_USING_SCCACHE', using_sccache) -option(env='SCCACHE_VERBOSE_STATS', - help='Print verbose sccache stats after build') - +option(env='SCCACHE_VERBOSE_STATS', help='Print verbose sccache stats after build') @depends(using_sccache, 'SCCACHE_VERBOSE_STATS') def sccache_verbose_stats(using_sccache, verbose_stats): return using_sccache and bool(verbose_stats) - set_config('SCCACHE_VERBOSE_STATS', sccache_verbose_stats) - @depends('--with-compiler-wrapper', ccache) @imports(_from='mozbuild.shellutil', _import='split', _as='shell_split') def compiler_wrapper(wrapper, ccache): @@ -224,15 +202,12 @@ def compiler_wrapper(wrapper, ccache): elif wrapper: return tuple(wrapper) - add_old_configure_assignment('COMPILER_WRAPPER', compiler_wrapper) - @depends_if(compiler_wrapper) def using_compiler_wrapper(compiler_wrapper): return True - set_config('MOZ_USING_COMPILER_WRAPPER', using_compiler_wrapper) @@ -240,13 +215,11 @@ set_config('MOZ_USING_COMPILER_WRAPPER', using_compiler_wrapper) # ============================================================== option(env='MOZ_HAZARD', help='Build for the GC rooting hazard analysis') - @depends('MOZ_HAZARD') def hazard_analysis(value): if value: return True - set_config('MOZ_HAZARD', hazard_analysis) @@ -255,7 +228,6 @@ set_config('MOZ_HAZARD', hazard_analysis) js_option('--with-toolchain-prefix', env='TOOLCHAIN_PREFIX', nargs=1, help='Prefix for the target toolchain') - @depends('--with-toolchain-prefix', target, cross_compiling) def toolchain_prefix(value, target, cross_compiling): if value: @@ -263,7 +235,6 @@ def toolchain_prefix(value, target, cross_compiling): if cross_compiling: return ('%s-' % target.toolchain, '%s-' % target.alias) - @depends(toolchain_prefix, target) def first_toolchain_prefix(toolchain_prefix, target): # Pass TOOLCHAIN_PREFIX down to the build system if it was given from the @@ -272,7 +243,6 @@ def first_toolchain_prefix(toolchain_prefix, target): if toolchain_prefix and (target.os == 'Android' or len(toolchain_prefix) == 1): return toolchain_prefix[0] - set_config('TOOLCHAIN_PREFIX', first_toolchain_prefix) add_old_configure_assignment('TOOLCHAIN_PREFIX', first_toolchain_prefix) @@ -281,11 +251,9 @@ add_old_configure_assignment('TOOLCHAIN_PREFIX', first_toolchain_prefix) # ============================================================== include('compilers-util.configure') - def try_preprocess(compiler, language, source): return try_invoke_compiler(compiler, language, source, ['-E']) - @imports(_from='mozbuild.configure.constants', _import='CompilerType') @imports(_from='mozbuild.configure.constants', _import='CPU_preprocessor_checks') @@ -464,7 +432,7 @@ def check_compiler(compiler, language, target): # GCC 4.9 indicates that it implements draft C++14 features # instead of the full language. elif info.type == 'gcc' and not \ - (info.language_version == draft_cxx14_version or info.language_version == cxx14_version): + (info.language_version == draft_cxx14_version or info.language_version == cxx14_version): append_flag('-std=gnu++14') # We force clang-cl to emulate Visual C++ 2015 Update 3. @@ -533,29 +501,24 @@ def get_vc_paths(topsrcdir): # Then VS2017 and newer. for install in vswhere(['-requires', 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64']): path = install['installationPath'] - tools_version = open(os.path.join( - path, r'VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt'), 'rb').read().strip() - tools_path = os.path.join( - path, r'VC\Tools\MSVC', tools_version, r'bin\HostX64') + tools_version = open(os.path.join(path, r'VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt'), 'rb').read().strip() + tools_path = os.path.join(path, r'VC\Tools\MSVC', tools_version, r'bin\HostX64') yield (Version(install['installationVersion']), { 'x64': [os.path.join(tools_path, 'x64')], # The x64->x86 cross toolchain requires DLLs from the native x64 toolchain. 'x86': [os.path.join(tools_path, 'x86'), os.path.join(tools_path, 'x64')], }) - js_option('--with-visual-studio-version', nargs=1, choices=('2015', '2017'), help='Select a specific Visual Studio version to use') - @depends('--with-visual-studio-version') def vs_major_version(value): if value: return {'2015': 14, '2017': 15}[value[0]] - @depends(host, target, vs_major_version, check_build_environment, '--with-visual-studio-version') @imports(_from='__builtin__', _import='sorted') @imports(_from='operator', _import='itemgetter') @@ -575,8 +538,7 @@ def vc_compiler_path(host, target, vs_major_version, env, vs_release_name): if not all_versions: return if vs_major_version: - versions = [d for (v, d) in all_versions if v.major == - vs_major_version] + versions = [d for (v, d) in all_versions if v.major == vs_major_version] if not versions: die('Visual Studio %s could not be found!' % vs_release_name) data = versions[0] @@ -692,7 +654,7 @@ def compiler(language, host_or_target, c_compiler=None, other_compiler=None, 'C++': lambda: default_cxx_compilers(c_compiler), }[language]() - what = 'the %s %s compiler' % (host_or_target_str, language) + what='the %s %s compiler' % (host_or_target_str, language) option(env=var, nargs=1, help='Path to %s' % what) @@ -925,6 +887,7 @@ def compiler(language, host_or_target, c_compiler=None, other_compiler=None, valid_compiler.try_compile(check_msg='%s works' % what, onerror=compiler_error) + # Set CPP/CXXCPP for both the build system and old-configure. We don't # need to check this works for preprocessing, because we already relied # on $CC -E/$CXX -E doing preprocessing work to validate the compiler @@ -936,7 +899,7 @@ def compiler(language, host_or_target, c_compiler=None, other_compiler=None, }[language] preprocessor = depends_if(valid_compiler)( - lambda x: list(x.wrapper) + [x.compiler, '-E'] + list(x.flags)) + lambda x: list(x.wrapper) + [x.compiler, '-E'] + list(x.flags)) set_config(pp_var, preprocessor) add_old_configure_assignment(pp_var, preprocessor) @@ -979,7 +942,6 @@ host_cxx_compiler = compiler('C++', host, c_compiler=host_c_compiler, non_msvc_compiler = depends(c_compiler)(lambda info: info.type != 'msvc') building_with_gcc = depends(c_compiler)(lambda info: info.type == 'gcc') - @depends(c_compiler) def msvs_version(info): # clang-cl emulates the same version scheme as cl. And MSVS_VERSION needs to @@ -992,12 +954,10 @@ def msvs_version(info): return '' - set_config('MSVS_VERSION', msvs_version) include('compile-checks.configure') - @depends(have_64_bit, try_compile(body='static_assert(sizeof(void *) == 8, "")', check_msg='for 64-bit OS')) @@ -1006,13 +966,11 @@ def check_have_64_bit(have_64_bit, compiler_have_64_bit): configure_error('The target compiler does not agree with configure ' 'about the target bitness.') - option(env='BINDGEN_CFLAGS', nargs=1, default=bindgen_cflags_defaults, help='Options bindgen should pass to the C/C++ parser') - @depends('BINDGEN_CFLAGS') @checking('bindgen cflags', lambda s: s if s and s.strip() else 'no') def bindgen_cflags(value): @@ -1022,10 +980,8 @@ def bindgen_cflags(value): return ', '.join('"' + flag + '"' for flag in flags) return '' - set_config('BINDGEN_CFLAGS', bindgen_cflags) - @depends(c_compiler) def default_debug_flags(compiler_info): # Debug info is ON by default. @@ -1033,7 +989,6 @@ def default_debug_flags(compiler_info): return '-Zi' return '-g' - option(env='MOZ_DEBUG_FLAGS', nargs=1, help='Debug compiler flags') @@ -1049,7 +1004,6 @@ js_option('--enable-debug-symbols', set_config('MOZ_DEBUG_SYMBOLS', depends_if('--enable-debug-symbols')(lambda _: True)) - @depends('MOZ_DEBUG_FLAGS', '--enable-debug-symbols', default_debug_flags) def debug_flags(env_debug_flags, enable_debug_flags, default_debug_flags): # If MOZ_DEBUG_FLAGS is set, and --enable-debug-symbols is set to a value, @@ -1061,11 +1015,9 @@ def debug_flags(env_debug_flags, enable_debug_flags, default_debug_flags): return env_debug_flags[0] return default_debug_flags - set_config('MOZ_DEBUG_FLAGS', debug_flags) add_old_configure_assignment('MOZ_DEBUG_FLAGS', debug_flags) - @depends(c_compiler) def color_cflags(info): # We could test compiling with flags. By why incur the overhead when @@ -1085,7 +1037,6 @@ def color_cflags(info): else: return '' - set_config('COLOR_CFLAGS', color_cflags) # Some standard library headers (notably bionic on Android) declare standard @@ -1127,21 +1078,16 @@ set_config('COLOR_CFLAGS', color_cflags) # # _LIBCPP_ALWAYS_INLINE needs similar workarounds, since it too declares # hidden visibility. - - @depends(c_compiler, target) def libcxx_override_visibility(c_compiler, target): if c_compiler.type == 'clang' and target.os == 'Android': return '' - set_define('_LIBCPP_INLINE_VISIBILITY', libcxx_override_visibility) -set_define('_LIBCPP_INLINE_VISIBILITY_EXCEPT_GCC49', - libcxx_override_visibility) +set_define('_LIBCPP_INLINE_VISIBILITY_EXCEPT_GCC49', libcxx_override_visibility) set_define('_LIBCPP_ALWAYS_INLINE', libcxx_override_visibility) set_define('_LIBCPP_ALWAYS_INLINE_EXCEPT_GCC49', libcxx_override_visibility) - @depends(target, check_build_environment) def visibility_flags(target, env): if target.os != 'WINNT': @@ -1151,13 +1097,11 @@ def visibility_flags(target, env): '-include', '%s/config/gcc_hidden.h' % env.topsrcdir) - @depends(target, visibility_flags) def wrap_system_includes(target, visibility_flags): if visibility_flags and target.kernel != 'Darwin': return True - set_define('HAVE_VISIBILITY_HIDDEN_ATTRIBUTE', depends(visibility_flags)(lambda v: bool(v) or None)) set_define('HAVE_VISIBILITY_ATTRIBUTE', @@ -1165,7 +1109,6 @@ set_define('HAVE_VISIBILITY_ATTRIBUTE', set_config('WRAP_SYSTEM_INCLUDES', wrap_system_includes) set_config('VISIBILITY_FLAGS', visibility_flags) - @depends(c_compiler) @imports('multiprocessing') @imports(_from='__builtin__', _import='min') @@ -1199,7 +1142,6 @@ def pgo_flags(compiler): use_ldflags=['-LTCG:PGUPDATE', cgthreads], ) - set_config('PROFILE_GEN_CFLAGS', pgo_flags.gen_cflags) set_config('PROFILE_GEN_LDFLAGS', pgo_flags.gen_ldflags) set_config('PROFILE_USE_CFLAGS', pgo_flags.use_cflags) @@ -1207,13 +1149,10 @@ set_config('PROFILE_USE_LDFLAGS', pgo_flags.use_ldflags) # We only want to include windows.configure when we are compiling on # Windows, for Windows. - - @depends(target, host) def is_windows(target, host): return host.kernel == 'WINNT' and target.kernel == 'WINNT' - include('windows.configure', when=is_windows) # Shader Compiler for Windows (and MinGW Cross Compile) @@ -1230,13 +1169,11 @@ wine = check_prog('WINE', ['wine'], when=depends(target, host) option('--enable-hardening', env='MOZ_SECURITY_HARDENING', help='Enables security hardening compiler options') - @depends('--enable-hardening', c_compiler) def security_hardening_cflags(value, c_compiler): if value and c_compiler.type in ['gcc', 'clang']: return '-fstack-protector-strong' - add_old_configure_assignment('HARDENING_CFLAGS', security_hardening_cflags) imply_option('--enable-pie', depends_if('--enable-hardening')(lambda v: v)) @@ -1253,20 +1190,17 @@ js_option('--enable-release', help='Build with more conservative, release engineering-oriented ' 'options. This may slow down builds.') - @depends('--enable-release') def developer_options(value): if not value: return True - add_old_configure_assignment('DEVELOPER_OPTIONS', developer_options) set_config('DEVELOPER_OPTIONS', developer_options) # Linker detection # ============================================================== - @depends(target) def is_linker_option_enabled(target): if target.kernel not in ('Darwin', 'WINNT', 'SunOS'): @@ -1295,8 +1229,7 @@ def enable_gnu_linker(enable_gold_option, c_compiler, developer_options, build_e targetDir = os.path.join(build_env.topobjdir, 'build', 'unix', 'gold') gold_detection_arg = '-print-prog-name=ld.gold' - gold = check_cmd_output(c_compiler.compiler, - gold_detection_arg).strip() + gold = check_cmd_output(c_compiler.compiler, gold_detection_arg).strip() if not gold: return @@ -1352,13 +1285,11 @@ def enable_gnu_linker(enable_gold_option, c_compiler, developer_options, build_e KIND='other' ) - js_option('--enable-linker', nargs=1, choices=('bfd', 'gold', 'lld', 'other'), help='Select the linker', when=is_linker_option_enabled) - @depends('--enable-linker', c_compiler, developer_options, check_build_environment, extra_toolchain_flags, when=is_linker_option_enabled) @checking('for linker', lambda x: x.KIND) @@ -1369,8 +1300,7 @@ def select_linker(linker, c_compiler, developer_options, build_env, toolchain_fl build_env, toolchain_flags, linker) if linker == 'lld': version_check = ['-Wl,--version'] - cmd_base = c_compiler.wrapper + \ - [c_compiler.compiler] + c_compiler.flags + cmd_base = c_compiler.wrapper + [c_compiler.compiler] + c_compiler.flags lld = "-fuse-ld=" + linker cmd = cmd_base + [lld] + version_check if 'LLD' in check_cmd_output(*cmd).decode('utf-8'): @@ -1382,22 +1312,19 @@ def select_linker(linker, c_compiler, developer_options, build_env, toolchain_fl die("Could not use lld as linker") -set_config('LD_IS_BFD', depends(select_linker.KIND) - (lambda x: x == 'bfd' or None)) +set_config('LD_IS_BFD', depends(select_linker.KIND)(lambda x: x == 'bfd' or None)) set_config('LINKER_LDFLAGS', select_linker.LINKER_FLAG) # Code Coverage # ============================================================== js_option('--enable-coverage', env='MOZ_CODE_COVERAGE', - help='Enable code coverage') - + help='Enable code coverage') @depends('--enable-coverage') def code_coverage(value): if value: return True - set_config('MOZ_CODE_COVERAGE', code_coverage) set_define('MOZ_CODE_COVERAGE', code_coverage) diff --git a/build/moz.configure/util.configure b/build/moz.configure/util.configure index 19ab816b96fe..1e328828c9bd 100644 --- a/build/moz.configure/util.configure +++ b/build/moz.configure/util.configure @@ -4,7 +4,6 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. - @imports('sys') def die(*args): 'Print an error and terminate configure.' @@ -23,8 +22,6 @@ def configure_error(message): # by running the given command if it exits normally, and streams that # output to log.debug and calls die or the given error callback if it # does not. - - @imports(_from='__builtin__', _import='unicode') @imports('subprocess') @imports('sys') @@ -70,7 +67,6 @@ def check_cmd_output(*args, **kwargs): die('Command `%s` failed with exit status %d.' % (quote(*args), retcode)) - @imports('os') def is_absolute_or_relative(path): if os.altsep and os.altsep in path: @@ -92,8 +88,7 @@ def windows_binary_type(path): Returns WindowsBinaryType constant. """ GetBinaryTypeW = ctypes.windll.kernel32.GetBinaryTypeW - GetBinaryTypeW.argtypes = [wintypes.LPWSTR, - wintypes.POINTER(wintypes.DWORD)] + GetBinaryTypeW.argtypes = [wintypes.LPWSTR, wintypes.POINTER(wintypes.DWORD)] GetBinaryTypeW.restype = wintypes.BOOL bin_type = wintypes.DWORD() @@ -152,7 +147,6 @@ def normalize_path(): return normalize_path - normalize_path = normalize_path() @@ -370,8 +364,6 @@ def Version(v): # The function may handle the option like a typical @depends function would, # but it is recommended it emits a deprecation error message suggesting an # alternative option to use if there is one. - - @template def deprecated_option(*args, **kwargs): assert 'help' not in kwargs @@ -422,7 +414,6 @@ def depends_tmpl(eval_args_fn, *args, **kwargs): when = kwargs['when'] else: when = None - def decorator(func): @depends(*args, when=when) def wrapper(*args): @@ -453,12 +444,10 @@ def depends_all(*args, **kwargs): def old_configure_assignments(): return [] - @dependable def extra_old_configure_args(): return [] - @template def add_old_configure_assignment(var, value): var = dependable(var) @@ -478,7 +467,6 @@ def add_old_configure_assignment(var, value): value = quote(*value) assignments.append('%s=%s' % (var, quote(str(value)))) - @template def add_old_configure_arg(arg): @depends(extra_old_configure_args, arg) diff --git a/build/moz.configure/windows.configure b/build/moz.configure/windows.configure index f0c471266024..391c6d116ddf 100644 --- a/build/moz.configure/windows.configure +++ b/build/moz.configure/windows.configure @@ -8,7 +8,6 @@ option('--with-windows-version', nargs=1, default='603', help='Windows SDK version to target. Win 8.1 (603) is currently' 'the minimum supported version.') - @depends('--with-windows-version') @imports(_from='__builtin__', _import='ValueError') def valid_windows_version(value): @@ -27,7 +26,6 @@ def valid_windows_version(value): option(env='WINDOWSSDKDIR', nargs=1, help='Directory containing the Windows SDK') - @depends('WINDOWSSDKDIR', host) def windows_sdk_dir(value, host): if value: @@ -46,8 +44,6 @@ def windows_sdk_dir(value, host): # The $SDK/lib directories always have version subdirectories, but while the # versions match the one in $SDK/include for SDK 10, it's "winv6.3" for SDK # 8.1. - - @imports('os') @imports('re') @imports(_from='__builtin__', _import='sorted') @@ -93,7 +89,6 @@ def valid_windows_sdk_dir_result(value): if value: return '0x%04x in %s' % (value.version, quote(value.path)) - @depends(c_compiler, windows_sdk_dir, valid_windows_version, 'WINDOWSSDKDIR') @checking('for Windows SDK', valid_windows_sdk_dir_result) @imports(_from='__builtin__', _import='sorted') @@ -170,7 +165,6 @@ def valid_ucrt_sdk_dir_result(value): if value: return '%s in %s' % (value.version, quote(value.path)) - @depends(windows_sdk_dir, 'WINDOWSSDKDIR') @checking('for Universal CRT SDK', valid_ucrt_sdk_dir_result) @imports('os') @@ -232,7 +226,7 @@ def valid_ucrt_sdk_dir(windows_sdk_dir, windows_sdk_dir_env): if version < minimum_ucrt_version: raise FatalCheckError('Latest Universal CRT SDK version found %s' ' and minimum required is %s.' - % (version, minimum_ucrt_version)) + % (version, minimum_ucrt_version)) return namespace( path=sdk.path, @@ -273,8 +267,7 @@ def dia_sdk_dir(vc_path, c_compiler): else: # This would be easier if we had the installationPath that # get_vc_paths works with, since 'DIA SDK' is relative to that. - path = os.path.normpath(os.path.join( - vc_path, r'..\..\..\..\DIA SDK')) + path = os.path.normpath(os.path.join(vc_path, r'..\..\..\..\DIA SDK')) if isdir(path): return path @@ -313,7 +306,6 @@ def include_path(vc_path, windows_sdk_dir, ucrt_sdk_dir, dia_sdk_dir): os.environ['INCLUDE'] = includes return includes - set_config('INCLUDE', include_path) @@ -371,13 +363,11 @@ def lib_path(target, c_compiler, vc_path, windows_sdk_dir, ucrt_sdk_dir, dia_sdk os.environ['LIB'] = libs return libs - set_config('LIB', lib_path) option(env='MT', nargs=1, help='Path to the Microsoft Manifest Tool') - @depends(valid_windows_sdk_dir, valid_ucrt_sdk_dir) @imports(_from='os', _import='environ') @imports('platform') @@ -418,7 +408,7 @@ def valid_mt(path): out = '\n'.join(l for l in out if 'Microsoft (R) Manifest Tool' in l) if out: - return path + return path except subprocess.CalledProcessError: pass raise FatalCheckError('%s is not Microsoft Manifest Tool') @@ -443,7 +433,7 @@ def alter_path(sdk_bin_path): os.environ['PATH'] = path return path - set_config('PATH', alter_path) check_prog('MAKECAB', ('makecab.exe',)) + diff --git a/tools/lint/flake8.yml b/tools/lint/flake8.yml index a44abc858286..89644067c87d 100644 --- a/tools/lint/flake8.yml +++ b/tools/lint/flake8.yml @@ -2,7 +2,6 @@ flake8: description: Python linter include: - - build/moz.configure/*.configure - config/check_macroassembler_style.py - config/mozunit.py - layout/tools/reftest