@@ -44,10 +44,24 @@ def rmdir(path):
44
44
shell (['rm' , '-rf' , '{}/*' .format (path )])
45
45
46
46
47
- def push (local_path , device_path ):
48
- """Move the file at the given local path to the path on the device."""
49
- return subprocess .check_output (['adb' , 'push' , local_path , device_path ],
50
- stderr = subprocess .STDOUT ).strip ()
47
+ def push (local_paths , device_path ):
48
+ """Move the files at the given local paths to the path on the device."""
49
+ if isinstance (local_paths , str ):
50
+ local_paths = [local_paths ]
51
+ try :
52
+ # In recent versions of ADB, push supports --sync, which checksums the
53
+ # files to be transmitted and skip the ones that haven't changed, which
54
+ # improves the effective transfer speed.
55
+ return subprocess .check_output (
56
+ ['adb' , 'push' , '--sync' ] + local_paths + [device_path ],
57
+ stderr = subprocess .STDOUT ).strip ()
58
+ except subprocess .CalledProcessError as e :
59
+ if "unrecognized option '--sync'" in e .output :
60
+ return subprocess .check_output (
61
+ ['adb' , 'push' ] + local_paths + [device_path ],
62
+ stderr = subprocess .STDOUT ).strip ()
63
+ else :
64
+ raise e
51
65
52
66
53
67
def reboot ():
0 commit comments