push_to_android.py 631 B

1234567891011121314151617181920212223
  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. import os
  8. import subprocess
  9. import sys
  10. host, serial, stamp = sys.argv[1:]
  11. device = '/data/local/tmp/' + os.path.basename(host)
  12. restrict = [] if serial == 'auto' else ['-s', serial]
  13. # adb push is verbose, so eat its output with check_output().
  14. subprocess.check_output(['adb'] + restrict + ['push', host, device])
  15. subprocess.check_call(['adb'] + restrict + ['shell', 'chmod', '+x', device])
  16. # Touch a file to let GN/Ninja know we succeeded.
  17. with open(stamp, 'w'):
  18. pass