File: //opt/saltstack/salt/lib/python3.10/site-packages/setuptools/__pycache__/_shutil.cpython-310.pyc
o
;j* � @ s� d Z ddlZddlZddlmZmZ ddlmZ ddlm Z zddlm
Z
W n ey: ded ed
dfdd�Z
Y nw ed
�Z
dd� Zdede
f deded
e
fdd�Zdefdd�Zdd� Zdd� ZdS )z2Convenience layer on top of stdlib's shutil and os� N)�Callable�TypeVar� )�py311)�log)�chmod�args�kwargs�returnc O s d S �N� )r r r r �F/opt/saltstack/salt/lib/python3.10/site-packages/setuptools/_shutil.pyr s r �_Tc
C sR t �d| |� zt| |� W d S ty( } z
t �d|� W Y d }~d S d }~ww )Nzchanging mode of %s to %ozchmod failed: %s)r �debugr �OSError)�path�mode�er r r
�attempt_chmod_verbose s ��r �func.�arg�excc C s2 | t jt jfv rt jdkrt|tj� | |�S |�)zIshutils onexc callback to automatically call chmod for certain functions.�nt)�os�unlink�remove�namer �stat�S_IWRITE)r r r r r r
�_auto_chmod s r Fc C s t �| ||�S )zx
Similar to ``shutil.rmtree`` but automatically executes ``chmod``
for well know Windows failure scenarios.
)r Z
shutil_rmtree)r �
ignore_errorsZonexcr r r
�rmtree+ s r! c K s$ t j�| �rt| fi |�� d S d S r )r r �isdirr! )r �optsr r r
�rmdir3 s �r$ c C s t �d�} t �| � | S )N� )r �umask)�tmpr r r
�
current_umask8 s
r( )�__doc__r r �typingr r �compatr � distutilsr r �ImportError�objectr r �str�
BaseExceptionr r! r$ r( r r r r
�<module> s2 �
���
