Enable passing --commit to download script.

This commit is contained in:
Cheng Zhao 2014-01-30 22:01:22 +08:00
parent 5cf32f1f9c
commit a8f34982a0

View file

@ -15,11 +15,13 @@ DOWNLOAD_DIR = os.path.join(VENDOR_DIR, 'download')
def main():
args = parse_args()
return (update_submodules() or
download_libchromiumcontent(args.url))
download_libchromiumcontent(args.commit, args.url))
def parse_args():
parser = argparse.ArgumentParser(description='Bootstrap this project')
parser.add_argument('-c', '--commit', nargs='?', default='HEAD',
help='The commit of libchromiumcontent to download.')
parser.add_argument('url', help='The base URL from which to download '
'libchromiumcontent (i.e., the URL you passed to '
'libchromiumcontent\'s script/upload script')
@ -32,11 +34,11 @@ def update_submodules():
'--recursive']))
def download_libchromiumcontent(url):
def download_libchromiumcontent(commit, url):
mkdir_p(DOWNLOAD_DIR)
download = os.path.join(VENDOR_DIR, 'libchromiumcontent', 'script',
'download')
return subprocess.call([sys.executable, download, '-f', url,
return subprocess.call([sys.executable, download, '-f', '-c', commit, url,
os.path.join(DOWNLOAD_DIR, 'libchromiumcontent')])