blob: 694439bf5a88924e98af3ff32cd8781c998b589d [file] [log] [blame]
Mike Klein7d921032017-01-05 12:20:41 -05001#!/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
8import os
9import subprocess
10import sys
11
12host, serial, stamp = sys.argv[1:]
13device = '/data/local/tmp/' + os.path.basename(host)
14
Mike Kleina005acc2017-01-12 10:48:19 -050015restrict = [] if serial == 'auto' else ['-s', serial]
16
Mike Klein7d921032017-01-05 12:20:41 -050017# adb push is verbose, so eat its output with check_output().
Mike Kleina005acc2017-01-12 10:48:19 -050018subprocess.check_output(['adb'] + restrict + ['push', host, device])
19subprocess.check_call(['adb'] + restrict + ['shell', 'chmod', '+x', device])
Mike Klein7d921032017-01-05 12:20:41 -050020
21# Touch a file to let GN/Ninja know we succeeded.
22with open(stamp, 'w'):
23 pass