Sindbad~EG File Manager
a
��g� � @ s� d Z ddlZddlZddlZddlmZmZ ddlmZm Z ddl
mZ ddlm
Z
G dd� dejejej�Zd d
� Zedkr�ee� � dS )z#Tests for distutils.command.config.� N)�run_unittest�missing_compiler_executable)� dump_file�config)�support)�logc sb e Zd Zdd� Z� fdd�Z� fdd�Zdd� Ze�e j
d kd
�dd� �Zd
d� Zdd� Z
� ZS )�ConfigTestCasec G s |� � D ]}| j�|� qd S �N)�
splitlines�_logs�append)�self�msg�args�line� r �;/usr/local/lib/python3.9/distutils/tests/test_config_cmd.py�_info s zConfigTestCase._infoc s( t t| ��� g | _tj| _| jt_d S r )�superr �setUpr r �info�old_logr �r
�� __class__r r r s zConfigTestCase.setUpc s | j t_tt| ��� d S r )r r r r r �tearDownr r r r r s zConfigTestCase.tearDownc C sd t j�t�d d }t|�}zt|�� �}W |�� n
|�� 0 t|d� | � t| j
�|d � d S )Nr z.pyzI am the header� )�os�path�splitext�__file__�open�len� readlines�closer �assertEqualr )r
Z this_file�fZnumlinesr r r �test_dump_file s
zConfigTestCase.test_dump_file�win32zcan't test on Windowsc C s� t dg�}|d ur | �d| � | �� \}}t|�}|�� |j}tjd d� dkrpd|jd � � v rp| �d� |j
dd d
�}| �|d� |j
dd d
�}| �|d� d S )
N�preprocessorzThe %r command is not found� ZaixZxlcr zAxlc: The -E option overrides the -P, -o, and -qsyntaxonly options�xxxz /* xxx */)�pattern�bodyZ_configtestr )r ZskipTest�create_distr Z_check_compiler�compiler�sys�platformr) �lowerZ
search_cppr% )r
�cmd�pkg_dir�distr/ �matchr r r �test_search_cpp( s
$
zConfigTestCase.test_search_cppc C sr | � � \}}t|�}dtj |_d|_dtj |_|�� | �|jddg� | �|jdg� | �|jddg� d S )Nzone%stwo�onezthree%sfour�twoZthreeZfour) r. r r �pathsepZinclude_dirsZ librariesZlibrary_dirsZensure_finalizedr% )r
r4 r5 r3 r r r �test_finalize_options; s z$ConfigTestCase.test_finalize_optionsc C s� | � � }tj�|d�}tj�|d�}| �|d� | �|d� ||fD ]}| �tj�|�� qD| �� \}}t|�}|� ||� ||fD ]}| �
tj�|�� q�d S )Nr8 r9 r+ )�mkdtempr r �joinZ
write_fileZ
assertTrue�existsr. r Z_cleanZassertFalse)r
Ztmp_dir�f1�f2r&