mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
Bug 1915191 - Provide a minimal linter for configure help r=glandium,geckoview-reviewers,owlish
Currently makes sure all help message begins with an uppercase letter and does *not* end with a dot. Differential Revision: https://phabricator.services.mozilla.com/D220283
This commit is contained in:
parent
dbb97f266d
commit
d8a80fdff3
@ -19,17 +19,17 @@ option(
|
||||
"--with-android-ndk",
|
||||
nargs=1,
|
||||
default=default_android_ndk_root,
|
||||
help="location where the Android NDK can be found{|}",
|
||||
help="Location where the Android NDK can be found{|}",
|
||||
)
|
||||
|
||||
option("--with-android-toolchain", nargs=1, help="location of the Android toolchain")
|
||||
option("--with-android-toolchain", nargs=1, help="Location of the Android toolchain")
|
||||
|
||||
option(
|
||||
"--with-android-lldb-server", nargs=1, help="location of the Android LLDB server"
|
||||
"--with-android-lldb-server", nargs=1, help="Location of the Android LLDB server"
|
||||
)
|
||||
|
||||
option(
|
||||
"--with-android-googlevr-sdk", nargs=1, help="location of the Android GoogleVR SDK"
|
||||
"--with-android-googlevr-sdk", nargs=1, help="Location of the Android GoogleVR SDK"
|
||||
)
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ def min_android_version():
|
||||
option(
|
||||
"--with-android-version",
|
||||
nargs=1,
|
||||
help="android platform version{|}",
|
||||
help="Android platform version{|}",
|
||||
default=min_android_version,
|
||||
)
|
||||
|
||||
|
@ -25,7 +25,7 @@ option(
|
||||
"--with-android-sdk",
|
||||
nargs=1,
|
||||
default=default_android_sdk_root,
|
||||
help="location where the Android SDK can be found (like ~/.mozbuild/android-sdk-linux){|}",
|
||||
help="Location where the Android SDK can be found (like ~/.mozbuild/android-sdk-linux){|}",
|
||||
)
|
||||
|
||||
|
||||
|
@ -26,7 +26,7 @@ set_config("CLANG_PLUGIN", clang_plugin_path)
|
||||
option(
|
||||
"--enable-clang-plugin-alpha",
|
||||
env="ENABLE_CLANG_PLUGIN_ALPHA",
|
||||
help="Enable static analysis with clang-plugin alpha checks.",
|
||||
help="Enable static analysis with clang-plugin alpha checks",
|
||||
when="--enable-clang-plugin",
|
||||
)
|
||||
|
||||
|
@ -384,7 +384,7 @@ option(
|
||||
"--enable-application",
|
||||
nargs=1,
|
||||
env="MOZ_BUILD_APP",
|
||||
help="Application to build. Same as --enable-project.",
|
||||
help="Application to build. Same as --enable-project",
|
||||
)
|
||||
|
||||
|
||||
@ -413,7 +413,7 @@ option("--enable-project", nargs=1, default=default_project, help="Project to bu
|
||||
option(
|
||||
"--enable-artifact-builds",
|
||||
env="MOZ_ARTIFACT_BUILDS",
|
||||
help="Download and use prebuilt binary artifacts.",
|
||||
help="Download and use prebuilt binary artifacts",
|
||||
)
|
||||
|
||||
|
||||
@ -1268,7 +1268,7 @@ option(
|
||||
"may vary for full rebrandings (e.g. Iceweasel). Used for "
|
||||
'application.ini\'s "Name" field, which controls profile location in '
|
||||
'the absence of a "Profile" field (see below), and various system '
|
||||
"integration hooks (Unix remoting, Windows MessageWindow name, etc.",
|
||||
"integration hooks (Unix remoting, Windows MessageWindow name, etc",
|
||||
)
|
||||
|
||||
|
||||
@ -1323,7 +1323,7 @@ option(
|
||||
nargs=1,
|
||||
metavar="PREFIX",
|
||||
default="/usr/local",
|
||||
help="install files using PREFIX as root directory",
|
||||
help="Install files using PREFIX as root directory",
|
||||
)
|
||||
set_config("prefix", depends("--prefix")(lambda prefix: prefix[0]))
|
||||
|
||||
@ -1345,6 +1345,6 @@ option(
|
||||
nargs=1,
|
||||
metavar="DIR",
|
||||
default=depends("--prefix")(lambda prefix: f"{prefix[0]}/lib"),
|
||||
help="object code libraries in DIR",
|
||||
help="Object code libraries in DIR",
|
||||
)
|
||||
set_config("libdir", depends("--libdir")(lambda ldir: ldir[0]))
|
||||
|
@ -239,7 +239,7 @@ option(
|
||||
option(
|
||||
env="MOZ_LD64_KNOWN_GOOD",
|
||||
nargs=1,
|
||||
help="Indicate that ld64 is free of symbol aliasing bugs.",
|
||||
help="Indicate that ld64 is free of symbol aliasing bugs",
|
||||
)
|
||||
|
||||
imply_option("MOZ_LD64_KNOWN_GOOD", depends_if("MOZ_AUTOMATION")(lambda _: True))
|
||||
|
@ -36,5 +36,5 @@ set_config("NSS_LIBS", nss_config.libs)
|
||||
project_flag(
|
||||
env="NSS_EXTRA_SYMBOLS_FILE",
|
||||
nargs=1,
|
||||
help="Path to a file containing extra symbols to export from NSS.",
|
||||
help="Path to a file containing extra symbols to export from NSS",
|
||||
)
|
||||
|
@ -581,7 +581,7 @@ set_config("RUSTC_NATVIS_LDFLAGS", rustc_natvis_ldflags)
|
||||
option(
|
||||
"--enable-rust-debug",
|
||||
default=depends(when="--enable-debug")(lambda: True),
|
||||
help="{Build|Do not build} Rust code with debug assertions turned " "on.",
|
||||
help="{Build|Do not build} Rust code with debug assertions turned on",
|
||||
)
|
||||
|
||||
|
||||
@ -696,7 +696,7 @@ def rust_compile_flags(
|
||||
# ==============================================================
|
||||
|
||||
|
||||
option("--disable-cargo-incremental", help="Disable incremental rust compilation.")
|
||||
option("--disable-cargo-incremental", help="Disable incremental rust compilation")
|
||||
|
||||
|
||||
@depends(
|
||||
|
@ -8,7 +8,7 @@
|
||||
# ==============================================================
|
||||
option(
|
||||
env="HOST_CPPFLAGS",
|
||||
help="Extra flags for Preprocessing host sources.",
|
||||
help="Extra flags for Preprocessing host sources",
|
||||
nargs=1,
|
||||
default="",
|
||||
)
|
||||
@ -16,7 +16,7 @@ option(
|
||||
|
||||
option(
|
||||
env="HOST_CFLAGS",
|
||||
help="Extra flags for compiling host C sources.",
|
||||
help="Extra flags for compiling host C sources",
|
||||
nargs=1,
|
||||
default="",
|
||||
)
|
||||
@ -24,7 +24,7 @@ option(
|
||||
|
||||
option(
|
||||
env="HOST_CXXFLAGS",
|
||||
help="Extra flags for compiling host C++ sources.",
|
||||
help="Extra flags for compiling host C++ sources",
|
||||
nargs=1,
|
||||
default="",
|
||||
)
|
||||
@ -32,7 +32,7 @@ option(
|
||||
|
||||
option(
|
||||
env="HOST_LDFLAGS",
|
||||
help="Extra flags for linking host object files.",
|
||||
help="Extra flags for linking host object files",
|
||||
nargs=1,
|
||||
default="",
|
||||
)
|
||||
@ -40,7 +40,7 @@ option(
|
||||
|
||||
option(
|
||||
env="CPPFLAGS",
|
||||
help="Extra flags for preprocessing sources.",
|
||||
help="Extra flags for preprocessing sources",
|
||||
nargs=1,
|
||||
default="",
|
||||
)
|
||||
@ -48,7 +48,7 @@ option(
|
||||
|
||||
option(
|
||||
env="CFLAGS",
|
||||
help="Extra flags for compiling C sources.",
|
||||
help="Extra flags for compiling C sources",
|
||||
nargs=1,
|
||||
default="",
|
||||
)
|
||||
@ -56,7 +56,7 @@ option(
|
||||
|
||||
option(
|
||||
env="CXXFLAGS",
|
||||
help="Extra flags for compiling C++ sources.",
|
||||
help="Extra flags for compiling C++ sources",
|
||||
nargs=1,
|
||||
default="",
|
||||
)
|
||||
@ -64,7 +64,7 @@ option(
|
||||
|
||||
option(
|
||||
env="ASFLAGS",
|
||||
help="Extra flags for assembling sources.",
|
||||
help="Extra flags for assembling sources",
|
||||
nargs=1,
|
||||
default="",
|
||||
)
|
||||
@ -72,7 +72,7 @@ option(
|
||||
|
||||
option(
|
||||
env="LDFLAGS",
|
||||
help="Extra flags for linking object files.",
|
||||
help="Extra flags for linking object files",
|
||||
nargs=1,
|
||||
default="",
|
||||
)
|
||||
@ -80,7 +80,7 @@ option(
|
||||
|
||||
option(
|
||||
env="MOZ_OPTIMIZE_FLAGS",
|
||||
help="Extra optimization flags.",
|
||||
help="Extra optimization flags",
|
||||
nargs=1,
|
||||
)
|
||||
|
||||
@ -3751,7 +3751,7 @@ option(
|
||||
"--enable-path-remapping",
|
||||
nargs="*",
|
||||
choices=("c", "rust"),
|
||||
help="Enable remapping source and object paths in compiled outputs.",
|
||||
help="Enable remapping source and object paths in compiled outputs",
|
||||
)
|
||||
|
||||
|
||||
|
@ -82,7 +82,7 @@ can_toggle_nss_mar = target_is_windows | target_is_osx
|
||||
option(
|
||||
"--enable-nss-mar",
|
||||
when=can_toggle_nss_mar,
|
||||
help="Enable using NSS to check MAR signatures instead of system crypto.",
|
||||
help="Enable using NSS to check MAR signatures instead of system crypto",
|
||||
)
|
||||
|
||||
|
||||
|
@ -8,8 +8,8 @@ option(
|
||||
"--with-windows-version",
|
||||
nargs=1,
|
||||
default="603",
|
||||
help="Windows SDK version to target. Win 8.1 (603) is currently"
|
||||
"the minimum supported version.",
|
||||
help="Windows SDK version to target. Win 8.1 (603) is currently "
|
||||
"the minimum supported version",
|
||||
)
|
||||
|
||||
|
||||
|
@ -23,7 +23,7 @@ option(
|
||||
env="MOZ_APP_NAME",
|
||||
nargs=1,
|
||||
help="Used for e.g. the binary program file name. If not set, "
|
||||
"defaults to a lowercase form of MOZ_APP_BASENAME.",
|
||||
"defaults to a lowercase form of MOZ_APP_BASENAME",
|
||||
)
|
||||
|
||||
|
||||
@ -197,7 +197,7 @@ set_define("ENABLE_EXPLICIT_RESOURCE_MANAGEMENT", enable_explicit_resource_manag
|
||||
option(
|
||||
"--enable-portable-baseline-interp",
|
||||
default=False,
|
||||
help="{Enable|Disable} the portable baseline interpreter.",
|
||||
help="{Enable|Disable} the portable baseline interpreter",
|
||||
)
|
||||
set_define(
|
||||
"ENABLE_PORTABLE_BASELINE_INTERP",
|
||||
@ -212,7 +212,7 @@ set_config(
|
||||
option(
|
||||
"--enable-portable-baseline-interp-force",
|
||||
default=False,
|
||||
help="{Enable|Disable} forcing use of the portable baseline interpreter.",
|
||||
help="{Enable|Disable} forcing use of the portable baseline interpreter",
|
||||
)
|
||||
|
||||
set_define(
|
||||
@ -576,7 +576,7 @@ set_define("JS_DISASM_ARM64", jit_disasm_arm64)
|
||||
option(
|
||||
"--enable-masm-verbose",
|
||||
default=depends(when=moz_debug)(lambda: True),
|
||||
help="{Enable|Disable} MacroAssembler verbosity of generated code.",
|
||||
help="{Enable|Disable} MacroAssembler verbosity of generated code",
|
||||
)
|
||||
set_define("JS_MASM_VERBOSE", depends_if("--enable-masm-verbose")(lambda _: True))
|
||||
set_config("JS_MASM_VERBOSE", depends_if("--enable-masm-verbose")(lambda _: True))
|
||||
@ -597,7 +597,7 @@ def is_apple_silicon(target):
|
||||
option(
|
||||
"--enable-arm64-fjcvtzs",
|
||||
default=is_apple_silicon,
|
||||
help="{Enable|Disable} static use of FJCVTZS instruction on Aarch64 targets.",
|
||||
help="{Enable|Disable} static use of FJCVTZS instruction on Aarch64 targets",
|
||||
)
|
||||
|
||||
|
||||
@ -676,7 +676,7 @@ set_define("ENABLE_PIPELINE_OPERATOR", enable_pipeline_operator)
|
||||
# ==============================================================
|
||||
|
||||
option(
|
||||
"--enable-rust-simd", env="MOZ_RUST_SIMD", help="Enable explicit SIMD in Rust code."
|
||||
"--enable-rust-simd", env="MOZ_RUST_SIMD", help="Enable explicit SIMD in Rust code"
|
||||
)
|
||||
|
||||
|
||||
@ -727,7 +727,7 @@ set_define(
|
||||
option(
|
||||
"--wasm-no-experimental",
|
||||
default=False,
|
||||
help="Force disable all wasm experimental features for testing.",
|
||||
help="Force disable all wasm experimental features for testing",
|
||||
)
|
||||
|
||||
|
||||
|
@ -340,7 +340,7 @@ set_config(
|
||||
|
||||
option(
|
||||
"--disable-android-bundle",
|
||||
help="{Enable|Disable} AAB build.",
|
||||
help="{Enable|Disable} AAB build",
|
||||
)
|
||||
|
||||
imply_option("--disable-android-bundle", False, when="--enable-address-sanitizer")
|
||||
@ -669,7 +669,7 @@ set_config("GRADLE_ANDROID_DEPENDENCIES_TASKS", gradle_android_dependencies_task
|
||||
|
||||
# Automation uses this to change log levels, not use the daemon, and use
|
||||
# offline mode.
|
||||
option(env="GRADLE_FLAGS", default="", help="Flags to pass to Gradle.")
|
||||
option(env="GRADLE_FLAGS", default="", help="Flags to pass to Gradle")
|
||||
|
||||
|
||||
@depends("GRADLE_FLAGS")
|
||||
@ -690,12 +690,12 @@ option(
|
||||
"https://repo.maven.apache.org/maven2/",
|
||||
"https://plugins.gradle.org/m2/",
|
||||
),
|
||||
help="Comma-separated URLs of Maven repositories containing Gradle dependencies.",
|
||||
help="Comma-separated URLs of Maven repositories containing Gradle dependencies",
|
||||
)
|
||||
|
||||
option(
|
||||
"--allow-insecure-gradle-repositories",
|
||||
help="Gradle is allowed to connect to insecure Maven repositories.",
|
||||
help="Gradle is allowed to connect to insecure Maven repositories",
|
||||
)
|
||||
|
||||
set_config(
|
||||
@ -706,7 +706,7 @@ set_config(
|
||||
|
||||
option(
|
||||
"--download-all-gradle-dependencies",
|
||||
help="Download all dependencies, even those that are conditionally used.",
|
||||
help="Download all dependencies, even those that are conditionally used",
|
||||
)
|
||||
|
||||
set_config(
|
||||
|
@ -52,7 +52,7 @@ set_config(
|
||||
|
||||
option(
|
||||
"--enable-geckoview-lite",
|
||||
help="Build GeckoView in Lite mode. Lite mode removes all unnecessary dependencies like Glean.",
|
||||
help="Build GeckoView in Lite mode. Lite mode removes all unnecessary dependencies like Glean",
|
||||
)
|
||||
|
||||
set_config("MOZ_ANDROID_GECKOVIEW_LITE", True, when="--enable-geckoview-lite")
|
||||
|
@ -24,7 +24,7 @@ option(
|
||||
"--enable-artifact-build-symbols",
|
||||
nargs="?",
|
||||
choices=("full",),
|
||||
help="Download symbols when artifact builds are enabled.",
|
||||
help="Download symbols when artifact builds are enabled",
|
||||
)
|
||||
|
||||
|
||||
@ -51,8 +51,8 @@ def imply_disable_compile_environment(value):
|
||||
option(
|
||||
env="MOZ_BUILD_HOOK",
|
||||
nargs=1,
|
||||
help="moz.build file that will be executed as if it were appended to"
|
||||
" every moz.build in the tree.",
|
||||
help="Path to the moz.build file that will be executed as if it were "
|
||||
"appended to every moz.build in the tree",
|
||||
)
|
||||
|
||||
|
||||
@ -70,7 +70,7 @@ set_config("MOZ_BUILD_HOOK", moz_build_hook)
|
||||
option(
|
||||
env="MOZ_COPY_PDBS",
|
||||
help="For builds that do not support symbols in the normal fashion,"
|
||||
" generate and copy them into the resulting build archive.",
|
||||
" generate and copy them into the resulting build archive",
|
||||
)
|
||||
|
||||
set_config("MOZ_COPY_PDBS", depends_if("MOZ_COPY_PDBS")(lambda _: True))
|
||||
@ -130,7 +130,7 @@ option(
|
||||
"--enable-debug",
|
||||
nargs="?",
|
||||
help="Enable building with developer debug info "
|
||||
"(using the given compiler flags).",
|
||||
"(using the given compiler flags)",
|
||||
)
|
||||
|
||||
|
||||
@ -545,7 +545,7 @@ def build_gtest(build_project, target, automation, enable_tests):
|
||||
option(
|
||||
"--enable-gtest-in-build",
|
||||
default=build_gtest,
|
||||
help="{Enable|Force disable} building the gtest libxul during the build.",
|
||||
help="{Enable|Force disable} building the gtest libxul during the build",
|
||||
when="--enable-compile-environment",
|
||||
)
|
||||
|
||||
|
@ -451,7 +451,7 @@ class ConfigureSandbox(dict):
|
||||
|
||||
self._help = None
|
||||
self._help_option = self.option_impl(
|
||||
"--help", help="print this message", category=HELP_OPTIONS_CATEGORY
|
||||
"--help", help="Print this message", category=HELP_OPTIONS_CATEGORY
|
||||
)
|
||||
self._seen.add(self._help_option)
|
||||
|
||||
|
@ -200,12 +200,20 @@ class LintSandbox(ConfigureSandbox):
|
||||
return result
|
||||
|
||||
def _check_option(self, option, *args, **kwargs):
|
||||
self._check_help_message(option, *args, **kwargs)
|
||||
|
||||
if len(args) == 0:
|
||||
return
|
||||
|
||||
self._check_prefix_for_bool_option(*args, **kwargs)
|
||||
self._check_help_for_option(option, *args, **kwargs)
|
||||
|
||||
def _pretty_current_frame(self):
|
||||
frame = inspect.currentframe()
|
||||
while frame and frame.f_code.co_name != self.option_impl.__name__:
|
||||
frame = frame.f_back
|
||||
return frame
|
||||
|
||||
def _check_prefix_for_bool_option(self, *args, **kwargs):
|
||||
name = args[0]
|
||||
default = kwargs.get("default")
|
||||
@ -225,9 +233,7 @@ class LintSandbox(ConfigureSandbox):
|
||||
}
|
||||
for prefix, replacement in table[default].items():
|
||||
if name.startswith("--{}-".format(prefix)):
|
||||
frame = inspect.currentframe()
|
||||
while frame and frame.f_code.co_name != self.option_impl.__name__:
|
||||
frame = frame.f_back
|
||||
frame = self._pretty_current_frame()
|
||||
e = ConfigureError(
|
||||
"{} should be used instead of "
|
||||
"{} with default={}".format(
|
||||
@ -273,12 +279,32 @@ class LintSandbox(ConfigureSandbox):
|
||||
else:
|
||||
rule = "{With|Without}"
|
||||
|
||||
frame = inspect.currentframe()
|
||||
while frame and frame.f_code.co_name != self.option_impl.__name__:
|
||||
frame = frame.f_back
|
||||
frame = self._pretty_current_frame()
|
||||
e = ConfigureError('`help` should contain "{}" because {}'.format(rule, check))
|
||||
self._raise_from(e, frame.f_back if frame else None)
|
||||
|
||||
def _check_help_message(self, option, *args, **kwargs):
|
||||
help = kwargs["help"]
|
||||
if help[:1].islower():
|
||||
error_msg = f"`{help}` is not properly capitalized"
|
||||
elif help.endswith("."):
|
||||
error_msg = f"`{help}` should not end with a '.'"
|
||||
elif match := re.search(HelpFormatter.RE_FORMAT, help):
|
||||
for choice in match.groups():
|
||||
if choice[:1].islower():
|
||||
error_msg = f"`{choice}` is not properly capitalized"
|
||||
break
|
||||
else:
|
||||
return
|
||||
else:
|
||||
return
|
||||
|
||||
frame = self._pretty_current_frame()
|
||||
e = ConfigureError(
|
||||
f'Invalid `help` message for option "{option.option}": {error_msg}'
|
||||
)
|
||||
self._raise_from(e, frame.f_back if frame else None)
|
||||
|
||||
def unwrap(self, func):
|
||||
glob = func.__globals__
|
||||
while func in self._wrapped:
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
imply_option("--enable-foo", True)
|
||||
|
||||
option("--enable-foo", help="enable foo")
|
||||
option("--enable-foo", help="Enable foo")
|
||||
|
||||
|
||||
@depends("--enable-foo", "--help")
|
||||
@ -17,7 +17,7 @@ def foo(value, help):
|
||||
|
||||
imply_option("--enable-bar", ("foo", "bar"))
|
||||
|
||||
option("--enable-bar", nargs="*", help="enable bar")
|
||||
option("--enable-bar", nargs="*", help="Enable bar")
|
||||
|
||||
|
||||
@depends("--enable-bar")
|
||||
@ -28,7 +28,7 @@ def bar(value):
|
||||
|
||||
imply_option("--enable-baz", "BAZ")
|
||||
|
||||
option("--enable-baz", nargs=1, help="enable baz")
|
||||
option("--enable-baz", nargs=1, help="Enable baz")
|
||||
|
||||
|
||||
@depends("--enable-baz")
|
||||
|
@ -4,7 +4,7 @@
|
||||
# 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/.
|
||||
|
||||
option("--enable-foo", help="enable foo")
|
||||
option("--enable-foo", help="Enable foo")
|
||||
|
||||
|
||||
@depends("--enable-foo", "--help")
|
||||
@ -16,7 +16,7 @@ def foo(value, help):
|
||||
imply_option("--enable-bar", foo)
|
||||
|
||||
|
||||
option("--enable-bar", help="enable bar")
|
||||
option("--enable-bar", help="Enable bar")
|
||||
|
||||
|
||||
@depends("--enable-bar")
|
||||
|
@ -4,7 +4,7 @@
|
||||
# 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/.
|
||||
|
||||
option("--enable-hoge", help="enable hoge")
|
||||
option("--enable-hoge", help="Enable hoge")
|
||||
|
||||
|
||||
@depends("--enable-hoge")
|
||||
@ -12,7 +12,7 @@ def hoge(value):
|
||||
return value
|
||||
|
||||
|
||||
option("--enable-foo", help="enable foo")
|
||||
option("--enable-foo", help="Enable foo")
|
||||
|
||||
|
||||
@depends("--enable-foo", hoge)
|
||||
@ -24,7 +24,7 @@ def foo(value, hoge):
|
||||
imply_option("--enable-bar", foo)
|
||||
|
||||
|
||||
option("--enable-bar", help="enable bar")
|
||||
option("--enable-bar", help="Enable bar")
|
||||
|
||||
|
||||
@depends("--enable-bar")
|
||||
|
@ -4,7 +4,7 @@
|
||||
# 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/.
|
||||
|
||||
option("--enable-foo", help="enable foo")
|
||||
option("--enable-foo", help="Enable foo")
|
||||
|
||||
|
||||
@depends("--enable-foo")
|
||||
@ -16,7 +16,7 @@ def foo(value):
|
||||
imply_option("--enable-bar", foo)
|
||||
|
||||
|
||||
option("--disable-hoge", help="enable hoge")
|
||||
option("--disable-hoge", help="Enable hoge")
|
||||
|
||||
|
||||
@depends("--disable-hoge")
|
||||
@ -28,7 +28,7 @@ def hoge(value):
|
||||
imply_option("--enable-bar", hoge)
|
||||
|
||||
|
||||
option("--enable-bar", default=True, help="enable bar")
|
||||
option("--enable-bar", default=True, help="Enable bar")
|
||||
|
||||
|
||||
@depends("--enable-bar")
|
||||
|
@ -4,7 +4,7 @@
|
||||
# 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/.
|
||||
|
||||
option("--enable-foo", help="enable foo")
|
||||
option("--enable-foo", help="Enable foo")
|
||||
|
||||
|
||||
@depends("--enable-foo")
|
||||
@ -16,7 +16,7 @@ def foo(value):
|
||||
imply_option("--enable-bar", foo)
|
||||
|
||||
|
||||
option("--enable-bar", help="enable bar")
|
||||
option("--enable-bar", help="Enable bar")
|
||||
|
||||
|
||||
@depends("--enable-bar")
|
||||
|
@ -4,7 +4,7 @@
|
||||
# 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/.
|
||||
|
||||
option("--enable-foo", nargs="*", help="enable foo")
|
||||
option("--enable-foo", nargs="*", help="Enable foo")
|
||||
|
||||
|
||||
@depends("--enable-foo")
|
||||
@ -16,7 +16,7 @@ def foo(value):
|
||||
imply_option("--enable-bar", foo)
|
||||
|
||||
|
||||
option("--enable-bar", nargs="*", help="enable bar")
|
||||
option("--enable-bar", nargs="*", help="Enable bar")
|
||||
|
||||
|
||||
@depends("--enable-bar")
|
||||
|
@ -4,7 +4,7 @@
|
||||
# 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/.
|
||||
|
||||
option("--set-foo", help="set foo")
|
||||
option("--set-foo", help="Set foo")
|
||||
|
||||
|
||||
@depends("--set-foo")
|
||||
@ -16,7 +16,7 @@ def foo(value):
|
||||
set_config("FOO", foo)
|
||||
|
||||
|
||||
option("--set-bar", help="set bar")
|
||||
option("--set-bar", help="Set bar")
|
||||
|
||||
|
||||
@depends("--set-bar")
|
||||
@ -27,7 +27,7 @@ def bar(value):
|
||||
set_config("BAR", bar)
|
||||
|
||||
|
||||
option("--set-value", nargs=1, help="set value")
|
||||
option("--set-value", nargs=1, help="Set value")
|
||||
|
||||
|
||||
@depends("--set-value")
|
||||
@ -39,7 +39,7 @@ def set_value(value):
|
||||
set_config("VALUE", set_value)
|
||||
|
||||
|
||||
option("--set-name", nargs=1, help="set name")
|
||||
option("--set-name", nargs=1, help="Set name")
|
||||
|
||||
|
||||
@depends("--set-name")
|
||||
|
@ -4,7 +4,7 @@
|
||||
# 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/.
|
||||
|
||||
option("--set-foo", help="set foo")
|
||||
option("--set-foo", help="Set foo")
|
||||
|
||||
|
||||
@depends("--set-foo")
|
||||
@ -16,7 +16,7 @@ def foo(value):
|
||||
set_define("FOO", foo)
|
||||
|
||||
|
||||
option("--set-bar", help="set bar")
|
||||
option("--set-bar", help="Set bar")
|
||||
|
||||
|
||||
@depends("--set-bar")
|
||||
@ -27,7 +27,7 @@ def bar(value):
|
||||
set_define("BAR", bar)
|
||||
|
||||
|
||||
option("--set-value", nargs=1, help="set value")
|
||||
option("--set-value", nargs=1, help="Set value")
|
||||
|
||||
|
||||
@depends("--set-value")
|
||||
@ -39,7 +39,7 @@ def set_value(value):
|
||||
set_define("VALUE", set_value)
|
||||
|
||||
|
||||
option("--set-name", nargs=1, help="set name")
|
||||
option("--set-name", nargs=1, help="Set name")
|
||||
|
||||
|
||||
@depends("--set-name")
|
||||
|
@ -298,7 +298,7 @@ class TestChecksConfigure(unittest.TestCase):
|
||||
config, out, status = self.get_result(
|
||||
textwrap.dedent(
|
||||
"""
|
||||
option("--with-ccache", nargs=1, help="ccache")
|
||||
option("--with-ccache", nargs=1, help="Ccache")
|
||||
check_prog("CCACHE", ("known-a",), input="--with-ccache")
|
||||
"""
|
||||
),
|
||||
@ -310,7 +310,7 @@ class TestChecksConfigure(unittest.TestCase):
|
||||
|
||||
script = textwrap.dedent(
|
||||
"""
|
||||
option(env="CC", nargs=1, help="compiler")
|
||||
option(env="CC", nargs=1, help="Compiler")
|
||||
@depends("CC")
|
||||
def compiler(value):
|
||||
return value[0].split()[0] if value else None
|
||||
@ -345,7 +345,7 @@ class TestChecksConfigure(unittest.TestCase):
|
||||
|
||||
script = textwrap.dedent(
|
||||
"""
|
||||
option(env="TARGET", nargs=1, default="linux", help="target")
|
||||
option(env="TARGET", nargs=1, default="linux", help="Target")
|
||||
@depends("TARGET")
|
||||
def compiler(value):
|
||||
if value:
|
||||
@ -725,7 +725,7 @@ class TestChecksConfigure(unittest.TestCase):
|
||||
return self.get_result(
|
||||
textwrap.dedent(
|
||||
"""\
|
||||
option('--disable-compile-environment', help='compile env')
|
||||
option('--disable-compile-environment', help='Compile env')
|
||||
compile_environment = depends(when='--enable-compile-environment')(lambda: True)
|
||||
toolchain_prefix = depends(when=True)(lambda: None)
|
||||
target_multiarch_dir = depends(when=True)(lambda: None)
|
||||
|
@ -85,7 +85,7 @@ class TestConfigure(unittest.TestCase):
|
||||
"\n"
|
||||
"Options: [defaults in brackets after descriptions]\n"
|
||||
" Help options:\n"
|
||||
" --help print this message\n"
|
||||
" --help Print this message\n"
|
||||
"\n"
|
||||
" Options from python/mozbuild/mozbuild/test/configure/data/moz.configure:\n"
|
||||
" --enable-simple Enable simple\n"
|
||||
@ -134,7 +134,7 @@ class TestConfigure(unittest.TestCase):
|
||||
"\n"
|
||||
"Options: [defaults in brackets after descriptions]\n"
|
||||
" Help options:\n"
|
||||
" --help print this message\n"
|
||||
" --help Print this message\n"
|
||||
"\n"
|
||||
" Options from python/mozbuild/mozbuild/test/configure/data/moz.configure:\n"
|
||||
" --enable-simple Enable simple\n"
|
||||
@ -614,7 +614,7 @@ class TestConfigure(unittest.TestCase):
|
||||
def test_set_config_when(self):
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option('--with-qux', help='qux')
|
||||
option('--with-qux', help='Qux')
|
||||
set_config('FOO', 'foo', when=True)
|
||||
set_config('BAR', 'bar', when=False)
|
||||
set_config('QUX', 'qux', when='--with-qux')
|
||||
@ -685,7 +685,7 @@ class TestConfigure(unittest.TestCase):
|
||||
def test_set_define_when(self):
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option('--with-qux', help='qux')
|
||||
option('--with-qux', help='Qux')
|
||||
set_define('FOO', 'foo', when=True)
|
||||
set_define('BAR', 'bar', when=False)
|
||||
set_define('QUX', 'qux', when='--with-qux')
|
||||
@ -890,7 +890,7 @@ class TestConfigure(unittest.TestCase):
|
||||
"""
|
||||
imply_option('--with-foo', 42, 'bar')
|
||||
|
||||
option('--with-foo', help='foo')
|
||||
option('--with-foo', help='Foo')
|
||||
@depends('--with-foo')
|
||||
def foo(value):
|
||||
return value
|
||||
@ -903,9 +903,9 @@ class TestConfigure(unittest.TestCase):
|
||||
def test_imply_option_when(self):
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option('--with-foo', help='foo')
|
||||
option('--with-foo', help='Foo')
|
||||
imply_option('--with-qux', True, when='--with-foo')
|
||||
option('--with-qux', help='qux')
|
||||
option('--with-qux', help='Qux')
|
||||
set_config('QUX', depends('--with-qux')(lambda x: x))
|
||||
"""
|
||||
):
|
||||
@ -928,13 +928,13 @@ class TestConfigure(unittest.TestCase):
|
||||
def test_imply_option_dependency_loop(self):
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option('--without-foo', help='foo')
|
||||
option('--without-foo', help='Foo')
|
||||
|
||||
@depends('--with-foo')
|
||||
def qux_default(foo):
|
||||
return bool(foo)
|
||||
|
||||
option('--with-qux', default=qux_default, help='qux')
|
||||
option('--with-qux', default=qux_default, help='Qux')
|
||||
|
||||
imply_option('--with-foo', depends('--with-qux')(lambda x: x or None))
|
||||
|
||||
@ -989,13 +989,13 @@ class TestConfigure(unittest.TestCase):
|
||||
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option('--with-foo', help='foo')
|
||||
option('--with-foo', help='Foo')
|
||||
|
||||
@depends('--with-foo')
|
||||
def qux_default(foo):
|
||||
return bool(foo)
|
||||
|
||||
option('--with-qux', default=qux_default, help='qux')
|
||||
option('--with-qux', default=qux_default, help='Qux')
|
||||
|
||||
imply_option('--with-foo', depends('--with-qux')(lambda x: x or None))
|
||||
|
||||
@ -1053,13 +1053,13 @@ class TestConfigure(unittest.TestCase):
|
||||
# Same test as above, but using `when` in the `imply_option`.
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option('--with-foo', help='foo')
|
||||
option('--with-foo', help='Foo')
|
||||
|
||||
@depends('--with-foo')
|
||||
def qux_default(foo):
|
||||
return bool(foo)
|
||||
|
||||
option('--with-qux', default=qux_default, help='qux')
|
||||
option('--with-qux', default=qux_default, help='Qux')
|
||||
|
||||
imply_option('--with-foo', True, when='--with-qux')
|
||||
|
||||
@ -1122,11 +1122,11 @@ class TestConfigure(unittest.TestCase):
|
||||
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option('--without-foo', help='foo')
|
||||
option('--without-foo', help='Foo')
|
||||
|
||||
imply_option('--with-qux', depends('--with-foo')(lambda x: x or None))
|
||||
|
||||
option('--with-qux', help='qux')
|
||||
option('--with-qux', help='Qux')
|
||||
|
||||
imply_option('--with-foo', depends('--with-qux')(lambda x: x or None))
|
||||
|
||||
@ -1154,12 +1154,12 @@ class TestConfigure(unittest.TestCase):
|
||||
|
||||
def test_imply_option_conflict(self):
|
||||
moz_configure = """
|
||||
option('--with-foo', help='foo')
|
||||
option('--with-env-foo', help='foo')
|
||||
option('--with-foo', help='Foo')
|
||||
option('--with-env-foo', help='Foo')
|
||||
imply_option('--with-qux', True)
|
||||
imply_option('QUX', "FOO", when='--with-env-foo')
|
||||
imply_option('--with-qux', "FOO", when='--with-foo')
|
||||
option('--with-qux', env="QUX", nargs='*', help='qux')
|
||||
option('--with-qux', env="QUX", nargs='*', help='Qux')
|
||||
set_config('QUX', depends('--with-qux')(lambda x: x))
|
||||
"""
|
||||
with self.assertRaises(ConflictingOptionError) as e:
|
||||
@ -1197,7 +1197,7 @@ class TestConfigure(unittest.TestCase):
|
||||
|
||||
def test_option_failures(self):
|
||||
with self.assertRaises(ConfigureError) as e:
|
||||
with self.moz_configure('option("--with-foo", help="foo")'):
|
||||
with self.moz_configure('option("--with-foo", help="Foo")'):
|
||||
self.get_config()
|
||||
|
||||
self.assertEqual(
|
||||
@ -1208,8 +1208,8 @@ class TestConfigure(unittest.TestCase):
|
||||
with self.assertRaises(ConfigureError) as e:
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option("--with-foo", help="foo")
|
||||
option("--with-foo", help="foo")
|
||||
option("--with-foo", help="Foo")
|
||||
option("--with-foo", help="Foo")
|
||||
"""
|
||||
):
|
||||
self.get_config()
|
||||
@ -1219,8 +1219,8 @@ class TestConfigure(unittest.TestCase):
|
||||
with self.assertRaises(ConfigureError) as e:
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option(env="MOZ_FOO", help="foo")
|
||||
option(env="MOZ_FOO", help="foo")
|
||||
option(env="MOZ_FOO", help="Foo")
|
||||
option(env="MOZ_FOO", help="Foo")
|
||||
"""
|
||||
):
|
||||
self.get_config()
|
||||
@ -1230,8 +1230,8 @@ class TestConfigure(unittest.TestCase):
|
||||
with self.assertRaises(ConfigureError) as e:
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option('--with-foo', env="MOZ_FOO", help="foo")
|
||||
option(env="MOZ_FOO", help="foo")
|
||||
option('--with-foo', env="MOZ_FOO", help="Foo")
|
||||
option(env="MOZ_FOO", help="Foo")
|
||||
"""
|
||||
):
|
||||
self.get_config()
|
||||
@ -1241,8 +1241,8 @@ class TestConfigure(unittest.TestCase):
|
||||
with self.assertRaises(ConfigureError) as e:
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option(env="MOZ_FOO", help="foo")
|
||||
option('--with-foo', env="MOZ_FOO", help="foo")
|
||||
option(env="MOZ_FOO", help="Foo")
|
||||
option('--with-foo', env="MOZ_FOO", help="Foo")
|
||||
"""
|
||||
):
|
||||
self.get_config()
|
||||
@ -1252,8 +1252,8 @@ class TestConfigure(unittest.TestCase):
|
||||
with self.assertRaises(ConfigureError) as e:
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option('--with-foo', env="MOZ_FOO", help="foo")
|
||||
option('--with-foo', help="foo")
|
||||
option('--with-foo', env="MOZ_FOO", help="Foo")
|
||||
option('--with-foo', help="Foo")
|
||||
"""
|
||||
):
|
||||
self.get_config()
|
||||
@ -1263,9 +1263,9 @@ class TestConfigure(unittest.TestCase):
|
||||
def test_option_when(self):
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option('--with-foo', help='foo', when=True)
|
||||
option('--with-bar', help='bar', when=False)
|
||||
option('--with-qux', env="QUX", help='qux', when='--with-foo')
|
||||
option('--with-foo', help='Foo', when=True)
|
||||
option('--with-bar', help='Bar', when=False)
|
||||
option('--with-qux', env="QUX", help='Qux', when='--with-foo')
|
||||
|
||||
set_config('FOO', depends('--with-foo', when=True)(lambda x: x))
|
||||
set_config('BAR', depends('--with-bar', when=False)(lambda x: x))
|
||||
@ -1336,10 +1336,10 @@ class TestConfigure(unittest.TestCase):
|
||||
|
||||
Options: [defaults in brackets after descriptions]
|
||||
Help options:
|
||||
--help print this message
|
||||
--help Print this message
|
||||
|
||||
Options from python/mozbuild/mozbuild/test/configure/data/moz.configure:
|
||||
--with-foo foo
|
||||
--with-foo Foo
|
||||
|
||||
"""
|
||||
),
|
||||
@ -1354,11 +1354,11 @@ class TestConfigure(unittest.TestCase):
|
||||
|
||||
Options: [defaults in brackets after descriptions]
|
||||
Help options:
|
||||
--help print this message
|
||||
--help Print this message
|
||||
|
||||
Options from python/mozbuild/mozbuild/test/configure/data/moz.configure:
|
||||
--with-foo foo
|
||||
--with-qux qux
|
||||
--with-foo Foo
|
||||
--with-qux Qux
|
||||
|
||||
"""
|
||||
),
|
||||
@ -1366,7 +1366,7 @@ class TestConfigure(unittest.TestCase):
|
||||
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option('--with-foo', help='foo', when=True)
|
||||
option('--with-foo', help='Foo', when=True)
|
||||
set_config('FOO', depends('--with-foo')(lambda x: x))
|
||||
"""
|
||||
):
|
||||
@ -1386,7 +1386,7 @@ class TestConfigure(unittest.TestCase):
|
||||
@depends(when=True)
|
||||
def always2():
|
||||
return True
|
||||
option('--with-foo', help='foo', when=always)
|
||||
option('--with-foo', help='Foo', when=always)
|
||||
set_config('FOO', depends('--with-foo', when=always2)(lambda x: x))
|
||||
"""
|
||||
):
|
||||
@ -1407,7 +1407,7 @@ class TestConfigure(unittest.TestCase):
|
||||
def always2():
|
||||
return True
|
||||
with only_when(always2):
|
||||
option('--with-foo', help='foo', when=always)
|
||||
option('--with-foo', help='Foo', when=always)
|
||||
# include() triggers resolution of its dependencies, and their
|
||||
# side effects.
|
||||
include(depends('--with-foo', when=always)(lambda x: x))
|
||||
@ -1421,9 +1421,9 @@ class TestConfigure(unittest.TestCase):
|
||||
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option('--with-foo', help='foo')
|
||||
option('--without-bar', help='bar', when='--with-foo')
|
||||
option('--with-qux', help='qux', when='--with-bar')
|
||||
option('--with-foo', help='Foo')
|
||||
option('--without-bar', help='Bar', when='--with-foo')
|
||||
option('--with-qux', help='Qux', when='--with-bar')
|
||||
set_config('QUX', True, when='--with-qux')
|
||||
"""
|
||||
):
|
||||
@ -1490,7 +1490,7 @@ class TestConfigure(unittest.TestCase):
|
||||
{
|
||||
os.path.join(test_data_path, "moz.configure"): textwrap.dedent(
|
||||
"""
|
||||
option('--with-foo', help='foo')
|
||||
option('--with-foo', help='Foo')
|
||||
|
||||
include('always.configure', when=True)
|
||||
include('never.configure', when=False)
|
||||
@ -1503,7 +1503,7 @@ class TestConfigure(unittest.TestCase):
|
||||
),
|
||||
os.path.join(test_data_path, "always.configure"): textwrap.dedent(
|
||||
"""
|
||||
option('--with-bar', help='bar')
|
||||
option('--with-bar', help='Bar')
|
||||
@depends('--with-bar')
|
||||
def bar(x):
|
||||
if x:
|
||||
@ -1512,7 +1512,7 @@ class TestConfigure(unittest.TestCase):
|
||||
),
|
||||
os.path.join(test_data_path, "never.configure"): textwrap.dedent(
|
||||
"""
|
||||
option('--with-qux', help='qux')
|
||||
option('--with-qux', help='Qux')
|
||||
@depends('--with-qux')
|
||||
def qux(x):
|
||||
if x:
|
||||
@ -1521,7 +1521,7 @@ class TestConfigure(unittest.TestCase):
|
||||
),
|
||||
os.path.join(test_data_path, "foo.configure"): textwrap.dedent(
|
||||
"""
|
||||
option('--with-foo-really', help='really foo')
|
||||
option('--with-foo-really', help='Really foo')
|
||||
@depends('--with-foo-really')
|
||||
def foo(x):
|
||||
if x:
|
||||
@ -1691,7 +1691,7 @@ class TestConfigure(unittest.TestCase):
|
||||
with self.assertRaises(ConfigureError) as e:
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option('--foo', help='foo')
|
||||
option('--foo', help='Foo')
|
||||
@depends('--foo')
|
||||
def foo(value):
|
||||
return value
|
||||
@ -1732,7 +1732,7 @@ class TestConfigure(unittest.TestCase):
|
||||
|
||||
set_config('BAR', bar)
|
||||
|
||||
option('--with-qux', help='qux')
|
||||
option('--with-qux', help='Qux')
|
||||
@depends(when='--with-qux')
|
||||
def qux():
|
||||
return 'qux'
|
||||
@ -1768,7 +1768,7 @@ class TestConfigure(unittest.TestCase):
|
||||
|
||||
set_config('BAR', bar)
|
||||
|
||||
option('--with-qux', help='qux')
|
||||
option('--with-qux', help='Qux')
|
||||
@depends(when='--with-qux')
|
||||
def qux():
|
||||
return 'qux'
|
||||
@ -1787,7 +1787,7 @@ class TestConfigure(unittest.TestCase):
|
||||
with self.assertRaises(TypeError) as e:
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option('--foo', help='foo')
|
||||
option('--foo', help='Foo')
|
||||
|
||||
depends('--foo')('foo')
|
||||
"""
|
||||
@ -1815,7 +1815,7 @@ class TestConfigure(unittest.TestCase):
|
||||
with self.assertRaises(ConfigureError) as e:
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option('--foo', help='foo')
|
||||
option('--foo', help='Foo')
|
||||
@imports('os')
|
||||
@depends('--foo')
|
||||
def foo(value):
|
||||
@ -1872,13 +1872,13 @@ class TestConfigure(unittest.TestCase):
|
||||
|
||||
def test_only_when(self):
|
||||
moz_configure = """
|
||||
option('--enable-when', help='when')
|
||||
option('--enable-when', help='When')
|
||||
@depends('--enable-when', '--help')
|
||||
def when(value, _):
|
||||
return bool(value)
|
||||
|
||||
with only_when(when):
|
||||
option('--foo', nargs='*', help='foo')
|
||||
option('--foo', nargs='*', help='Foo')
|
||||
@depends('--foo')
|
||||
def foo(value):
|
||||
return value
|
||||
@ -1986,7 +1986,7 @@ class TestConfigure(unittest.TestCase):
|
||||
def test_depends_unary_ops_func(self):
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option('--foo', nargs=1, help='foo')
|
||||
option('--foo', nargs=1, help='Foo')
|
||||
@depends('--foo')
|
||||
def foo(value):
|
||||
return value
|
||||
@ -2021,7 +2021,7 @@ class TestConfigure(unittest.TestCase):
|
||||
def test_depends_unary_ops_val(self):
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option("--cond", help="condition")
|
||||
option("--cond", help="Condition")
|
||||
cond = depends("--cond")(lambda c: c)
|
||||
foo = depends(when=cond)("foo")
|
||||
set_config('Foo', foo)
|
||||
@ -2052,17 +2052,17 @@ class TestConfigure(unittest.TestCase):
|
||||
def test_depends_binary_ops(self):
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option('--foo', nargs=1, help='foo')
|
||||
option('--foo', nargs=1, help='Foo')
|
||||
@depends('--foo')
|
||||
def foo(value):
|
||||
return value or 0
|
||||
|
||||
option('--bar', nargs=1, help='bar')
|
||||
option('--bar', nargs=1, help='Bar')
|
||||
@depends('--bar')
|
||||
def bar(value):
|
||||
return value or ''
|
||||
|
||||
option('--baz', nargs=1, help='baz')
|
||||
option('--baz', nargs=1, help='Baz')
|
||||
@depends('--baz')
|
||||
def baz(value):
|
||||
return value
|
||||
@ -2103,12 +2103,12 @@ class TestConfigure(unittest.TestCase):
|
||||
def test_depends_getattr(self):
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option('--foo', nargs=1, help='foo')
|
||||
option('--foo', nargs=1, help='Foo')
|
||||
@depends('--foo')
|
||||
def foo(value):
|
||||
return value
|
||||
|
||||
option('--bar', nargs=1, help='bar')
|
||||
option('--bar', nargs=1, help='Bar')
|
||||
@depends('--bar')
|
||||
def bar(value):
|
||||
return value or None
|
||||
|
@ -62,7 +62,7 @@ class TestLint(unittest.TestCase):
|
||||
def test_depends_failures(self):
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option('--foo', help='foo')
|
||||
option('--foo', help='Foo')
|
||||
@depends('--foo')
|
||||
def foo(value):
|
||||
return value
|
||||
@ -78,7 +78,7 @@ class TestLint(unittest.TestCase):
|
||||
with self.assertRaisesFromLine(ConfigureError, 7) as e:
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option('--foo', help='foo')
|
||||
option('--foo', help='Foo')
|
||||
@depends('--foo')
|
||||
def foo(value):
|
||||
return value
|
||||
@ -95,7 +95,7 @@ class TestLint(unittest.TestCase):
|
||||
with self.assertRaisesFromLine(ConfigureError, 3) as e:
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option('--foo', help='foo')
|
||||
option('--foo', help='Foo')
|
||||
@depends('--foo')
|
||||
@imports('os')
|
||||
def foo(value):
|
||||
@ -121,7 +121,7 @@ class TestLint(unittest.TestCase):
|
||||
def tmpl():
|
||||
qux = 42
|
||||
|
||||
option('--foo', help='foo')
|
||||
option('--foo', help='Foo')
|
||||
@depends('--foo')
|
||||
def foo(value):
|
||||
qux
|
||||
@ -143,7 +143,7 @@ class TestLint(unittest.TestCase):
|
||||
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option('--foo', help='foo')
|
||||
option('--foo', help='Foo')
|
||||
@depends('--foo')
|
||||
def foo(value):
|
||||
return value
|
||||
@ -156,7 +156,7 @@ class TestLint(unittest.TestCase):
|
||||
with self.assertRaisesFromLine(ConfigureError, 3) as e:
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option('--foo', help='foo')
|
||||
option('--foo', help='Foo')
|
||||
@depends('--foo')
|
||||
@imports('os')
|
||||
def foo(value):
|
||||
@ -172,7 +172,7 @@ class TestLint(unittest.TestCase):
|
||||
with self.assertRaisesFromLine(ConfigureError, 3) as e:
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option('--foo', help='foo')
|
||||
option('--foo', help='Foo')
|
||||
@depends('--foo')
|
||||
@imports('os')
|
||||
def foo(value):
|
||||
@ -192,13 +192,13 @@ class TestLint(unittest.TestCase):
|
||||
with self.assertRaisesFromLine(ConfigureError, 3) as e:
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option('--foo', help='foo')
|
||||
option('--foo', help='Foo')
|
||||
@depends('--foo')
|
||||
@imports('os')
|
||||
def foo(value):
|
||||
return value
|
||||
|
||||
option('--bar', help='bar', when=foo)
|
||||
option('--bar', help='Bar', when=foo)
|
||||
"""
|
||||
):
|
||||
self.lint_test()
|
||||
@ -209,12 +209,12 @@ class TestLint(unittest.TestCase):
|
||||
# in the past, because of the reference to the builtin False.
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option('--foo', help='foo')
|
||||
option('--foo', help='Foo')
|
||||
@depends('--foo')
|
||||
def foo(value):
|
||||
return False or value
|
||||
|
||||
option('--bar', help='bar', when=foo)
|
||||
option('--bar', help='Bar', when=foo)
|
||||
"""
|
||||
):
|
||||
self.lint_test()
|
||||
@ -228,12 +228,12 @@ class TestLint(unittest.TestCase):
|
||||
def tmpl():
|
||||
sorted = 42
|
||||
|
||||
option('--foo', help='foo')
|
||||
option('--foo', help='Foo')
|
||||
@depends('--foo')
|
||||
def foo(value):
|
||||
return sorted
|
||||
|
||||
option('--bar', help='bar', when=foo)
|
||||
option('--bar', help='Bar', when=foo)
|
||||
tmpl()
|
||||
"""
|
||||
):
|
||||
@ -245,7 +245,7 @@ class TestLint(unittest.TestCase):
|
||||
# @imports, and it's fine to use it without a dependency on --help.
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option('--foo', help='foo')
|
||||
option('--foo', help='Foo')
|
||||
@depends('--foo')
|
||||
def foo(value):
|
||||
os
|
||||
@ -259,7 +259,7 @@ class TestLint(unittest.TestCase):
|
||||
with self.assertRaisesFromLine(ConfigureError, 3) as e:
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option('--foo', help='foo')
|
||||
option('--foo', help='Foo')
|
||||
@depends('--foo')
|
||||
def foo(value):
|
||||
return
|
||||
@ -327,14 +327,14 @@ class TestLint(unittest.TestCase):
|
||||
# --enable-* with default=True is not allowed.
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option('--enable-foo', default=False, help='foo')
|
||||
option('--enable-foo', default=False, help='Foo')
|
||||
"""
|
||||
):
|
||||
self.lint_test()
|
||||
with self.assertRaisesFromLine(ConfigureError, 2) as e:
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option('--enable-foo', default=True, help='foo')
|
||||
option('--enable-foo', default=True, help='Foo')
|
||||
"""
|
||||
):
|
||||
self.lint_test()
|
||||
@ -347,14 +347,14 @@ class TestLint(unittest.TestCase):
|
||||
# --disable-* with default=False is not allowed.
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option('--disable-foo', default=True, help='foo')
|
||||
option('--disable-foo', default=True, help='Foo')
|
||||
"""
|
||||
):
|
||||
self.lint_test()
|
||||
with self.assertRaisesFromLine(ConfigureError, 2) as e:
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option('--disable-foo', default=False, help='foo')
|
||||
option('--disable-foo', default=False, help='Foo')
|
||||
"""
|
||||
):
|
||||
self.lint_test()
|
||||
@ -368,14 +368,14 @@ class TestLint(unittest.TestCase):
|
||||
# --with-* with default=True is not allowed.
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option('--with-foo', default=False, help='foo')
|
||||
option('--with-foo', default=False, help='Foo')
|
||||
"""
|
||||
):
|
||||
self.lint_test()
|
||||
with self.assertRaisesFromLine(ConfigureError, 2) as e:
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option('--with-foo', default=True, help='foo')
|
||||
option('--with-foo', default=True, help='Foo')
|
||||
"""
|
||||
):
|
||||
self.lint_test()
|
||||
@ -388,14 +388,14 @@ class TestLint(unittest.TestCase):
|
||||
# --without-* with default=False is not allowed.
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option('--without-foo', default=True, help='foo')
|
||||
option('--without-foo', default=True, help='Foo')
|
||||
"""
|
||||
):
|
||||
self.lint_test()
|
||||
with self.assertRaisesFromLine(ConfigureError, 2) as e:
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option('--without-foo', default=False, help='foo')
|
||||
option('--without-foo', default=False, help='Foo')
|
||||
"""
|
||||
):
|
||||
self.lint_test()
|
||||
@ -409,7 +409,7 @@ class TestLint(unittest.TestCase):
|
||||
# {enable|disable} rule.
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option(env='FOO', help='foo')
|
||||
option(env='FOO', help='Foo')
|
||||
option('--enable-bar', default=depends('FOO')(lambda x: bool(x)),
|
||||
help='{Enable|Disable} bar')
|
||||
"""
|
||||
@ -418,7 +418,7 @@ class TestLint(unittest.TestCase):
|
||||
with self.assertRaisesFromLine(ConfigureError, 3) as e:
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option(env='FOO', help='foo')
|
||||
option(env='FOO', help='Foo')
|
||||
option('--enable-bar', default=depends('FOO')(lambda x: bool(x)),\
|
||||
help='Enable bar')
|
||||
"""
|
||||
@ -453,11 +453,71 @@ class TestLint(unittest.TestCase):
|
||||
"can be both disabled and enabled with an optional value",
|
||||
)
|
||||
|
||||
def test_capitalize_help(self):
|
||||
with self.moz_configure("option('--some', help='Help')"):
|
||||
self.lint_test()
|
||||
|
||||
with self.assertRaisesFromLine(ConfigureError, 1) as e0:
|
||||
with self.moz_configure("option('--some', help='help')"):
|
||||
self.lint_test()
|
||||
self.assertEqual(
|
||||
str(e0.exception),
|
||||
'Invalid `help` message for option "--some": `help` is not properly capitalized',
|
||||
)
|
||||
|
||||
with self.assertRaisesFromLine(ConfigureError, 1) as e1:
|
||||
with self.moz_configure("option('--some', help='Help.')"):
|
||||
self.lint_test()
|
||||
self.assertEqual(
|
||||
str(e1.exception),
|
||||
"Invalid `help` message for option \"--some\": `Help.` should not end with a '.'",
|
||||
)
|
||||
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option(env='SOME', help='Foo', default='a')
|
||||
option('--enable-some', nargs='*', choices=('a', 'b'),
|
||||
help='{Enable|Disable} some',
|
||||
default=depends('SOME')(lambda x: x[0]))
|
||||
"""
|
||||
):
|
||||
self.lint_test()
|
||||
|
||||
with self.assertRaisesFromLine(ConfigureError, 3) as e2:
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option(env='SOME', help='Foo', default='a')
|
||||
option('--enable-some', nargs='*', choices=('a', 'b'),
|
||||
help='{enable|Disable} some',
|
||||
default=depends('SOME')(lambda x: x[0]))
|
||||
"""
|
||||
):
|
||||
self.lint_test()
|
||||
self.assertEqual(
|
||||
str(e2.exception),
|
||||
'Invalid `help` message for option "--enable-some": `enable` is not properly capitalized',
|
||||
)
|
||||
|
||||
with self.assertRaisesFromLine(ConfigureError, 3) as e3:
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option(env='SOME', help='Foo', default='a')
|
||||
option('--enable-some', nargs='*', choices=('a', 'b'),
|
||||
help='enable some',
|
||||
default=depends('SOME')(lambda x: x[0]))
|
||||
"""
|
||||
):
|
||||
self.lint_test()
|
||||
self.assertEqual(
|
||||
str(e3.exception),
|
||||
'Invalid `help` message for option "--enable-some": `enable some` is not properly capitalized',
|
||||
)
|
||||
|
||||
def test_large_offset(self):
|
||||
with self.assertRaisesFromLine(ConfigureError, 375):
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option(env='FOO', help='foo')
|
||||
option(env='FOO', help='Foo')
|
||||
"""
|
||||
+ "\n" * 371
|
||||
+ """
|
||||
@ -471,7 +531,7 @@ class TestLint(unittest.TestCase):
|
||||
with self.assertRaisesFromLine(NameError, 6) as e:
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option(env='FOO', help='foo')
|
||||
option(env='FOO', help='Foo')
|
||||
@depends('FOO')
|
||||
def foo(value):
|
||||
if value:
|
||||
@ -506,7 +566,7 @@ class TestLint(unittest.TestCase):
|
||||
with self.assertRaisesFromLine(NameError, 3) as e:
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option(env='FOO', help='foo')
|
||||
option(env='FOO', help='Foo')
|
||||
@depends('FOO')
|
||||
@imports(_from='__builtin__', _import='list')
|
||||
def foo(value):
|
||||
|
@ -10,7 +10,7 @@
|
||||
project_flag(
|
||||
env="MOZ_APP_ID",
|
||||
nargs=1,
|
||||
help='used for application.ini\'s "ID" field, and crash reporter server url',
|
||||
help='Used for application.ini\'s "ID" field, and crash reporter server url',
|
||||
)
|
||||
|
||||
|
||||
@ -23,14 +23,14 @@ def check_moz_app_id(moz_app_id, build_project):
|
||||
project_flag(
|
||||
env="MOZ_APP_VENDOR",
|
||||
nargs=1,
|
||||
help='used for application.ini\'s "Vendor" field, which also impacts profile location and user-visible fields',
|
||||
help='Used for application.ini\'s "Vendor" field, which also impacts profile location and user-visible fields',
|
||||
)
|
||||
|
||||
project_flag(
|
||||
env="MOZ_APP_UA_NAME",
|
||||
default="",
|
||||
nargs=1,
|
||||
help="application name in the User Agent string",
|
||||
help="Application name in the User Agent string",
|
||||
)
|
||||
|
||||
project_flag(
|
||||
@ -38,20 +38,20 @@ project_flag(
|
||||
default="server",
|
||||
choices=("all", "server"),
|
||||
nargs=1,
|
||||
help="which devtools version should be built",
|
||||
help="Which devtools version should be built",
|
||||
)
|
||||
|
||||
|
||||
option(
|
||||
env="MOZ_STUB_INSTALLER",
|
||||
help="produce a stub installer",
|
||||
help="Produce a stub installer",
|
||||
)
|
||||
set_config("MOZ_STUB_INSTALLER", True, when="MOZ_STUB_INSTALLER")
|
||||
|
||||
|
||||
project_flag(
|
||||
env="MOZ_PROFILE_MIGRATOR",
|
||||
help="enable profile migrator",
|
||||
help="Enable profile migrator",
|
||||
)
|
||||
|
||||
project_flag(
|
||||
@ -59,7 +59,7 @@ project_flag(
|
||||
default="",
|
||||
nargs=1,
|
||||
set_as_define=True,
|
||||
help="markup for a single browser window",
|
||||
help="Markup for a single browser window",
|
||||
)
|
||||
set_define(
|
||||
"BROWSER_CHROME_URL_QUOTED",
|
||||
@ -68,16 +68,16 @@ set_define(
|
||||
|
||||
# External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
|
||||
# explicitly set the repository and changeset information in.
|
||||
option(env="MOZ_SOURCE_REPO", nargs=1, help="project source repository")
|
||||
option(env="MOZ_SOURCE_REPO", nargs=1, help="Project source repository")
|
||||
set_config("MOZ_SOURCE_REPO", depends_if("MOZ_SOURCE_REPO")(lambda src: src[0]))
|
||||
option(env="MOZ_SOURCE_CHANGESET", nargs=1, help="source changeset")
|
||||
option(env="MOZ_SOURCE_CHANGESET", nargs=1, help="Source changeset")
|
||||
set_config("MOZ_SOURCE_CHANGESET", depends_if("MOZ_SOURCE_CHANGESET")(lambda v: v[0]))
|
||||
|
||||
option(
|
||||
env="MOZ_INCLUDE_SOURCE_INFO",
|
||||
# Build revisions should always be present in official builds
|
||||
default=mozilla_official,
|
||||
help="include build repository informations",
|
||||
help="Include build repository informations",
|
||||
)
|
||||
set_config("MOZ_INCLUDE_SOURCE_INFO", True, when="MOZ_INCLUDE_SOURCE_INFO")
|
||||
|
||||
@ -440,7 +440,7 @@ set_config("MOZ_WASAPI", imply_wasapi, when="--enable-audio-backends")
|
||||
option(
|
||||
"--enable-alsa",
|
||||
env="MOZ_ALSA",
|
||||
help="Enable ALSA audio backend.",
|
||||
help="Enable ALSA audio backend",
|
||||
when=use_pkg_config,
|
||||
)
|
||||
|
||||
@ -465,7 +465,7 @@ set_define("MOZ_ALSA", True, when="--enable-alsa")
|
||||
system_lib_option(
|
||||
"--enable-jack",
|
||||
env="MOZ_JACK",
|
||||
help="Enable JACK audio backend.",
|
||||
help="Enable JACK audio backend",
|
||||
when=use_pkg_config,
|
||||
)
|
||||
|
||||
@ -478,7 +478,7 @@ set_config("MOZ_JACK", depends_if(jack)(lambda _: True))
|
||||
option(
|
||||
"--enable-pulseaudio",
|
||||
env="MOZ_PULSEAUDIO",
|
||||
help="{Enable|Disable} PulseAudio audio backend.",
|
||||
help="{Enable|Disable} PulseAudio audio backend",
|
||||
when=use_pkg_config,
|
||||
)
|
||||
|
||||
@ -492,7 +492,7 @@ set_define("MOZ_PULSEAUDIO", depends_if(pulseaudio)(lambda _: True))
|
||||
system_lib_option(
|
||||
"--enable-sndio",
|
||||
env="MOZ_SNDIO",
|
||||
help="Enable sndio audio backend.",
|
||||
help="Enable sndio audio backend",
|
||||
when=use_pkg_config,
|
||||
)
|
||||
|
||||
@ -967,7 +967,7 @@ set_define("MOZ_WMF_CDM", True, when=wmfcdm)
|
||||
|
||||
option(
|
||||
name="--enable-chrome-format",
|
||||
help="Select FORMAT of chrome files during packaging.",
|
||||
help="Select FORMAT of chrome files during packaging",
|
||||
nargs=1,
|
||||
choices=("omni", "jar", "flat"),
|
||||
default="omni",
|
||||
@ -999,7 +999,7 @@ def enable_minify_default(is_android, debug, is_nightly):
|
||||
|
||||
option(
|
||||
name="--enable-minify",
|
||||
help="Select types of files to minify during packaging.",
|
||||
help="Select types of files to minify during packaging",
|
||||
nargs="*",
|
||||
choices=("properties", "js"),
|
||||
default=enable_minify_default,
|
||||
@ -3100,7 +3100,7 @@ option(
|
||||
nargs=1,
|
||||
help="Used for the internal program name, which affects profile name "
|
||||
"and remoting. If not set, defaults to MOZ_APP_NAME if the update channel "
|
||||
"is release, and MOZ_APP_NAME-MOZ_UPDATE_CHANNEL otherwise.",
|
||||
"is release, and MOZ_APP_NAME-MOZ_UPDATE_CHANNEL otherwise",
|
||||
)
|
||||
|
||||
|
||||
@ -3136,7 +3136,7 @@ set_config("ANDROID_PACKAGE_NAME", android_package_name)
|
||||
|
||||
# Miscellaneous options
|
||||
# ==============================================================
|
||||
option(env="MOZ_WINCONSOLE", nargs="?", help="Whether we can create a console window.")
|
||||
option(env="MOZ_WINCONSOLE", nargs="?", help="Whether we can create a console window")
|
||||
set_define("MOZ_WINCONSOLE", True, when=depends("MOZ_WINCONSOLE")(lambda x: x))
|
||||
|
||||
|
||||
@ -3426,7 +3426,7 @@ with only_when(target_is_osx):
|
||||
option(
|
||||
"--with-macbundlename-prefix",
|
||||
nargs=1,
|
||||
help="prefix for the mac bundle name",
|
||||
help="Prefix for the mac bundle name",
|
||||
)
|
||||
|
||||
@depends_if("--with-macbundlename-prefix")
|
||||
@ -3444,7 +3444,7 @@ with only_when(target_is_osx):
|
||||
|
||||
option(
|
||||
env="MOZ_PACKAGE_JSSHELL",
|
||||
help="whether the installer bundles the JS shell",
|
||||
help="Whether the installer bundles the JS shell",
|
||||
)
|
||||
set_config("MOZ_PACKAGE_JSSHELL", depends_if("MOZ_PACKAGE_JSSHELL")(lambda x: bool(x)))
|
||||
|
||||
@ -3682,7 +3682,7 @@ set_config("MOZ_SYSTEM_POLICIES", True, when="--enable-system-policies")
|
||||
option(
|
||||
"--disable-legacy-profile-creation",
|
||||
help="Disable the creation a legacy profile, to be used by old versions "
|
||||
"of Firefox, when no profiles exist.",
|
||||
"of Firefox, when no profiles exist",
|
||||
)
|
||||
|
||||
set_config("MOZ_CREATE_LEGACY_PROFILE", True, when="--enable-legacy-profile-creation")
|
||||
|
Loading…
Reference in New Issue
Block a user