From 10228331206aad94ae3e1e48cf6f1afcc0e60ee8 Mon Sep 17 00:00:00 2001 From: Or Barzilay Date: Thu, 3 May 2018 18:09:33 +0300 Subject: [PATCH] AdbCommands.Push(): Added st_mode parameter. --- adb/adb_commands.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/adb/adb_commands.py b/adb/adb_commands.py index 9d107d9..42717fe 100644 --- a/adb/adb_commands.py +++ b/adb/adb_commands.py @@ -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: @@ -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 """ @@ -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):