Your IP : 216.73.216.213


Current Path : /opt/alt/python310/lib64/python3.10/distutils/tests/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/distutils/tests/__pycache__/support.cpython-310.opt-2.pyc

o

0�iZ�@s�	ddlZddlZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZddlm
Z
mZmZmZmZddlmZGdd�de�ZGd	d
�d
e�ZGdd�d�ZGd
d�de�Zdd�Zdd�Zdd�ZdS)�N)�deepcopy)�	os_helper)�log)�DEBUG�INFO�WARN�ERROR�FATAL)�Distributioncs@eZdZ�fdd�Z�fdd�Zdd�Zdd�Zd	d
�Z�ZS)�LoggingSilencercs6t���t�tj�|_tjj|_|jtj_g|_	dS�N)
�super�setUpr�
set_thresholdr	�	threshold�Log�_log�_old_log�logs��self��	__class__��>/opt/alt/python310/lib64/python3.10/distutils/tests/support.pyrs




zLoggingSilencer.setUpcs$t�|j�|jtj_t���dSr)rrrrrrr
�tearDownrrrrrs
zLoggingSilencer.tearDowncCsT|tttttfvrtdt|���t|t�stdt	|�j
��|j�|||f�dS)Nz%s wrong log levelzmsg should be str, not '%.200s')
rrrrr	�
ValueError�str�
isinstance�	TypeError�type�__name__r�append)r�level�msg�argsrrrr!s
�zLoggingSilencer._logcs�fdd�|jD�S)Ncs"g|]
\}}}|�vr||�qSrr)�.0r#r$r%��levelsrr�
<listcomp>*s�z,LoggingSilencer.get_logs.<locals>.<listcomp>�r)rr(rr'r�get_logs)s
�zLoggingSilencer.get_logscCs
g|_dSrr*rrrr�
clear_logs-s
zLoggingSilencer.clear_logs)	r!�
__module__�__qualname__rrrr+r,�
__classcell__rrrrrs
rcsFeZdZ	�fdd�Z�fdd�Zdd�Zd
dd	�Zddd�Z�ZS)�TempdirManagercst���t��|_g|_dSr)r
r�os�getcwd�old_cwd�tempdirsrrrrr7s


zTempdirManager.setUpcs>t�|j�t���|jr|j��}t�|�|jsdSdSr)	r1�chdirr3r
rr4�poprZrmtree)rZtmpdirrrrr<s


�zTempdirManager.tearDowncCs	t��}|j�|�|Sr)�tempfile�mkdtempr4r")r�drrrr8EszTempdirManager.mkdtemp�xxxcCsJ	t|ttf�rtjj|�}t|d�}z|�|�W|��dS|��w)N�w)	r�list�tupler1�path�join�open�write�close)rr>Zcontent�frrr�
write_fileNs
zTempdirManager.write_file�foocKs4	|��}tj�||�}t�|�t|d�}||fS)N)Zattrs)r8r1r>r?�mkdirr
)rZpkg_name�kwZtmp_dirZpkg_dirZdistrrr�create_dist\s	

zTempdirManager.create_dist)r:)rE)	r!r-r.rrr8rDrHr/rrrrr01s	
	r0c@seZdZ	dd�Zdd�ZdS)�DummyCommandcKs"|��D]
\}}t|||�qdSr)�items�setattr)r�kwargsrG�valrrr�__init__qs�zDummyCommand.__init__cCsdSrrrrrr�ensure_finalizeduszDummyCommand.ensure_finalizedN)r!r-r.rNrOrrrrrInsrIcs(eZdZ�fdd�Z�fdd�Z�ZS)�EnvironGuardcstt|���ttj�|_dSr)r
rPrrr1�environ�old_environrrrrr{szEnvironGuard.setUpcsf|j��D]\}}tj�|�|kr|tj|<qttj���D]}||jvr)tj|=qtt|��	�dSr)
rRrJr1rQ�getr=�keysr
rPr)r�key�valuerrrrs
�
�zEnvironGuard.tearDown)r!r-r.rrr/rrrrrPysrPcCs*	t�}|dur
t�d��t�||�dS)Nz>cannot find xxmodule.c (test must run in the python build dir))�_get_xxmodule_path�unittestZSkipTest�shutil�copy)Z	directory�filenamerrr�copy_xxmodule_c�s

r\c
Csft�d�}tj�tj�t�d�tj�|dd�tj�|ddddd�g}|D]}tj�|�r0|Sq$dS)N�srcdirz
xxmodule.cZModulesz..)�	sysconfig�get_config_varr1r>r?�dirname�__file__�exists)r]Z
candidatesr>rrrrW�s
�
��rWcCs�	tjdkrtj�d�|_dSt�d�rCt�d�}|dur#dg|_dStj	dkr-g|_dS|�
d�\}}}dd	�|�tj�D�|_dSdS)
N�ntz_d.exeZPy_ENABLE_SHAREDZ	RUNSHARED�.�darwin�=cSsg|]}|r|�qSrr)r&r9rrrr)�sz#fixup_build_ext.<locals>.<listcomp>)
r1�name�sys�
executable�endswith�debugr^r_Zlibrary_dirs�platform�	partition�split�pathsep)�cmdZ	runsharedrgZequalsrVrrr�fixup_build_ext�s




�rq)r1rhrYr7rXr^rZrZtest.supportrZ	distutilsrZ
distutils.logrrrrr	Zdistutils.corer
�objectrr0rIrPr\rWrqrrrr�<module>s&!=