Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mach Bootstrap: Support for more platforms #13226

Closed
wants to merge 7 commits into from

Add `--silent` flag to `mach bootstrap`

  • Loading branch information
UK992 committed Sep 11, 2016
commit 1847be88c70dd92a176a5cccd0f17c734fb69a4d
@@ -142,11 +142,14 @@ def env(self):
@CommandArgument('--force', '-f',
action='store_true',
help='Force reinstall packages')
def bootstrap(self, android=False, interactive=False, force=False):
@CommandArgument('--silent', '-s',
action='store_true',
help='Run bootstrap without output')
def bootstrap(self, android=False, interactive=False, force=False, silent=False):
from servo.bootstrapper.bootstrap import Bootstrapper

bootstrapper = Bootstrapper()
bootstrapper.bootstrap(android=android, interactive=interactive, force=force)
bootstrapper.bootstrap(android=android, interactive=interactive, force=force, silent=silent)

@Command('bootstrap-rust',
description='Download the Rust compiler',
@@ -13,9 +13,10 @@
class BaseBootstrapper(object):
"""Base class for system bootstrappers."""

def __init__(self, interactive=False):
def __init__(self, interactive=False, silent=False):
self.package_manager_updated = False
self.interactive = interactive
self.silent = silent

def ensure_system_packages(self):
'''
@@ -47,7 +48,11 @@ def which(self, name):
return distutils.spawn.find_executable(name)

def run(self, command):
subprocess.check_call(command, stdin=sys.stdin)
if self.silent:
FNULL = open(os.devnull, 'w')
subprocess.check_call(command, stdout=FNULL, stderr=subprocess.STDOUT)
else:
subprocess.check_call(command, stdin=sys.stdin)

def run_check(self, command):
return subprocess.call(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
@@ -61,7 +66,7 @@ def run_as_root(self, command):

print('Executing as root:', subprocess.list2cmdline(command))

subprocess.check_call(command, stdin=sys.stdin)
self.run(command)

def check_output(self, *args, **kwargs):
"""Run subprocess.check_output."""
@@ -2,6 +2,8 @@
# 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/.

# Based on Mozilla's Mozboot: https://dxr.mozilla.org/mozilla-central/source/python/mozboot

from __future__ import print_function

import platform
@@ -69,9 +71,10 @@ def __init__(self):

self.instance = cls(**args)

def bootstrap(self, android=False, interactive=False, force=False):
def bootstrap(self, android, interactive, force, silent):
self.instance.interactive = interactive
self.instance.force = force
self.instance.silent = silent

if force:
self.instance.install_system_packages()
@@ -520,7 +520,7 @@ def ensure_bootstrapped(self, target=None):

# Check for missing packages on supported platforms
try:
Registrar.dispatch("bootstrap", context=self.context)
Registrar.dispatch("bootstrap", context=self.context, silent=True)
except:
pass

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.