Skip to content
This repository was archived by the owner on Jan 10, 2023. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions adb/adb_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def Uninstall(self, package_name, keep_data=False, timeout_ms=None):

return self.Shell(' '.join(cmd), timeout_ms=timeout_ms)

def Push(self, source_file, device_filename, mtime='0', timeout_ms=None, progress_callback=None):
def Push(self, source_file, device_filename, mtime='0', timeout_ms=None, progress_callback=None, st_mode=None):
"""Push a file or directory to the device.

Args:
Expand All @@ -251,6 +251,7 @@ def Push(self, source_file, device_filename, mtime='0', timeout_ms=None, progres
device_filename: Destination on the device to write to.
mtime: Optional, modification time to set on the file.
timeout_ms: Expected timeout for any part of the push.
st_mode: stat mode for filename
progress_callback: callback method that accepts filename, bytes_written and total_bytes,
total_bytes will be -1 for file-like objects
"""
Expand All @@ -267,8 +268,11 @@ def Push(self, source_file, device_filename, mtime='0', timeout_ms=None, progres
with source_file:
connection = self.protocol_handler.Open(
self._handle, destination=b'sync:', timeout_ms=timeout_ms)
kwargs={}
if st_mode is not None:
kwargs['st_mode'] = st_mode
self.filesync_handler.Push(connection, source_file, device_filename,
mtime=int(mtime), progress_callback=progress_callback)
mtime=int(mtime), progress_callback=progress_callback, **kwargs)
connection.Close()

def Pull(self, device_filename, dest_file=None, timeout_ms=None, progress_callback=None):
Expand Down