diff --git a/script/bootstrap.py b/script/bootstrap.py index 3a687b79ed..443a4767f8 100755 --- a/script/bootstrap.py +++ b/script/bootstrap.py @@ -5,7 +5,7 @@ import os import sys from lib.config import LIBCHROMIUMCONTENT_COMMIT, BASE_URL, NODE_VERSION -from lib.util import execute, scoped_cwd +from lib.util import execute, scoped_cwd, enable_verbose_execute SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) @@ -18,6 +18,8 @@ def main(): os.chdir(SOURCE_ROOT) args = parse_args() + if args.verbose: + enable_verbose_execute() update_submodules() update_node_modules('.') update_atom_modules('atom/browser/default_app') @@ -41,6 +43,9 @@ def parse_args(): 'libchromiumcontent\'s script/upload script', default=BASE_URL, required=False) + parser.add_argument('-v', '--verbose', + action='store_true', + help='Prints the output of the subprocesses') return parser.parse_args() diff --git a/script/lib/util.py b/script/lib/util.py index f817150b06..ead33ef636 100644 --- a/script/lib/util.py +++ b/script/lib/util.py @@ -12,6 +12,7 @@ import urllib2 import os import zipfile +verbose_mode = False def tempdir(prefix=''): directory = tempfile.mkdtemp(prefix=prefix) @@ -19,6 +20,12 @@ def tempdir(prefix=''): return directory +def enable_verbose_execute(): + print 'Running in verbose mode' + global verbose_mode + verbose_mode = True + + @contextlib.contextmanager def scoped_cwd(path): cwd = os.getcwd() @@ -126,7 +133,10 @@ def safe_mkdir(path): def execute(argv): try: - return subprocess.check_output(argv, stderr=subprocess.STDOUT) + output = subprocess.check_output(argv, stderr=subprocess.STDOUT) + if verbose_mode: + print output + return output except subprocess.CalledProcessError as e: print e.output raise e