o —~µ_Mã@sªddlmZe ¡ddlZddlZddlZddlZddl Z ddl Z ddl m Z ddl m Z ddl mZddl mZGdd„de jjƒZe j d e¡e jj d g¡dS) é)Ústandard_libraryN)Úconfig)Úlog)Útempdir)Úutilc@s8eZdZdZdd„Zdd„Zdd„Zdd „Zd d „Zd S) Ú NCFTPBackendz4Connect to remote store using File Transfer ProtocolcCsÚtjj ||¡zt d¡}| ¡}| ¡}Wn ty Ynw|dks'|s/t   dt j j ¡|  d¡d  ¡d}|dkrGt   dt j j¡n |d krSt  d t jj¡t  d |¡||_tj |j¡|_tj |jd ¡|_d dg|jd<|jddkrƒ|jd7_| ¡|_tjdkr‘d|_nd|_t ¡ ¡\|_ |_!t "|j d¡|_#|j# $d|jj%¡|j# $d|jj&¡|j# $d|j¡|j# ¡d|j!|jtj'f|_(|j)duré|j)dkrë|j(d|j)7_(dSdSdS)Nz ncftpls -viz=NcFTP not found: Please install NcFTP version 3.1.9 or laterÚ réz3.1.9zmNcFTP too old: Duplicity requires NcFTP version 3.1.9,3.2.1 or later. Version 3.2.0 will not work properly.z3.2.0z¡NcFTP (ncftpput) version 3.2.0 may fail with duplicity. see: http://www.ncftpd.com/ncftp/doc/changelog.html If you have trouble, please upgrade to 3.2.1 or laterzNcFTP version is %sÚncftpéiÚncftplséÿÿÿÿú/Úregularz-Ez-FÚwzhost %s zuser %s zpass %s z+-f %s %s -t %s -o useCLNT=0,useHELP_SITE=0 éz -P '%s')*Ú duplicityÚbackendÚBackendÚ__init__ÚosÚpopenÚreadÚcloseÚ ExceptionrÚ FatalErrorÚ ErrorCodeÚftp_ncftp_missingÚsplitÚftp_ncftp_too_oldÚWarnÚ WarningCodeÚftp_ncftp_v320ÚNoticeÚ parsed_urlÚstrip_auth_from_urlÚ url_stringÚ strip_prefixÚ popen_breaksÚ get_passwordÚpasswordrÚftp_connectionÚconn_optrÚdefaultÚmkstempÚtempfdÚtempnameÚfdopenÚtempfileÚwriteÚhostnameÚusernameÚtimeoutÚflagsÚport)Úselfr$ÚpÚfoutÚretÚversion©r>úA/usr/lib/python3/dist-packages/duplicity/backends/ncftpbackend.pyr'sX   ÿ ÿþý   ÿÿzNCFTPBackend.__init__c CsRt |¡}tj tj t  dd|j j¡¡|¡  ¡}d|j |j |f}| |¡dS)Nú^/Úzncftpput %s -m -V -C '%s' '%s')rÚfsdecoderÚpathÚjoinÚurllibÚparseÚunquoteÚreÚsubr$Úrstripr7Úuc_nameÚsubprocess_popen)r9Ú source_pathÚremote_filenameÚ remote_pathÚ commandliner>r>r?Ú_putes ÿÿ ÿzNCFTPBackend._putc Cs^t |¡}tj tj t  dd|j j¡¡|¡  ¡}d|j |j j | d¡|jf}| |¡dS)Nr@rAz ncftpget %s -V -C '%s' '%s' '%s'r)rrBrrCrDrErFrGrHrIr$rJr7r4ÚlstriprKrL)r9rNÚ local_pathrOrPr>r>r?Ú_getms ÿÿÿzNCFTPBackend._getcCs4d|j|jf}| |¡\}}}dd„| d¡DƒS)Nzncftpls %s -l '%s'cSs,g|]}|r| d¡st | ¡d¡‘qS)ztotal r )Ú startswithrÚfsencoder)Ú.0Úxr>r>r?Ú zs,z&NCFTPBackend._list..r)r7r&rLr)r9rPÚ_Úlr>r>r?Ú_listuszNCFTPBackend._listcCs d|j||jf}| |¡dS)Nzncftpls %s -l -X 'DELE %s' '%s')r7r&rL)r9ÚfilenamerPr>r>r?Ú_delete|s ÿzNCFTPBackend._deleteN) Ú__name__Ú __module__Ú __qualname__Ú__doc__rrQrTr\r^r>r>r>r?r%s> rz ncftp+ftp)ÚfuturerÚinstall_aliasesÚos.pathrÚurllib.requestrEÚ urllib.parseÚ urllib.errorrHÚduplicity.backendrrrrrrrrÚregister_backendÚ uses_netlocÚextendr>r>r>r?Ús     ]