o
    LK&hh
                     @   s   d Z ddlZddlZddlmZ ddlmZmZ ddlm	Z	m
Z
 ddlZddlZddlZejdddd	 Ze
jG d
d de
jZdS )z#Tests for distutils.command.config.    N)log)config	dump_file)missing_compiler_executablesupportT)autousec                 C   s    | j }g |_|td|j d S )Ninfo)instance_logssetattrr   _info)requestmonkeypatchself r   ^/var/www/html/venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_config_cmd.pyinfo_log   s   r   c                   @   s@   e Zd Zdd Zdd Zejddd Zdd	 Z	d
d Z
dS )
TestConfigc                 G   s   |  D ]}| j| qd S )N)
splitlinesr
   append)r   msgargsliner   r   r   r      s   zTestConfig._infoc                 C   sj   t td}|jdd}t|}W d    n1 sw   Y  t|d t| j	|d ks3J d S )Nz.pyzutf-8)encodingzI am the header   )
pathPath__file__with_suffixopenmore_itertoolsilenr   lenr
   )r   	this_filefnumlinesr   r   r   test_dump_file   s   
zTestConfig.test_dump_filezplatform.system() == "Windows"c                 C   s   t dg}|d ur| d|d |  \}}t|}|  |j}tjd d dkr:d|jd 	 v r:| d |j
d	d
d}|dksGJ |j
dd
d}|dksTJ d S )NpreprocessorzThe z command is not found   aixxlcr   zAxlc: The -E option overrides the -P, -o, and -qsyntaxonly optionsxxxz	/* xxx */)patternbody_configtestr   )r   skipTestcreate_distr   _check_compilercompilersysplatformr'   lower
search_cpp)r   cmdpkg_dirdistr2   matchr   r   r   test_search_cpp#   s   
$zTestConfig.test_search_cppc                 C   sz   |   \}}t|}dtj d|_d|_dtj d|_|  |jddgks*J |jdgks2J |jddgks;J d S )Nonetwothreefour)r0   r   ospathsepinclude_dirs	librarieslibrary_dirsensure_finalized)r   r8   r9   r7   r   r   r   test_finalize_options8   s   z TestConfig.test_finalize_optionsc                 C   s   |   }tj|d}tj|d}| |d | |d ||fD ]
}tj|s,J q"|  \}}t|}||| ||fD ]
}tj|rKJ qAd S )Nr<   r=   r+   )	mkdtempr@   r   join
write_fileexistsr0   r   _clean)r   tmp_dirf1f2r$   r8   r9   r7   r   r   r   
test_cleanF   s   zTestConfig.test_cleanN)__name__
__module____qualname__r   r&   pytestmarkskipifr;   rF   rO   r   r   r   r   r      s    

r   )__doc__r@   r3   distutils._logr   distutils.command.configr   r   distutils.testsr   r   r    r   rS   fixturer   combine_markersTempdirManagerr   r   r   r   r   <module>   s    

