%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/duplicity/backends/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/duplicity/backends/__pycache__/idrivedbackend.cpython-312.pyc

�

�2eqK����ddlZddlZddlZddlZddlZddlZddlmcmZ	ddl
ZddlmZddlm
Z
ddlmZGd�dej j"�Zej j'de�y)�N)�config)�log)�BackendExceptionc�`�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zy)�
IDriveBackendc��tjjj||�||_tjj|j�|_tjd|���d|_	y)Nzparsed_url: F)
�	duplicity�backend�Backend�__init__�
parsed_url�strip_auth_from_url�
url_stringr�Debug�	connected)�selfr
s  �C/usr/lib/python3/dist-packages/duplicity/backends/idrivedbackend.pyrzIDriveBackend.__init__fs]�����!�!�*�*�4��<�%���#�+�+�?�?����P����	�	�L���-�.����c��|jS�N)r�rs r�user_connectedzIDriveBackend.user_connectedps���~�~�rc��tjd|���	|j|�\}}}||z}	ddjt
jd|���d�}tj|�}tjd|���|S#t$rt	d|����wxYw#t$r}d}Yd}~�Ed}~wwxYw)NzRequest command: z$Unknown protocol failure on request z<root>�z<[^>]+>z</root>zRequest response: )rr�subprocess_popen�KeyErrorr�join�re�findall�ET�
fromstring�	Exception)	r�commandline�_�reply�error�response�xml�el�es	         r�requestzIDriveBackend.requestss����	�	�%�k�]�3�4�	Y�"�3�3�K�@�O�A�u�e��5�=��	��2�7�7�2�:�:�i��#B�C�D�G�L�C����s�#�B�	�	�	�&�x�j�1�2��	���	Y�"�%I�+��#W�X�X�	Y���	��B��	�s"�B
�>B(�
B%�(	B=�1B8�8B=c�Z�tjjd�}|��tjd�tjd�tjd�tjd�tjd�tjd�tjd�td��tjj|d	�|_tjd
|j���tjjd�|_
|j�_tjd�tjd�tjd
�tjd�td��tjd|j���tjjd�}|�ttjd�tjd�tjd�tjd�tjd�td��tjd|���d|��|_tj�d|_d|_
n}tjjdtj�|_
	tj|j�tjd|j�d��d|_tjjd$�|_|j&�_tjd�tjd%�tjd&�tjd�td'��tjd(|j&���|j)|j|jz�d)|j���j+d*�}|j,d+d,k7rtd-|j,d.����|j,d.d/k7rtd0��|j,d1d2k7rtd3��|j,d4d5k(r�tjjd6�}|�ttjd�tjd7�tjd8�tjd9�tjd�td:��tjd;|���|xjd<|��z
c_|j)|j|jz�d=|j���j+d*�}|j,d>|_|j)|j|jzd?|j�d@|j.�dA�z�}d|_|j3dB�D]7}|j,dC|j&k(s� dD|j,dE�dF�|_�9|j0�x|j)|j�|j�dG|j&�dH|j�d@|j.�dI�	�j+dB�}dD|j,dE�dF�|_d|_tjdJ�y#t $r�}d|_|j"t"j$k(r$tjd|j�d��n{tjd�tjd|j�d ��tjd!�tjd�td"|j�d#���Yd}~���d}~wwxYw)KN�	IDEVSPATHzH------------------------------------------------------------------------zHWARNING: No path to 'idevsutil_dedup' has been set. Download module fromzZ   https://www.idrivedownloads.com/downloads/linux/download-options/IDrive_linux_64bit.zip�orzZ   https://www.idrivedownloads.com/downloads/linux/download-options/IDrive_linux_32bit.zipzTand place anywhere with exe rights. Then creat env var 'IDEVSPATH' with path to filezBNo IDEVSPATH env var set. Should contain folder to idevsutil_dedup�idevsutil_dedupzIDrive command base: �IDRIVEIDz WARNING: IDrive logon ID missingzACreate an environment variable IDriveID with your IDrive logon IDz1No IDRIVEID env var set. Should contain IDrive idzIDrive id: �	IDPWDFILEz&WARNING: IDrive password file missgingz5Please create a file with your IDrive logon password,zMThen create an environment variable IDPWDFILE with path/filename of said filez;No IDPWDFILE env var set. Should contain file with passwordzIDrive pwdpath: z --password-file=Fr�/z
Directory z1 created as fake-root (Will clean-up afterwards!)TzUsing existing directory z
 as fake-rootzWARNING: Creation of FAKEROOT z. failed; backup will use system temp directoryz-This might interfere with incremental backupszCreation of the directory z failed�IDBUCKETz%WARNING: IDrive backup bucket missingzDCreate an environment variable IDBUCKET specifying the target bucketz<No IDBUCKET env var set. Should contain IDrive backup bucketzIDrive bucket: z --validate --user=�tree�message�SUCCESSzProtocol failure - �descz
