From 0018d4b705add76f11fc75a2685a0d0d46df5d47 Mon Sep 17 00:00:00 2001 From: Corne Dorrestijn Date: Tue, 12 Aug 2014 14:23:59 +0200 Subject: [PATCH 1/2] Added a verbose mode to the bootstrap script --- script/bootstrap.py | 9 ++++++--- script/lib/util.py | 10 +++++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/script/bootstrap.py b/script/bootstrap.py index 3a687b79edc2..7d8447b886a2 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') @@ -32,7 +34,6 @@ def main(): touch_config_gypi() update_atom_shell() - def parse_args(): parser = argparse.ArgumentParser(description='Bootstrap this project') parser.add_argument('-u', '--url', @@ -41,9 +42,11 @@ 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() - def update_submodules(): execute(['git', 'submodule', 'sync']) execute(['git', 'submodule', 'update', '--init', '--recursive']) diff --git a/script/lib/util.py b/script/lib/util.py index f817150b0631..1f1d5c4fa23b 100644 --- a/script/lib/util.py +++ b/script/lib/util.py @@ -12,12 +12,17 @@ import urllib2 import os import zipfile +verbose_mode = False def tempdir(prefix=''): directory = tempfile.mkdtemp(prefix=prefix) atexit.register(shutil.rmtree, directory) return directory +def enable_verbose_execute(): + print 'Running in verbose mode' + global verbose_mode + verbose_mode = True @contextlib.contextmanager def scoped_cwd(path): @@ -126,7 +131,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 From 6d9a88f415f0544cf9c9235c81acfe147cd344eb Mon Sep 17 00:00:00 2001 From: Corne Dorrestijn Date: Tue, 12 Aug 2014 14:28:18 +0200 Subject: [PATCH 2/2] Fixed inconsistent newlines --- script/bootstrap.py | 2 ++ script/lib/util.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/script/bootstrap.py b/script/bootstrap.py index 7d8447b886a2..443a4767f815 100755 --- a/script/bootstrap.py +++ b/script/bootstrap.py @@ -34,6 +34,7 @@ def main(): touch_config_gypi() update_atom_shell() + def parse_args(): parser = argparse.ArgumentParser(description='Bootstrap this project') parser.add_argument('-u', '--url', @@ -47,6 +48,7 @@ def parse_args(): help='Prints the output of the subprocesses') return parser.parse_args() + def update_submodules(): execute(['git', 'submodule', 'sync']) execute(['git', 'submodule', 'update', '--init', '--recursive']) diff --git a/script/lib/util.py b/script/lib/util.py index 1f1d5c4fa23b..ead33ef63655 100644 --- a/script/lib/util.py +++ b/script/lib/util.py @@ -19,11 +19,13 @@ def tempdir(prefix=''): atexit.register(shutil.rmtree, directory) 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()