1 # Copyright (c) 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 """A script to download files required for Remoting integration tests from GCS.
7 The script expects 2 parameters:
9 input_files: a file containing the full path in GCS to each file that is to
11 output_folder: the folder to which the specified files should be downloaded.
13 This scripts expects that its execution is done on a machine where the
14 credentials are correctly setup to obtain the required permissions for
15 downloading files from the specified GCS buckets.
27 parser
= argparse
.ArgumentParser()
28 parser
.add_argument('-f', '--files',
29 help='File specifying files to be downloaded .')
31 '-o', '--output_folder',
32 help='Folder where specified files should be downloaded .')
38 args
= parser
.parse_args()
39 if not args
.files
or not args
.output_folder
:
43 # Loop through lines in input file specifying source file locations.
44 with
open(args
.files
) as f
:
46 # Copy the file to the output folder, with same name as source file.
47 output_file
= os
.path
.join(args
.output_folder
, ntpath
.basename(line
))
48 # Download specified file from GCS.
49 cp_cmd
= ['gsutil.py', 'cp', line
, output_file
]
51 subprocess
.check_call(cp_cmd
)
52 except subprocess
.CalledProcessError
, e
:
56 if __name__
== '__main__':