Your IP : 18.118.19.89


Current Path : /opt/alt/python311/lib64/python3.11/distutils/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/distutils/__pycache__/file_util.cpython-311.pyc

�

c��f���\�dZddlZddlmZddlmZdddd�Zdd
�Z		dd�Z		dd
�Z	d�Z
dS)zFdistutils.file_util

Utility functions for operating on single files.
�N)�DistutilsFileError)�log�copyingzhard linkingzsymbolically linking)N�hard�sym�@c��d}d}		t|d��}n,#t$r}td|�d|j�����d}~wwxYwtj�|��rB	t	j|��n,#t$r}td|�d|j�����d}~wwxYw	t|d��}n,#t$r}td|�d|j�����d}~wwxYw		|�|��}n,#t$r}td	|�d|j�����d}~wwxYw|snD	|�	|��n,#t$r}td
|�d|j�����d}~wwxYw��	|r|�
��|r|�
��dSdS#|r|�
��|r|�
��wwxYw)a5Copy the file 'src' to 'dst'; both must be filenames.  Any error
    opening either file, reading from 'src', or writing to 'dst', raises
    DistutilsFileError.  Data is read/written in chunks of 'buffer_size'
    bytes (default 16k).  No attempt is made to handle anything apart from
    regular files.
    N�rbzcould not open '�': zcould not delete '�wbzcould not create 'Tzcould not read from 'zcould not write to ')�open�OSErrorr�strerror�os�path�exists�unlink�read�write�close)�src�dst�buffer_size�fsrc�fdst�e�bufs       �:/opt/alt/python311/lib64/python3.11/distutils/file_util.py�_copy_file_contentsrs����D��D�&�	T���T�?�?�D�D���	T�	T�	T�$�$�#�#�#�q�z�z�%R�S�S�S�����	T�����7�>�>�#���	G�
G��	�#�������
G�
G�
G�(�(�58�S�S�!�*�*�E�G�G�G�����
G����	C���T�?�?�D�D���	C�	C�	C�$�$�14���a�j�j�A�C�C�
C�����	C����	I�
J��i�i��,�,�����
J�
J�
J�(�(�8;���Q�Z�Z�H�J�J�J�����
J�����
��
I��
�
�3�������
I�
I�
I�(�(�7:�s�s�A�J�J�G�I�I�I�����
I����	I���	��J�J�L�L�L��	��J�J�L�L�L�L�L�	�	���	��J�J�L�L�L��	��J�J�L�L�L�L�	���s���F�
A�<�A�"F�$A9�8F�9
B"�B�B"�"F�&B7�6F�7
C �C�C � F�%C;�:F�;
D$�D�D$�$F�+E�F�
E*�E%�%E*�*F�/G�c��ddlm}ddlm}	m}
m}m}tj�	|��std|z���tj�|��r@|}
tj�|tj�
|����}ntj�|��}
|r+|||��s|dkrtjd|��|dfS	t"|}n #t$$rt'd|z���wxYw|dkrotj�
|��tj�
|��krtjd|||
��ntjd|||��|r|dfS|d	krjtj�|��r tj�||��s*	tj||��|dfS#t0$rYncwxYwn^|d
krXtj�|��r tj�||��stj||��|dfSt5||��|s|r_tj|��}|r#tj|||	||
f��|r$tj||||����|dfS)aCopy a file 'src' to 'dst'.  If 'dst' is a directory, then 'src' is
    copied there with the same name; otherwise, it must be a filename.  (If
    the file exists, it will be ruthlessly clobbered.)  If 'preserve_mode'
    is true (the default), the file's mode (type and permission bits, or
    whatever is analogous on the current platform) is copied.  If
    'preserve_times' is true (the default), the last-modified and
    last-access times are copied as well.  If 'update' is true, 'src' will
    only be copied if 'dst' does not exist, or if 'dst' does exist but is
    older than 'src'.

    'link' allows you to make hard links (os.link) or symbolic links
    (os.symlink) instead of copying: set it to "hard" or "sym"; if it is
    None (the default), files are copied.  Don't set 'link' on systems that
    don't support it: 'copy_file()' doesn't check if hard or symbolic
    linking is available. If hardlink fails, falls back to
    _copy_file_contents().

    Under Mac OS, uses the native file copy function in macostools; on
    other systems, uses '_copy_file_contents()' to copy file contents.

    Return a tuple (dest_name, copied): 'dest_name' is the actual name of
    the output file, and 'copied' is true if the file was copied (or would
    have been copied, if 'dry_run' true).
    r)�newer)�ST_ATIME�ST_MTIME�ST_MODE�S_IMODEz4can't copy '%s': doesn't exist or not a regular filer z"not copying %s (output up-to-date)z&invalid value '%s' for 'link' argumentz%s %s -> %srr)�distutils.dep_utilr"�statr#r$r%r&rr�isfiler�isdir�join�basename�dirnamer�debug�_copy_action�KeyError�
