ok

Mini Shell

Direktori : /usr/share/lvemanager/__pycache__/
Upload File :
Current File : //usr/share/lvemanager/__pycache__/copy_directory.cpython-311.pyc

�

�o`g���d�ddlmZddlmZddlmZddlZddlZddlZddlZGd�d��ZdS)�)�print_function)�division)�absolute_importNc�\�eZdZdddejddfd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
S)�
CopyDirectory�*rFc	��||_||_||_||_||_g|_g|_||_||_||_	dS)ze
        ATTENTION: values other than '*' for parameter 'directorypattern' are not supported
        N)
�sourcedirectory�destinationdirectory�pattern�directorypattern�overwriteolder�
directorylist�filelist�copyfile�copy_file_mode�rewrite_plugin_conf)	�self�source�destinationrr
rrrrs	         �copy_directory.py�__init__zCopyDirectory.__init__sW��
 &���$/��!���� 0���,��������
� ��
�,���#6�� � � �c���td�|j����|���td��|���dS)NzGathering file list for {}z)Building directory tree and copying files)�print�formatr�walk�go)rs r�processzCopyDirectory.process#sO��
�*�1�1�$�2K�L�L�M�M�M��	�	����
�9�:�:�:����	�	�	�	�	rc�z�tj|j��D] \}}}|�||||z���!dS)zB
        Gather the list of directories and files to copy
        N)�osrr
�_copydir)r�dir�subdirs�filess    rrzCopyDirectory.walk)sN��$&�7�4�+?�#@�#@�	6�	6��C��%��M�M�$��W�u�_�5�5�5�5�	6�	6rc��|jD]}|�|���td��|jD]�\}}	tj�|��}tj�|��st	j|��|�	||��|j
rtj||����#t$r;}td�|����t|��Yd}~��d}~wwxYwdS)z�
        Perform the primary function of copying a directory
        given an already constructed directory and file list
        (generally created by walk)
        zCopy/update files...zWarning! Can not update fle: {}N)r�
copydirectoryrrr!�path�dirname�exists�makedirsrr�shutil�copymode�	Exceptionr)r�	directoryrr�filepath�es      rrzCopyDirectory.go0s���+�	*�	*�I����y�)�)�)�)�
�$�%�%�%�#'�=�	�	��F�K�	
��7�?�?�;�7�7���w�~�~�h�/�/�*��K��)�)�)��
�
�f�k�2�2�2��&�9��O�F�K�8�8�8����
�
�
��7�>�>�{�K�K�L�L�L��a�������������
����	�	s�BC�
D�1D�Dc�
�|�||��}|�||��|�|��}|D�]=}tj�||��}tj�||��}|�d��r'tj�|��r|js�|j	r�tj�|��r|tj
|��tjtj
|��tjkr|j�
||f����
td|z����!|j�
||f����?dS)z<
        Perform copying for a particular directory
        zplugin.confzskip %s (source not newer)N)�_files�_subdirectories�_directorysetupr!r(�join�endswithr*rr�stat�ST_MTIMEr�appendr)	r�argr/r%�workingfilesr�filerrs	         rr"zCopyDirectory._copydirGs\���{�{�9�e�4�4�����Y��.�.�.�#�3�3�I�>�>��!�
	<�
	<�D��W�\�\�)�T�2�2�F��'�,�,�';�T�B�B�K����}�-�-�
�"�'�.�.��2M�2M�
��0�
���"�
<�r�w�~�~�k�'B�'B�
<��7�6�?�?�4�=�1�B�G�K�4H�4H���4W�W�W��M�(�(�&�+�)>�?�?�?�?��6�&�A�B�B�B�B��
�$�$�f�k�%:�;�;�;�;�
	<�
	<rc�:�|jdkrtd���dS)zI
        Filters the list of subdirectories which will be copied
        rz&Filtering of directories not supportedN)r
r.)rr/�defaults   rr4zCopyDirectory._subdirectorieshs)��� �C�'�'��D�E�E�E�(�'rc��|fd�}|jdkr@|tjtj�||j������S||��S)z3
        create the filtered list of files
        c��g}|D]T}tj�tj�||����s|�|���U|S)N)r!r(�isdirr6r:)�valuesr/�result�values    r�	dirfilterz'CopyDirectory._files.<locals>.dirfilterysT���F��
)�
)���w�}�}�R�W�\�\�)�U�%C�%C�D�D�)��M�M�%�(�(�(���Mrr)r�globr!r(r6)rr/r?rFs    rr3zCopyDirectory._filestsf��
)2�	�	�	�	��<�3����9�T�Y�r�w�|�|�I�t�|�'L�'L�M�M�N�N�N��9�W�%�%�%rc�B�tj�|j|f��}|t	|��d�}|r |dtjkr
|dd�}tj�|j|��}|j�	|��|S)zb
        Ensure that the destination directory is available
        build it if it is not
        Nr�)
r!r(�commonprefixr
�len�sepr6rrr:)rr/�prefix�extendeddirectoryrs     rr5zCopyDirectory._directorysetup�s�����%�%�t�';�Y�&G�H�H��%�c�&�k�k�l�l�3���	6�!2�1�!5���!?�!?� 1�!�"�"� 5��!�w�|�|�D�,E�GX�Y�Y����!�!�"6�7�7�7�#�#rc�|�	tj|��td|��dS#tj$rYdSwxYw)zP
        Called after tree building,
        creates needed directories
        zmade directoryN)r!�mkdirr�error)rr/s  rr'zCopyDirectory.copydirectory�sR��	��H�Y�����"�I�.�.�.�.�.���x�	�	�	��D�D�	���s�$(�;�;N)�__name__�
__module__�__qualname__r,rrrrrr"r4r3r5r'�rrrrs�������47�#�^_� �/�%�UZ�7�7�7�7� ���6�6�6����.<�<�<�B	F�	F�	F�&�&�&�&$�$�$�&����rr)	�
__future__rrrrGr!r,r8rrUrr�<module>rWs���&�%�%�%�%�%�������&�&�&�&�&�&�����	�	�	�	�
�
�
�
�����S�S�S�S�S�S�S�S�S�Sr

Zerion Mini Shell 1.0