VALID ACCOUNTzIDrive account invalid�configstatus�SETzIDrive account not set�
configtype�PRIVATE�	IDKEYFILEz,WARNING: IDrive encryption key file missgingz5Please create a file with your IDrive encryption key,zMThen create an environment variable IDKEYFILE with path/filename of said filezANo IDKEYFILE env var set. Should contain file with encription keyzIDrive keypath: z --pvt-key=z --getServerAddress �cmdUtilityServerz --list-device �@z::home�item�	nick_name�5c0b�	device_id�4b5zz- --create-bucket --bucket-type=D --nick-name=z --os=Linux --uid=987654321 �::home/zUser fully connected)�os�environ�getr�Warnr�pathr�cmdr�idriveid�auth_switchr�fakeroot�cleanup�mkdir�OSError�errno�EEXIST�bucketr+�find�attrib�idriveserver�idrivedevidrr)rrI�filepathr*r)r?s      r�connectzIDriveBackend.connect�s���z�z�~�~�k�*���<��H�H�X���H�H�_�`��H�H�q�r��H�H�T�N��H�H�q�r��H�H�k�l��H�H�X��"�#g�h�h��7�7�<�<��&7�8����	�	�)�$�(�(��4�5��
�
���z�2��
��=�=� ��H�H�X���H�H�7�8��H�H�X�Y��H�H�X��"�#V�W�W��	�	�K��
�
��/�0��:�:�>�>�+�.�����H�H�X���H�H�=�>��H�H�L�M��H�H�d�e��H�H�X��"�#`�a�a��	�	�$�X�J�/�0�.�x�j�9����?�?�"� �D�L��D�M��G�G�L�L��f�o�o�>�D�M�
$�������'��	�	�J�t�}�}�o�5f�g�h�#����j�j�n�n�Z�0����;�;���H�H�X���H�H�<�=��H�H�[�\��H�H�X��"�#a�b�b��	�	�O�D�K�K�=�1�2��\�\�T�X�X��(8�(8�8�9�9L�T�]�]�O�\�
]�
b�
b�ci�
j��
�9�9�Y��9�,�"�%8����6�9J�8K�#L�M�M�
�9�9�V���/�"�#;�<�<�
�9�9�^�$��-�"�#;�<�<��9�9�\�"�i�/��z�z�~�~�k�2�H�������"����G�H����P�Q����h�i�����"�&�'j�k�k��I�I�(��
�3�4����+�h�Z� 8�8���\�\�T�X�X��(8�(8�8�9�9M�d�m�m�_�]�
^�
c�
c�dj�
k���I�I�&8�9����\�\�$�(�(�T�%5�%5�5�/�$�-�-��XY�Z^�Zk�Zk�Yl�lr�8s�s�
t������J�J�v�&�	I�D��{�{�;�'�4�;�;�6�%)�$�+�+�k�*B�)C�4�#H�� �	I����#�����8�8�*�T�-�-�.�/?�?C�{�{�m�L.��=�=�/��4�#4�#4�"5�W�>��
�d�6�l�
�"&�b�i�i��&<�%=�T�B�D������	�	�(�)��U�
`�$����7�7�e�l�l�*��I�I� 9�$�-�-��
�V�W��H�H�X�&��H�H�8�����H@�A���H�H�L�M��H�H�X�&�*�-G��
�
��V]�+^�_�_�X��
`�s�[�	^*�C^%�%^*c�@�tjjtjj|jjjd��|jjd��j�}|j|jzd|j�d|j�d|j�d|��z}	|j|�\}}}t#j$d|���t't)d�|j+�D�cgc]}|j-d	�s�|��c}��}t't)d
�|��}t't)d�|��}|S#t $r!}t#j$d�gcYd}~Sd}~wwxYwcc}w)Nr2z --auth-list --device-id=� r>rDzlist EMPTY response zlist response: c�.�tjd|�S)Nz\[|\])r�split��lines r�<lambda>z(IDriveBackend.list_raw.<locals>.<lambda>s��b�h�h�x��6�r�[c�.�ttd�|��S)Nc�"�|j�Sr)�strip��cs rr`z:IDriveBackend.list_raw.<locals>.<lambda>.<locals>.<lambda>s��a�g�g�i�r)�list�mapr^s rr`z(IDriveBackend.list_raw.<locals>.<lambda>s��$�s�4G�$�/O�*P�rc�.�ttd�|��S)Nc��|dk7S)Nr�res rr`z:IDriveBackend.list_raw.<locals>.<lambda>.<locals>.<lambda>s
���b��r)rg�filter)�colss rr`z(IDriveBackend.list_raw.<locals>.<lambda>s��$�v�7H�4�/P�*Q�r)rErIr�urllib�parse�unquoter
�lstriprM�rstriprJrLrWrKrVrr"rrrgrh�
splitlines�
startswith)r�remote_pathr#r$�lr*�x�filtereds        r�list_rawzIDriveBackend.list_rawsg���g�g�l�l��L�L� � ����!5�!5�!<�!<�S�!A�B��M�M� � ��%�
��&�(�	�

�H�H�t�'�'�'�,E�d�FV�FV�EW�WX��}�}�o�Q�t�0�0�1���
�+G�
G�	�	��+�+�K�8�G�A�q�!�	�	�	�O�A�3�'�(���6��L�L�N�@�q�a�l�l�3�.?��@�
�
����P�S[�\�]����Q�T\�]�^�����'�	��I�I�,�-��I��	��As*�E.�F�1F�.	F�7F�
F�Fc���tjd�|j�s|j�|j	d�}t
jj|j|�}tjj|jjjd��}tj|j|�tjd|j�d|���t!j"d�}|j%|�|j'd�|j(�|j*�d|j,�d	|j�d
|j.�d|j0�d|��}tjd
|���|j3|�\}}	}tjd|	���|j5�tj6|�y)N�_PUT�utf-8r2zput_file: source_path=z, remote_file=�wr�
 --device-id=� --files-from=z / r>rDzput_file put command: zput_file put response: )rrrrY�decoderErIrrMrnrorpr
rq�rename�name�tempfile�NamedTemporaryFile�write�seekrJrLrWrKrVr�close�remove)
r�source_path�remote_filename�filename�intrim_file�remote_dirpath�flist�
putrequestr$�putresponses
          r�_putzIDriveBackend._put!s����	�	�&���"�"�$��L�L�N�#�)�)�'�2���g�g�l�l�4�=�=�(�;�����-�-�d�o�o�.B�.B�.I�.I�#�.N�O��
�	�	�+�"�"�K�0��	�	�*�;�+;�+;�*<�N�8�*�U�V��+�+�C�0��
���K� �
�
�
�1�
��x�x�j��)�)�*�+��+�+�,�-�!�J�J�<�s��}�}�o�Q�t�0�0�1���8H�
J�	�	�	�	�*�:�,�7�8� �1�1�*�=���;���	�	�+�K�=�9�:�
���
�
�	�	�+�rc�L�tjd�|j�s|j�|j	d�}t
jjtjj|jjjd��|jjd�|�j�}tjd|�d|�d|�d|jj���tj �}tjd|���tj"d	�}|j%|�|j'd
�|j(�|j*�d|j,�d|j.�d
|j0�d|j2�d|��}tjd|���|j5|�\}}	}tjd|	���|j7�t
jj||jd�jd��}
tjd|
�d|j.���tj8|
|j.�t;j<|�y)N�_GETr|r2z_get: remote_filename=z
, local_path=z, remote_path=z, parsed_url.path=z(_get created temporary download folder: r}rr~rr[r>z::home/ z
get command: z_get response: z_get moving file z to final location: )rrrrYr�rErIrrnrorpr
rqrMrrr��mkdtempr�r�r�rJrLrWr�rKrVrr�r��shutil�rmtree)rr��
local_pathr�ru�tmpdirr��
getrequestr$�getresponse�downloadedSrcPaths           r�_getzIDriveBackend._getBs/���	�	�&���"�"�$��L�L�N�#�)�)�'�2���g�g�l�l��L�L� � ����!5�!5�!<�!<�S�!A�B��M�M� � ��%��
��&�(�		�	�	�	�$�X�J�m�J�<�H�&�-�'9�$�/�/�:N�:N�9O�
Q�	
��!�!�#���	�	�<�V�H�E�F��+�+�C�0��
���K� �
�
�
�1�
��x�x�j��)�)�*�+��+�+�,�-�!�J�J�<�q��}�}�o�Q�t�0�0�1���h�	
�	�	�	�	�M�*��.�/� �1�1�*�=���;���	�	�O�K�=�1�2�
���
��G�G�L�L���1C�1C�C�1H�1O�1O�PS�1T�U���	�	�%�&7�%8�8L�Z�_�_�L]�^�_�
�	�	�#�Z�_�_�5��
�
�f�rc��tjd�|j�s|j�|j	�}|D�cgc]}|d��	}}|Scc}w)N�_LIST���)rrrrYry)rrxrws   r�_listzIDriveBackend._listtsO���	�	�'���"�"�$��L�L�N��=�=�?��#+�,�a�A�b�E�,��,����-s�
Ac��tjd�|j�s|j�|j	d�}tjd�}|j|jd��|jd�tjjtjj|j jjd��|j"jd��j%�}tjd|�d|���|j&�|j(�d|j*�d	|j,�d
|j.�d|j0�d|��}tjd|���|j3|�\}}}tjd
|���|j5�y)N�_DELETEr|r}r2r�delete: z from remote file path � --delete-items --device-id=rr[r>rD�delete response: )rrrrYr�r�r�r�rqr�rErIrrnrorpr
rMrrrJrLrWr�rKrVrr�)rr�r�r�ru�
delrequestr$�delresponses        r�_deletezIDriveBackend._deletes����	�	�)���"�"�$��L�L�N�#�)�)�'�2���+�+�C�0��
���H�O�O�C�(�)�
�
�
�1�
��g�g�l�l��L�L� � ����!5�!5�!<�!<�S�!A�B��M�M� � ��%�
��&�(�	�	�	�	�H�X�J�&=�k�]�K�L��x�x�j��)�)�*�+��+�+�,�-�!�J�J�<�q��}�}�o�Q�t�0�0�1���
�	
G�	�	�	�	�H�Z�L�)�*� �1�1�*�=���;���	�	�%�k�]�3�4�	���
rc��tjd�|j�s|j�t	j
d�}|D]4}|j
|jd�jd��d���6|jd�tjjtjj|j jjd��|j"jd��j%�}tjd|���|j&�|j(�d|j*�d	|j,�d
|j.�d|j0�d|��}tjd
|���|j3|�\}}}tjd|���|j5�y)Nz_DELETE LISTr}r|r2�
rz,delete multiple files from remote file path r�rr[r>rDr�r�)rrrrYr�r�r�r�rqr�rErIrrnrorpr
rMrrrJrLrWr�rKrVrr�)r�
filename_listr�r�rur�r$r�s        r�_delete_listzIDriveBackend._delete_list�s����	�	�.�!��"�"�$��L�L�N��+�+�C�0��&�	E�H��K�K�8�?�?�7�3�:�:�3�?�@��C�D�	E�
�
�
�1�
��g�g�l�l��L�L� � ����!5�!5�!<�!<�S�!A�B��M�M� � ��%�
��&�(�	�	�	�	�@��
�N�O��x�x�j��)�)�*�+��+�+�,�-�!�J�J�<�q��}�}�o�Q�t�0�0�1���
�	
G�	�	�	�	�H�Z�L�)�*� �1�1�*�=���;���	�	�%�k�]�3�4�	���
rc��tjd�	tjd�y#t$r
}Yd}~yd}~wwxYw)Nz$Removing IDrive temp folder evs_temp�evs_temp)rrr�r�r")rr*s  r�_closezIDriveBackend._close�s3���	�	�8�9�	��M�M�*�%���	���	�s�-�	A�Ac��tjd�|j�s|j�|j	�}|r*|D�cgc]}|d|jd�k(s�|d��!}}|rdt
|d�iSddiScc}w)N�_QUERYr�r|��sizer�rrrrYryr��int)rr�rxrws    r�_queryzIDriveBackend._query�s����	�	�(���"�"�$��L�L�N��=�=�?���&.�T��!�B�%�8�?�?�7�;S�2S��!��T�H�T���C����,�-�-���|���	Us�B�)Bc�>�tjd�|j�s|j�|j	�}i}|D]K}|r*|D�cgc]}|d|jd�k(s�|d��!}}rdt
|d�i||<�Eddi||<�M|Scc}w)N�_QUERY_LISTr�r|r�r�rr�)rr�rx�infor�rw�results       r�_query_listzIDriveBackend._query_list�s����	�	�-� ��"�"�$��L�L�N��=�=�?����%�	.�H��(0�V�1�A�b�E�X�_�_�W�=U�4U�!�A�$�V��V��"(�#�f�Q�i�.�!9��X��"(�"���X��
	.����
Ws�B�0Bc�\�|jr tj|j�yyr)rNrE�rmdirrMrs r�__del__zIDriveBackend.__del__�s ���<�<��H�H�T�]�]�#�rN)�__name__�
__module__�__qualname__rrr+rYryr�r�r�r�r�r�r�r�r�rkrrrresO�����&x*�t�B�B0�d	�"�H"�H���($rr�idrived)rQrErr�r�rn�xml.etree.ElementTree�etree�ElementTreer �duplicity.backendr	rr�duplicity.errorsrr
rr�register_backendrkrr�<module>r�s_��*
�	�	�
��
�"�"����-�JP$�I�%�%�-�-�P$�f
���"�"�9�m�<r

Zerion Mini Shell 1.0