mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Backed out changeset 9b5ebc2d3b4b (bug 1877347) as requested by Aryx on element. CLOSED TREE
This commit is contained in:
parent
664c1ecf7c
commit
ac412e192f
@ -115,18 +115,3 @@ def to_optional_str(path: Optional[Path]):
|
||||
return str(path)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def strtobool(value: str):
|
||||
# Reimplementation of distutils.util.strtobool
|
||||
# https://docs.python.org/3.9/distutils/apiref.html#distutils.util.strtobool
|
||||
true_vals = ("y", "yes", "t", "true", "on", "1")
|
||||
false_vals = ("n", "no", "f", "false", "off", "0")
|
||||
|
||||
value = value.lower()
|
||||
if value in true_vals:
|
||||
return 1
|
||||
if value in false_vals:
|
||||
return 0
|
||||
|
||||
raise ValueError(f'Expected one of: {", ".join(true_vals + false_vals)}')
|
||||
|
@ -409,7 +409,7 @@ def get_clang_tools(command_context, clang_tools_path):
|
||||
|
||||
def prompt_bool(prompt, limit=5):
|
||||
"""Prompts the user with prompt and requires a boolean value."""
|
||||
from mach.util import strtobool
|
||||
from distutils.util import strtobool
|
||||
|
||||
for _ in range(limit):
|
||||
try:
|
||||
|
@ -51,7 +51,7 @@ def build_repo_relative_path(abs_path, repo_path):
|
||||
|
||||
def prompt_bool(prompt, limit=5):
|
||||
"""Prompts the user with prompt and requires a boolean value."""
|
||||
from mach.util import strtobool
|
||||
from distutils.util import strtobool
|
||||
|
||||
for _ in range(limit):
|
||||
try:
|
||||
|
@ -13,10 +13,10 @@ import shutil
|
||||
import tempfile
|
||||
import time
|
||||
from contextlib import AsyncExitStack
|
||||
from distutils.util import strtobool
|
||||
from pathlib import Path
|
||||
|
||||
import aiohttp
|
||||
from mach.util import strtobool
|
||||
from mardor.reader import MarReader
|
||||
from mardor.signing import get_keysize
|
||||
from scriptworker.utils import get_hash, retry_async
|
||||
|
@ -17,11 +17,23 @@ from functools import partial
|
||||
import gecko_taskgraph.main
|
||||
from gecko_taskgraph.main import commands as taskgraph_commands
|
||||
from mach.decorators import Command, CommandArgument, SubCommand
|
||||
from mach.util import strtobool
|
||||
|
||||
logger = logging.getLogger("taskcluster")
|
||||
|
||||
|
||||
def strtobool(value):
|
||||
"""Convert string to boolean.
|
||||
|
||||
Wraps "distutils.util.strtobool", deferring the import of the package
|
||||
in case it's not installed. Otherwise, we have a "chicken and egg problem" where
|
||||
|mach bootstrap| would install the required package to enable "distutils.util", but
|
||||
it can't because mach fails to interpret this file.
|
||||
"""
|
||||
from distutils.util import strtobool
|
||||
|
||||
return bool(strtobool(value))
|
||||
|
||||
|
||||
def get_taskgraph_command_parser(name):
|
||||
"""Given a command name, obtain its argument parser.
|
||||
|
||||
@ -47,7 +59,7 @@ def get_taskgraph_decision_parser():
|
||||
(
|
||||
["--optimize-target-tasks"],
|
||||
{
|
||||
"type": lambda flag: bool(strtobool(flag)),
|
||||
"type": lambda flag: strtobool(flag),
|
||||
"nargs": "?",
|
||||
"const": "true",
|
||||
"help": "If specified, this indicates whether the target "
|
||||
|
Loading…
Reference in New Issue
Block a user