ValueError�infor�samefile�linkr�symlinkr�utime�chmod)rr�
preserve_mode�preserve_times�updater4�verbose�dry_runr"r#r$r%r&�dir�action�sts                r�	copy_filer@Cs��B)�(�(�(�(�(�9�9�9�9�9�9�9�9�9�9�9�9�
�7�>�>�#���L� �D�s�J�L�L�	L�
�w�}�}�S���#����g�l�l�3��� 0� 0�� 5� 5�6�6����g�o�o�c�"�"��
��e�e�C��o�o���a�<�<��I�:�C�@�@�@��Q�x��J��d�#�����J�J�J��A�D�H�I�I�I�J�����!�|�|�
�7���C� � �B�G�$4�$4�S�$9�$9�9�9��H�]�F�C��5�5�5�5��H�]�F�C��5�5�5����Q�x��
��������s�#�#�	���(8�(8��c�(B�(B�	�
����S�!�!�!��Q�x����
�
�
���	
����		�
��������s�#�#�	���(8�(8��c�(B�(B�	��J�s�C� � � ���8�O���S�!�!�!��0��0�
�W�S�\�\���	8��H�S�2�h�<��H��6�7�7�7��	0��H�S�'�'�"�W�+�.�.�/�/�/���8�Os�0
C>�>D�G8�8
H�Hc�r�ddlm}m}m}m}m}ddl}	|dkrtjd||��|r|S||��std|z���||��r*tj�|||����}n!||��rtd|�d|�d	����|||����std|�d|�d
����d}
	tj
||��nG#t$r:}|j\}}
||	jkrd}
ntd
|�d|�d|
�����Yd}~nd}~wwxYw|
r�t#|||���	tj|��n]#t$rP}|j\}}
	tj|��n#t$rYnwxYwtd
|�d|�d|�d|
�����d}~wwxYw|S)a%Move a file 'src' to 'dst'.  If 'dst' is a directory, the file will
    be moved into it with the same name; otherwise, 'src' is just renamed
    to 'dst'.  Return the new full name of the file.

    Handles cross-device moves on Unix using 'copy_file()'.  What about
    other systems???
    r)rr)r*r,r-Nr zmoving %s -> %sz#can't move '%s': not a regular filezcan't move 'z': destination 'z' already existsz' not a valid pathFTzcouldn't move 'z' to 'r)r;z' by copy/delete: delete 'z
' failed: )�os.pathrr)r*r,r-�errnorr2rrrr+�renamer�args�EXDEVr@r)rrr;r<rr)r*r,r-rC�copy_itr�num�msgs              r�	move_filerJ�s���A�@�@�@�@�@�@�@�@�@�@�@�@�@��L�L�L��!�|�|���"�C��-�-�-����
��6�#�;�;�N� �!F��!L�M�M�M��u�S�z�z���g�l�l�3����
�
�.�.���	������ � ��s�s�C�C�C����	��5��������� � ��s�s�C�C�C����	��G�F�
�	�#�s�������F�F�F��V�
��c��%�+����G�G�$�$�69�c�c�3�3�3���D�F�F�
F�
�G�G�G�G�����F�����
*��#�s�G�,�,�,�,�	*��I�c�N�N�N�N���		*�		*�		*���J�S�#�
��	�#�������
�
�
���
����$�$��S�S�#�#�#�s�s�s�C�C�)�*�*�
*�����
		*�����JsT�C)�)
D-�30D(�(D-�E�
F4�$
F/�/F�F/�
F�F/�F�F/�/F4c��t|d��}	|D]}|�|dz���	|���dS#|���wxYw)z{Create a file with the specified name and write 'contents' (a
    sequence of strings without line terminators) to it.
    �w�
N)r
rr)�filename�contents�f�lines    r�
write_filerR�sj��	
�X�s���A���	!�	!�D�
�G�G�D�4�K� � � � �	!�	
���	�	�	�	�	�����	�	�	�	���s�A�A)r)r r rNr r)r r)�__doc__r�distutils.errorsr�	distutilsrr/rr@rJrR��r�<module>rXs�����

�	�	�	�/�/�/�/�/�/�������#�'�/�2�2��
1�1�1�1�fCD�,-�_�_�_�_�H��<�<�<�<�~	�	�	�	�	rW

?>