@with_device
def push(local_path, remote_path):
 msg = ('Pushing %r to %r' % (local_path, remote_path))
 remote_filename = os.path.basename(local_path)
 if log.isEnabledFor(logging.DEBUG):
  msg += (' (%s)' % context.device)
 with log.waitfor(msg) as w:
  with AdbClient() as c:
   stat_ = c.stat(remote_path)
   if (not stat_):
    remote_filename = os.path.basename(remote_path)
    remote_path = os.path.dirname(remote_path)
    stat_ = c.stat(remote_path)
   if (not stat_):
    log.error(('Could not stat %r' % remote_path))
   mode = stat_['mode']
   if stat.S_ISDIR(mode):
    remote_path = os.path.join(remote_path, remote_filename)
   return c.write(remote_path, misc.read(local_path), callback=_create_adb_push_pull_callback(w))

@ with_device def push ( local_path , remote_path ) : msg = ( 'Pushing %r to %r' % ( local_path , remote_path ) ) remote_filename = os . path . basename ( local_path ) if log . isEnabledFor ( logging . DEBUG ) : msg += ( ' (%s)' % context . device ) with log . waitfor ( msg ) as w : with AdbClient ( ) as c : stat_ = c . stat ( remote_path ) if ( not stat_ ) : remote_filename = os . path . basename ( remote_path ) remote_path = os . path . dirname ( remote_path ) stat_ = c . stat ( remote_path ) if ( not stat_ ) : log . error ( ( 'Could not stat %r' % remote_path ) ) mode = stat_ [ 'mode' ] if stat . S_ISDIR ( mode ) : remote_path = os . path . join ( remote_path , remote_filename ) return c . write ( remote_path , misc . read ( local_path ) , callback = _create_adb_push_pull_callback ( w ) )
push an image onto the shared image stack .