1 #!/usr/bin/env python 2 # 3 # Copyright 2016 Google Inc. 4 # 5 # Use of this source code is governed by a BSD-style license that can be 6 # found in the LICENSE file. 7 8 import os 9 import subprocess 10 import sys 11 12 host, serial, stamp = sys.argv[1:] 13 device = '/data/local/tmp/' + os.path.basename(host) 14 15 restrict = [] if serial == 'auto' else ['-s', serial] 16 17 # adb push is verbose, so eat its output with check_output(). 18 subprocess.check_output(['adb'] + restrict + ['push', host, device]) 19 subprocess.check_call(['adb'] + restrict + ['shell', 'chmod', '+x', device]) 20 21 # Touch a file to let GN/Ninja know we succeeded. 22 with open(stamp, 'w'): 23 pass 24