a �DOgb�@slddlZddlZddlmZmZddlmZiaddd�Zddd �Z dd d �Z d d �Z ddd�Z dd�Z dS)�N)�DistutilsFileError�DistutilsInternalError)�log���c Csht|t�std|f��tj�|�}g}tj�|�s<|dkr@|St�tj� |��rV|Stj� |�\}}|g}|r�|r�tj�|�s�tj� |�\}}|� d|�ql|D]�}tj� ||�}tj� |�} t�| �r�q�|dkr�t �d|�|�sZzt�||�WnXt�yN} z>| jtjk�r$tj�|��s:td|| jdf��WYd} ~ n d} ~ 00|�|�dt| <q�|S)Nz(mkpath: 'name' must be a string (got %r)�rrz creating %szcould not create '%s': %s�����)� isinstance�strr�os�path�normpath�isdir� _path_created�get�abspath�split�insert�joinr�info�mkdir�OSError�errno�EEXISTr�args�append) �name�mode�verbose�dry_runZ created_dirs�head�tailZtails�dZabs_head�exc�r$�*/usr/lib64/python3.9/distutils/dir_util.py�mkpathsB �    �  r&c CsNt�}|D] }|�tj�|tj�|���q t|�D]}t||||d�q4dS)N�rr)�set�addr r r�dirname�sortedr&)�base_dir�filesrrrZneed_dir�file�dirr$r$r%� create_treePs  r0c Csbddlm}|s(tj�|�s(td|��zt�|�} Wn@tyv} z(|rPg} ntd|| jf��WYd} ~ n d} ~ 00|s�t ||d�g} | D]�} tj� || �} tj� || �}| � d�r�q�|�rtj� | ��rt� | �}|dkr�t�d||�|�st�||�| �|�q�tj�| ��r<| �t| |||||||d ��q�|| ||||||d �| �|�q�| S) Nr)� copy_filez&cannot copy tree '%s': not a directoryzerror listing files in '%s': %s)rz.nfsrzlinking %s -> %sr')Zdistutils.file_utilr1r r rr�listdirr�strerrorr&r� startswith�islink�readlinkrr�symlinkr�extend� copy_tree)�src�dstZ preserve_modeZpreserve_timesZpreserve_symlinks�updaterrr1�names�eZoutputs�nZsrc_nameZdst_nameZ link_destr$r$r%r9csR � �     ��� r9cCsft�|�D]F}tj�||�}tj�|�r@tj�|�s@t||�q |�tj|f�q |�tj |f�dS)N) r r2r rrr5�_build_cmdtupler�remove�rmdir)r � cmdtuples�fZreal_fr$r$r%r@�s  r@c Cs�|dkrt�d|�|rdSg}t||�|D]j}z2|d|d�tj�|d�}|tvrbt|=Wq.ty�}zt�d||�WYd}~q.d}~00q.dS)Nrz'removing '%s' (and everything under it)rzerror removing %s: %s) rrr@r r rrr�warn)Z directoryrrrC�cmdrr#r$r$r%� remove_tree�s   rGcCs6tj�|�\}}|dd�tjkr2||dd�}|S)Nrr)r r � splitdrive�sep)r �driver$r$r%�ensure_relative�srK)rrr)rrr)rrrrrr)rr)r rZdistutils.errorsrrZ distutilsrrr&r0r9r@rGrKr$r$r$r%�s  ? � E