o d @s:dZddlZddlZddlZddlmZgdfddZdS)z' Implementation for SCP upload method. N) dputhelpercCsg}|D]} tj| } tj|| } || qddg} |r$| d|D]} | d| g7} q&| |7} |r>|dkr>d|}nd}| d|||fd }|D]} tt| tjd ks_d }qN|rut j d |||ft j d | t | t jkrt j dt d |rdg}|D]} |d| g7}q|d||fddg|7}|rt j dt j d |t |}|t jkrt j dt d dSdSdS)z' Upload the files with scp in a batch. scpz-pz-Cz-o*z%s@z%s%s:%sriz!D: Uploading with scp to %s%s:%s zD: %s zError while uploading. sshz%s%schmod0644zD: Fixing some permissions z Error while fixing permissions. N)ospathbasenamejoinappendstatS_IMODElstatST_MODEsysstdoutwriter check_callEXIT_STATUS_SUCCESSexit)fqdnloginincomingfiles_to_uploaddebugcompressssh_config_optionsprogressremote_file_paths file_path file_nameremote_file_pathcommandanopt login_spec change_mode fix_command exit_statusr,#/usr/share/dput/dput/methods/scp.pyuploads`            r.)__doc__r rrhelperrr.r,r,r,r-s