Mini Shell

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

�

�o�i����ddlmZddlmZddlmZddlmZddlmZej��ddlTddl	Z	ddl
Z
ddlZddlZGd�d	e
��ZdS)
�)�print_function)�absolute_import)�division)�unicode_literals)�standard_library)�*Nc�X�eZdZdddejfd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
dS)
�
CopyDirectoryrrc�v�||_||_||_||_||_g|_g|_||_dS)ze
        ATTENTION: values other than '*' for parameter 'directorypattern' are not supported
        N)�sourcedirectory�destinationdirectory�pattern�directorypattern�overwriteolder�
directorylist�filelist�copyfile)�self�source�destinationrrrrs       �+/usr/share/cagefs-plugins/copy_directory.py�__init__zCopyDirectory.__init__sE��
 &���$/��!���� 0���,��������
� ��
�
�
�c��td��|���td��|���dS)NzGathering file listz)Building directory tree and copying files)�print�walk�go)rs r�processzCopyDirectory.process#s>��
�#�$�$�$��	�	����
�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��%'�G�D�,@�$A�$A�	7�	7� �D�'�5��M�M�$��g��o�6�6�6�6�	7�	7rc��|jD]}|�|���|jD]/\}}t|�d|����|�||���0dS)z�
        Perform the primary function of copying a directory
        given an already constructed directory and file list
        (generally created by walk)
        z --> N)r�
copydirectoryrrr)r�	directoryrrs    rrzCopyDirectory.go.s}���+�	+�	+�I����	�*�*�*�*�#'�=�	0�	0��F�K��v�v�v�{�{�3�4�4�4��M�M�6�;�/�/�/�/�	0�	0rc��|�||��}|�||��|�|��}|D]�}tj�||��}tj�||��}|jr�tj�|��rztj|��tj	tj|��tj	kr|j
�||f����td|z����|j
�||f����dS)z<
        Perform copying for a particular directory
        zskip %s (source not newer)N)
�_files�_subdirectories�_directorysetupr �path�joinr�exists�stat�ST_MTIMEr�appendr)	r�argr'r$�workingfilesr
�filerrs	         rr!zCopyDirectory._copydir;s'���{�{�I�u�5�5�����i��/�/�/�#�3�3�Y�@�@��!�
	>�
	>�D��W�\�\�9�d�3�3�F��'�,�,�(<�d�C�C�K��"�
>�r�w�~�~�{�'C�'C�
>��7�F�$�$�T�]�3�b�g�{�6L�6L�T�]�6[�[�[��M�(�(�6�;�*?�A�A�A�A��6��?�@�@�@�@��
�$�$�v�{�&;�=�=�=�=�
	>�
	>rc�:�|jdkrtd���dS)zI
        Filters the list of subdirectories which will be copied
        rz&Filtering of directories not supportedN)r�	Exception)rr'�defaults   rr*zCopyDirectory._subdirectoriesWs)��� �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,�isdirr-r1)�valuesr'�result�values    r�	dirfilterz'CopyDirectory._files.<locals>.dirfilteresT���F��
*�
*���w�}�}�b�g�l�l�I�u�&E�&E�F�F�*��M�M�5�)�)�)���Mrr)r�globr r,r-)rr'r7r>s    rr)zCopyDirectory._filesasf��)2�	�	�	�	��<�3����9�d�i�����y�$�,�)O�)O�Q�Q�S�S�S��9�g�'�'�'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�sepr-r
rr1)rr'�prefix�extendeddirectoryr
s     rr+zCopyDirectory._directorysetupps�����%�%��(<�i�'H�J�J��%�c�&�k�k�l�l�3���	6�!2�A�!6�"�&�!@�!@� 1�!�"�"� 5��!�w�|�|�T�-F�HY�Z�Z����!�!�#7�8�8�8�#�#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�i�!�!�!��"�I�.�.�.�.�.���x�	�	�	��D�D�	���s�$(�;�;N)�__name__�
__module__�__qualname__�shutilrrrrrr!r*r)r+r&�rrr
r
s�������58�C�#$���!�!�!�!����
7�7�7�0�0�0�>�>�>�8	F�	F�	F�(�(�(�$�$�$�"����rr
)�
__future__rrrr�futurer�install_aliases�builtinsr?r rMr/�objectr
rNrr�<module>rTs���&�%�%�%�%�%�&�&�&�&�&�&�������'�'�'�'�'�'�#�#�#�#�#�#� �� �"�"�"���������	�	�	�	�
�
�
�
�����w�w�w�w�w�F�w�w�w�w�wr