2017-01-05 17:20:41 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
#
|
|
|
|
# Copyright 2016 Google Inc.
|
|
|
|
#
|
|
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
|
|
# found in the LICENSE file.
|
|
|
|
|
|
|
|
import os
|
|
|
|
import subprocess
|
|
|
|
import sys
|
|
|
|
|
|
|
|
host, serial, stamp = sys.argv[1:]
|
|
|
|
device = '/data/local/tmp/' + os.path.basename(host)
|
|
|
|
|
2017-01-12 15:48:19 +00:00
|
|
|
restrict = [] if serial == 'auto' else ['-s', serial]
|
|
|
|
|
2017-01-05 17:20:41 +00:00
|
|
|
# adb push is verbose, so eat its output with check_output().
|
2017-01-12 15:48:19 +00:00
|
|
|
subprocess.check_output(['adb'] + restrict + ['push', host, device])
|
|
|
|
subprocess.check_call(['adb'] + restrict + ['shell', 'chmod', '+x', device])
|
2017-01-05 17:20:41 +00:00
|
|
|
|
|
|
|
# Touch a file to let GN/Ninja know we succeeded.
|
|
|
|
with open(stamp, 'w'):
|
|
|
|
pass
|