Fix mb.py presubmit.
Basically switch the indentation from 2 spaces to 4 spaces. Bug: webrtc:13413 Change-Id: Iaafdec12715b2e9bfcb0743cf53b960fdf7f371a Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/238380 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Jeremy Leconte <jleconte@google.com> Cr-Commit-Position: refs/heads/main@{#35381}
This commit is contained in:

committed by
WebRTC LUCI CQ

parent
9a478b527d
commit
6d2be9251a
@ -48,7 +48,8 @@ class MetaBuildWrapper(object):
|
||||
def __init__(self):
|
||||
self.src_dir = SRC_DIR
|
||||
self.default_config = os.path.join(SCRIPT_DIR, 'mb_config.pyl')
|
||||
self.default_isolate_map = os.path.join(SCRIPT_DIR, 'gn_isolate_map.pyl')
|
||||
self.default_isolate_map = os.path.join(
|
||||
SCRIPT_DIR, 'gn_isolate_map.pyl')
|
||||
self.executable = sys.executable
|
||||
self.platform = sys.platform
|
||||
self.sep = os.sep
|
||||
@ -97,8 +98,8 @@ class MetaBuildWrapper(object):
|
||||
help='path to isolate map file '
|
||||
'(default is %(default)s)')
|
||||
subp.add_argument('-r', '--realm', default='webrtc:try',
|
||||
help='optional LUCI realm to use (for '
|
||||
'example when triggering tasks on Swarming)')
|
||||
help='optional LUCI realm to use (for example '
|
||||
'when triggering tasks on Swarming)')
|
||||
subp.add_argument('-g', '--goma-dir',
|
||||
help='path to goma directory')
|
||||
subp.add_argument('--android-version-code',
|
||||
@ -106,8 +107,8 @@ class MetaBuildWrapper(object):
|
||||
subp.add_argument('--android-version-name',
|
||||
help='Sets GN arg android_default_version_name')
|
||||
subp.add_argument('-n', '--dryrun', action='store_true',
|
||||
help='Do a dry run (i.e., do nothing, just print '
|
||||
'the commands that will run)')
|
||||
help='Do a dry run (i.e., do nothing, just '
|
||||
'print the commands that will run)')
|
||||
subp.add_argument('-v', '--verbose', action='store_true',
|
||||
help='verbose logging')
|
||||
|
||||
@ -115,17 +116,18 @@ class MetaBuildWrapper(object):
|
||||
subps = parser.add_subparsers()
|
||||
|
||||
subp = subps.add_parser('analyze',
|
||||
help='analyze whether changes to a set of files '
|
||||
'will cause a set of binaries to be rebuilt.')
|
||||
help='analyze whether changes to a set of '
|
||||
'files will cause a set of binaries '
|
||||
'to be rebuilt.')
|
||||
AddCommonOptions(subp)
|
||||
subp.add_argument('path', nargs=1,
|
||||
help='path build was generated into.')
|
||||
subp.add_argument('input_path', nargs=1,
|
||||
help='path to a file containing the input arguments '
|
||||
'as a JSON object.')
|
||||
help='path to a file containing the input '
|
||||
'arguments as a JSON object.')
|
||||
subp.add_argument('output_path', nargs=1,
|
||||
help='path to a file containing the output arguments '
|
||||
'as a JSON object.')
|
||||
help='path to a file containing the output '
|
||||
'arguments as a JSON object.')
|
||||
subp.add_argument('--json-output',
|
||||
help='Write errors to json.output')
|
||||
subp.set_defaults(func=self.CmdAnalyze)
|
||||
@ -163,12 +165,12 @@ class MetaBuildWrapper(object):
|
||||
subp.set_defaults(func=self.CmdIsolate)
|
||||
|
||||
subp = subps.add_parser('lookup',
|
||||
help='look up the command for a given config or '
|
||||
'builder')
|
||||
help='look up the command for a given config '
|
||||
'or builder')
|
||||
AddCommonOptions(subp)
|
||||
subp.add_argument('--quiet', default=False, action='store_true',
|
||||
help='Print out just the arguments, '
|
||||
'do not emulate the output of the gen subcommand.')
|
||||
help='Print out just the arguments, do '
|
||||
'not emulate the output of the gen subcommand.')
|
||||
subp.set_defaults(func=self.CmdLookup)
|
||||
|
||||
subp = subps.add_parser(
|
||||
@ -179,8 +181,8 @@ class MetaBuildWrapper(object):
|
||||
subp.description = (
|
||||
'Build, isolate, and run the given binary with the command line\n'
|
||||
'listed in the isolate. You may pass extra arguments after the\n'
|
||||
'target; use "--" if the extra arguments need to include switches.\n'
|
||||
'\n'
|
||||
'target; use "--" if the extra arguments need to include switches.'
|
||||
'\n\n'
|
||||
'Examples:\n'
|
||||
'\n'
|
||||
' % tools/mb/mb.py run -m chromium.linux -b "Linux Builder" \\\n'
|
||||
@ -205,15 +207,15 @@ class MetaBuildWrapper(object):
|
||||
'//out/Default.'))
|
||||
subp.add_argument('-s', '--swarmed', action='store_true',
|
||||
help='Run under swarming')
|
||||
subp.add_argument('-d', '--dimension', default=[], action='append', nargs=2,
|
||||
dest='dimensions', metavar='FOO bar',
|
||||
subp.add_argument('-d', '--dimension', default=[], action='append',
|
||||
nargs=2, dest='dimensions', metavar='FOO bar',
|
||||
help='dimension to filter on')
|
||||
subp.add_argument('target', nargs=1,
|
||||
help='ninja target to build and run')
|
||||
subp.add_argument('extra_args', nargs='*',
|
||||
help=('extra args to pass to the isolate to run. Use '
|
||||
'"--" as the first arg if you need to pass '
|
||||
'switches'))
|
||||
help=('extra args to pass to the isolate to run. '
|
||||
'Use "--" as the first arg if you need to '
|
||||
'pass switches'))
|
||||
subp.set_defaults(func=self.CmdRun)
|
||||
|
||||
subp = subps.add_parser('validate',
|
||||
@ -375,7 +377,8 @@ class MetaBuildWrapper(object):
|
||||
archive_hashes = json.loads(self.ReadFile(archive_json_path))
|
||||
except Exception:
|
||||
self.Print(
|
||||
'Failed to read JSON file "%s"' % archive_json_path, file=sys.stderr)
|
||||
'Failed to read JSON file "%s"' %
|
||||
archive_json_path, file=sys.stderr)
|
||||
return 1
|
||||
try:
|
||||
cas_digest = archive_hashes[target]
|
||||
@ -478,15 +481,15 @@ class MetaBuildWrapper(object):
|
||||
for config, mixins in self.configs.items():
|
||||
for mixin in mixins:
|
||||
if not mixin in self.mixins:
|
||||
errs.append('Unknown mixin "%s" referenced by config "%s".' %
|
||||
(mixin, config))
|
||||
errs.append('Unknown mixin "%s" referenced by config "%s".'
|
||||
% (mixin, config))
|
||||
referenced_mixins.add(mixin)
|
||||
|
||||
for mixin in self.mixins:
|
||||
for sub_mixin in self.mixins[mixin].get('mixins', []):
|
||||
if not sub_mixin in self.mixins:
|
||||
errs.append('Unknown mixin "%s" referenced by mixin "%s".' %
|
||||
(sub_mixin, mixin))
|
||||
errs.append('Unknown mixin "%s" referenced by mixin "%s".'
|
||||
% (sub_mixin, mixin))
|
||||
referenced_mixins.add(sub_mixin)
|
||||
|
||||
# Check that every mixin defined is actually referenced somewhere.
|
||||
@ -495,8 +498,8 @@ class MetaBuildWrapper(object):
|
||||
errs.append('Unreferenced mixin "%s".' % mixin)
|
||||
|
||||
if errs:
|
||||
raise MBErr(('mb config file %s has problems:' % self.args.config_file) +
|
||||
'\n ' + '\n '.join(errs))
|
||||
raise MBErr(('mb config file %s has problems:' %
|
||||
self.args.config_file) + '\n ' + '\n '.join(errs))
|
||||
|
||||
if print_ok:
|
||||
self.Print('mb config file %s looks ok.' % self.args.config_file)
|
||||
@ -508,17 +511,17 @@ class MetaBuildWrapper(object):
|
||||
vals = self.DefaultVals()
|
||||
if self.args.builder or self.args.builder_group or self.args.config:
|
||||
vals = self.Lookup()
|
||||
# Re-run gn gen in order to ensure the config is consistent with the
|
||||
# build dir.
|
||||
# Re-run gn gen in order to ensure the config is consistent with
|
||||
# the build dir.
|
||||
self.RunGNGen(vals)
|
||||
return vals
|
||||
|
||||
toolchain_path = self.PathJoin(self.ToAbsPath(build_dir),
|
||||
'toolchain.ninja')
|
||||
if not self.Exists(toolchain_path):
|
||||
self.Print('Must either specify a path to an existing GN build dir '
|
||||
'or pass in a -m/-b pair or a -c flag to specify the '
|
||||
'configuration')
|
||||
self.Print('Must either specify a path to an existing GN build '
|
||||
'dir or pass in a -m/-b pair or a -c flag to specify '
|
||||
'the configuration')
|
||||
return {}
|
||||
|
||||
vals['gn_args'] = self.GNArgsFromDir(build_dir)
|
||||
@ -580,8 +583,8 @@ class MetaBuildWrapper(object):
|
||||
def ConfigFromArgs(self):
|
||||
if self.args.config:
|
||||
if self.args.builder_group or self.args.builder:
|
||||
raise MBErr('Can not specific both -c/--config and -m/--builder-group '
|
||||
'or -b/--builder')
|
||||
raise MBErr('Can not specific both -c/--config and '
|
||||
'-m/--builder-group or -b/--builder')
|
||||
|
||||
return self.args.config
|
||||
|
||||
@ -593,12 +596,16 @@ class MetaBuildWrapper(object):
|
||||
raise MBErr('Master name "%s" not found in "%s"' %
|
||||
(self.args.builder_group, self.args.config_file))
|
||||
|
||||
if not self.args.builder in self.builder_groups[self.args.builder_group]:
|
||||
if (not self.args.builder in
|
||||
self.builder_groups[self.args.builder_group]):
|
||||
raise MBErr(
|
||||
'Builder name "%s" not found under builder_groups[%s] in "%s"' %
|
||||
(self.args.builder, self.args.builder_group, self.args.config_file))
|
||||
'Builder name "%s" not found under builder_groups[%s] in "%s"'
|
||||
% (self.args.builder, self.args.builder_group,
|
||||
self.args.config_file))
|
||||
|
||||
config = self.builder_groups[self.args.builder_group][self.args.builder]
|
||||
config = (
|
||||
self.builder_groups[self.args.builder_group][self.args.builder]
|
||||
)
|
||||
if isinstance(config, dict):
|
||||
if self.args.phase is None:
|
||||
raise MBErr('Must specify a build --phase for %s on %s' %
|
||||
@ -606,7 +613,8 @@ class MetaBuildWrapper(object):
|
||||
phase = str(self.args.phase)
|
||||
if phase not in config:
|
||||
raise MBErr('Phase %s doesn\'t exist for %s on %s' %
|
||||
(phase, self.args.builder, self.args.builder_group))
|
||||
(phase, self.args.builder,
|
||||
self.args.builder_group))
|
||||
return config[phase]
|
||||
|
||||
if self.args.phase is not None:
|
||||
@ -666,8 +674,8 @@ class MetaBuildWrapper(object):
|
||||
if getattr(self.args, 'swarming_targets_file', None):
|
||||
# We need GN to generate the list of runtime dependencies for
|
||||
# the compile targets listed (one per line) in the file so
|
||||
# we can run them via swarming. We use gn_isolate_map.pyl to convert
|
||||
# the compile targets to the matching GN labels.
|
||||
# we can run them via swarming. We use gn_isolate_map.pyl to
|
||||
# convert the compile targets to the matching GN labels.
|
||||
path = self.args.swarming_targets_file
|
||||
if not self.Exists(path):
|
||||
self.WriteFailureAndRaise('"%s" does not exist' % path,
|
||||
@ -676,7 +684,8 @@ class MetaBuildWrapper(object):
|
||||
swarming_targets = set(contents.splitlines())
|
||||
|
||||
isolate_map = self.ReadIsolateMap()
|
||||
err, labels = self.MapTargetsToLabels(isolate_map, swarming_targets)
|
||||
err, labels = self.MapTargetsToLabels(
|
||||
isolate_map, swarming_targets)
|
||||
if err:
|
||||
raise MBErr(err)
|
||||
|
||||
@ -690,16 +699,18 @@ class MetaBuildWrapper(object):
|
||||
# write errors to json.output
|
||||
self.WriteJSON({'output': output}, self.args.json_output)
|
||||
# If `gn gen` failed, we should exit early rather than trying to
|
||||
# generate isolates. Run() will have already logged any error output.
|
||||
# generate isolates. Run() will have already logged any error
|
||||
# output.
|
||||
self.Print('GN gen failed: %d' % ret)
|
||||
return ret
|
||||
|
||||
android = 'target_os="android"' in vals['gn_args']
|
||||
for target in swarming_targets:
|
||||
if android:
|
||||
# Android targets may be either android_apk or executable. The former
|
||||
# will result in runtime_deps associated with the stamp file, while the
|
||||
# latter will result in runtime_deps associated with the executable.
|
||||
# Android targets may be either android_apk or executable. The
|
||||
# former will result in runtime_deps associated with the stamp
|
||||
# file, while the latter will result in runtime_deps associated
|
||||
# with the executable.
|
||||
label = isolate_map[target]['label']
|
||||
runtime_deps_targets = [
|
||||
target + '.runtime_deps',
|
||||
@ -820,7 +831,8 @@ class MetaBuildWrapper(object):
|
||||
if isolate_map[stripped_target]['type'] == 'unknown':
|
||||
err += ('test target "%s" type is unknown\n' % target)
|
||||
else:
|
||||
labels.append(isolate_map[stripped_target]['label'] + suffix)
|
||||
labels.append(
|
||||
isolate_map[stripped_target]['label'] + suffix)
|
||||
else:
|
||||
err += ('target "%s" not found in '
|
||||
'//testing/buildbot/gn_isolate_map.pyl\n' % target)
|
||||
@ -838,15 +850,14 @@ class MetaBuildWrapper(object):
|
||||
gn_path = self.PathJoin(self.src_dir, 'buildtools', subdir, exe)
|
||||
return [gn_path, subcommand, path] + list(args)
|
||||
|
||||
|
||||
def GNArgs(self, vals):
|
||||
if vals['cros_passthrough']:
|
||||
if not 'GN_ARGS' in os.environ:
|
||||
raise MBErr('MB is expecting GN_ARGS to be in the environment')
|
||||
gn_args = os.environ['GN_ARGS']
|
||||
if not re.search('target_os.*=.*"chromeos"', gn_args):
|
||||
raise MBErr('GN_ARGS is missing target_os = "chromeos": (GN_ARGS=%s)' %
|
||||
gn_args)
|
||||
raise MBErr('GN_ARGS is missing target_os = "chromeos": '
|
||||
'(GN_ARGS=%s)' % gn_args)
|
||||
else:
|
||||
gn_args = vals['gn_args']
|
||||
|
||||
@ -855,11 +866,13 @@ class MetaBuildWrapper(object):
|
||||
|
||||
android_version_code = self.args.android_version_code
|
||||
if android_version_code:
|
||||
gn_args += ' android_default_version_code="%s"' % android_version_code
|
||||
gn_args += (' android_default_version_code="%s"' %
|
||||
android_version_code)
|
||||
|
||||
android_version_name = self.args.android_version_name
|
||||
if android_version_name:
|
||||
gn_args += ' android_default_version_name="%s"' % android_version_name
|
||||
gn_args += (' android_default_version_name="%s"' %
|
||||
android_version_name)
|
||||
|
||||
# Canonicalize the arg string into a sorted, newline-separated list
|
||||
# of key-value pairs, and de-dup the keys if need be so that only
|
||||
@ -879,12 +892,14 @@ class MetaBuildWrapper(object):
|
||||
is_linux = self.platform.startswith('linux') and not is_android
|
||||
|
||||
if test_type == 'nontest':
|
||||
self.WriteFailureAndRaise('We should not be isolating %s.' % target,
|
||||
output_path=None)
|
||||
self.WriteFailureAndRaise('We should not be isolating %s.' %
|
||||
target, output_path=None)
|
||||
if test_type not in ('console_test_launcher', 'windowed_test_launcher',
|
||||
'non_parallel_console_test_launcher', 'raw',
|
||||
'additional_compile_target', 'junit_test', 'script'):
|
||||
self.WriteFailureAndRaise('No command line for %s found (test type %s).'
|
||||
'additional_compile_target', 'junit_test',
|
||||
'script'):
|
||||
self.WriteFailureAndRaise('No command line for '
|
||||
'%s found (test type %s).'
|
||||
% (target, test_type), output_path=None)
|
||||
|
||||
cmdline = []
|
||||
@ -895,7 +910,8 @@ class MetaBuildWrapper(object):
|
||||
|
||||
must_retry = False
|
||||
if test_type == 'script':
|
||||
cmdline += ['../../' + self.ToSrcRelPath(isolate_map[target]['script'])]
|
||||
cmdline += ['../../' +
|
||||
self.ToSrcRelPath(isolate_map[target]['script'])]
|
||||
elif is_android:
|
||||
cmdline += ['../../build/android/test_wrapper/logdog_wrapper.py',
|
||||
'--target', target,
|
||||
@ -908,8 +924,10 @@ class MetaBuildWrapper(object):
|
||||
extra_files.append('../../tools_webrtc/flags_compatibility.py')
|
||||
|
||||
if isolate_map[target].get('use_webcam', False):
|
||||
cmdline.append('../../tools_webrtc/ensure_webcam_is_running.py')
|
||||
extra_files.append('../../tools_webrtc/ensure_webcam_is_running.py')
|
||||
cmdline.append(
|
||||
'../../tools_webrtc/ensure_webcam_is_running.py')
|
||||
extra_files.append(
|
||||
'../../tools_webrtc/ensure_webcam_is_running.py')
|
||||
|
||||
# is_linux uses use_ozone and x11 by default.
|
||||
use_x11 = is_linux
|
||||
@ -934,14 +952,16 @@ class MetaBuildWrapper(object):
|
||||
'../../tools_webrtc/gtest-parallel-wrapper.py',
|
||||
'--output_dir=%s' % output_dir,
|
||||
'--gtest_color=no',
|
||||
# We tell gtest-parallel to interrupt the test after 900 seconds,
|
||||
# so it can exit cleanly and report results, instead of being
|
||||
# interrupted by swarming and not reporting anything.
|
||||
# We tell gtest-parallel to interrupt the test after 900
|
||||
# seconds, so it can exit cleanly and report results,
|
||||
# instead of being interrupted by swarming and not
|
||||
# reporting anything.
|
||||
'--timeout=%s' % timeout,
|
||||
]
|
||||
if test_type == 'non_parallel_console_test_launcher':
|
||||
# Still use the gtest-parallel-wrapper.py script since we need it to
|
||||
# run tests on swarming, but don't execute tests in parallel.
|
||||
# Still use the gtest-parallel-wrapper.py script since we
|
||||
# need it to run tests on swarming, but don't execute tests
|
||||
# in parallel.
|
||||
cmdline.append('--workers=1')
|
||||
must_retry = True
|
||||
|
||||
@ -1003,12 +1023,12 @@ class MetaBuildWrapper(object):
|
||||
self.PrintJSON(inp)
|
||||
self.Print()
|
||||
|
||||
|
||||
# This shouldn't normally happen, but could due to unusual race conditions,
|
||||
# like a try job that gets scheduled before a patch lands but runs after
|
||||
# the patch has landed.
|
||||
# This shouldn't normally happen, but could due to unusual race
|
||||
# conditions, like a try job that gets scheduled before a patch
|
||||
# lands but runs after the patch has landed.
|
||||
if not inp['files']:
|
||||
self.Print('Warning: No files modified in patch, bailing out early.')
|
||||
self.Print(
|
||||
'Warning: No files modified in patch, bailing out early.')
|
||||
self.WriteJSON({
|
||||
'status': 'No dependency',
|
||||
'compile_targets': [],
|
||||
@ -1017,7 +1037,8 @@ class MetaBuildWrapper(object):
|
||||
return 0
|
||||
|
||||
gn_inp = {}
|
||||
gn_inp['files'] = ['//' + f for f in inp['files'] if not f.startswith('//')]
|
||||
gn_inp['files'] = ['//' + f for f in inp['files']
|
||||
if not f.startswith('//')]
|
||||
|
||||
isolate_map = self.ReadIsolateMap()
|
||||
err, gn_inp['additional_compile_targets'] = self.MapTargetsToLabels(
|
||||
@ -1035,7 +1056,8 @@ class MetaBuildWrapper(object):
|
||||
|
||||
try:
|
||||
self.WriteJSON(gn_inp, gn_input_path)
|
||||
cmd = self.GNCmd('analyze', build_path, gn_input_path, gn_output_path)
|
||||
cmd = self.GNCmd('analyze', build_path,
|
||||
gn_input_path, gn_output_path)
|
||||
ret, output, _ = self.Run(cmd, force_verbose=True)
|
||||
if ret:
|
||||
if self.args.json_output:
|
||||
@ -1047,8 +1069,8 @@ class MetaBuildWrapper(object):
|
||||
try:
|
||||
gn_outp = json.loads(gn_outp_str)
|
||||
except Exception as e:
|
||||
self.Print("Failed to parse the JSON string GN returned: %s\n%s"
|
||||
% (repr(gn_outp_str), str(e)))
|
||||
self.Print("Failed to parse the JSON string GN "
|
||||
"returned: %s\n%s" % (repr(gn_outp_str), str(e)))
|
||||
raise
|
||||
|
||||
outp = {}
|
||||
@ -1063,10 +1085,14 @@ class MetaBuildWrapper(object):
|
||||
outp['compile_targets'] = ['all']
|
||||
else:
|
||||
outp['compile_targets'] = [
|
||||
label.replace('//', '') for label in gn_outp['compile_targets']]
|
||||
label.replace('//', '')
|
||||
for label in gn_outp['compile_targets']
|
||||
]
|
||||
if 'test_targets' in gn_outp:
|
||||
outp['test_targets'] = [
|
||||
labels_to_targets[label] for label in gn_outp['test_targets']]
|
||||
labels_to_targets[label]
|
||||
for label in gn_outp['test_targets']
|
||||
]
|
||||
|
||||
if self.args.verbose:
|
||||
self.Print()
|
||||
@ -1088,18 +1114,19 @@ class MetaBuildWrapper(object):
|
||||
path = self.args.input_path[0]
|
||||
output_path = self.args.output_path[0]
|
||||
if not self.Exists(path):
|
||||
self.WriteFailureAndRaise('"%s" does not exist' % path, output_path)
|
||||
self.WriteFailureAndRaise(
|
||||
'"%s" does not exist' % path, output_path)
|
||||
|
||||
try:
|
||||
inp = json.loads(self.ReadFile(path))
|
||||
except Exception as e:
|
||||
self.WriteFailureAndRaise('Failed to read JSON input from "%s": %s' %
|
||||
(path, e), output_path)
|
||||
self.WriteFailureAndRaise('Failed to read JSON input from "%s": %s'
|
||||
% (path, e), output_path)
|
||||
|
||||
for k in required_keys:
|
||||
if not k in inp:
|
||||
self.WriteFailureAndRaise('input file is missing a "%s" key' % k,
|
||||
output_path)
|
||||
self.WriteFailureAndRaise('input file is missing a "%s" key' %
|
||||
k, output_path)
|
||||
|
||||
return inp
|
||||
|
||||
@ -1110,7 +1137,8 @@ class MetaBuildWrapper(object):
|
||||
|
||||
def WriteJSON(self, obj, path, force_verbose=False):
|
||||
try:
|
||||
self.WriteFile(path, json.dumps(obj, indent=2, sort_keys=True) + '\n',
|
||||
self.WriteFile(path,
|
||||
json.dumps(obj, indent=2, sort_keys=True) + '\n',
|
||||
force_verbose=force_verbose)
|
||||
except Exception as e:
|
||||
raise MBErr('Error %s writing to the output path "%s"' %
|
||||
@ -1145,7 +1173,8 @@ class MetaBuildWrapper(object):
|
||||
if self.args.jobs:
|
||||
ninja_cmd.extend(['-j', '%d' % self.args.jobs])
|
||||
ninja_cmd.append(target)
|
||||
ret, _, _ = self.Run(ninja_cmd, force_verbose=False, buffer_output=False)
|
||||
ret, _, _ = self.Run(
|
||||
ninja_cmd, force_verbose=False, buffer_output=False)
|
||||
return ret
|
||||
|
||||
def Run(self, cmd, env=None, force_verbose=True, buffer_output=True):
|
||||
@ -1168,7 +1197,8 @@ class MetaBuildWrapper(object):
|
||||
def Call(self, cmd, env=None, buffer_output=True):
|
||||
if buffer_output:
|
||||
p = subprocess.Popen(cmd, shell=False, cwd=self.src_dir,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
env=env)
|
||||
out, err = p.communicate()
|
||||
else:
|
||||
@ -1227,9 +1257,9 @@ class MetaBuildWrapper(object):
|
||||
if self.platform == 'win32':
|
||||
# In other places in chromium, we often have to retry this command
|
||||
# because we're worried about other processes still holding on to
|
||||
# file handles, but when MB is invoked, it will be early enough in the
|
||||
# build that their should be no other processes to interfere. We
|
||||
# can change this if need be.
|
||||
# file handles, but when MB is invoked, it will be early enough in
|
||||
# the build that their should be no other processes to interfere.
|
||||
# We can change this if need be.
|
||||
self.Run(['cmd.exe', '/c', 'rmdir', '/q', '/s', abs_path])
|
||||
else:
|
||||
shutil.rmtree(abs_path, ignore_errors=True)
|
||||
|
Reference in New Issue
Block a user