o
    NZhh
                     @   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)Zautousec                 C   s    | j }g |_|td|j d S )Ninfo)instance_logssetattrr   _info)requestZmonkeypatchself r   Z/var/www/auris/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_itertoolsZilenr   lenr	   )r   Z	this_filefZ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   aixZxlcr   zAxlc: The -E option overrides the -P, -o, and -qsyntaxonly optionsxxxz	/* xxx */)patternbodyZ_configtestr   )r   ZskipTestcreate_distr   Z_check_compilercompilersysplatformr"   lowerZ
search_cpp)r   cmdpkg_dirdistr)   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)r(   r   ospathsepZinclude_dirsZ	librariesZlibrary_dirsZensure_finalized)r   r.   r/   r-   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 )Nr2   r3   r%   )	mkdtempr6   r   join
write_fileexistsr(   r   Z_clean)r   Ztmp_dirf1f2r    r.   r/   r-   r   r   r   
test_cleanF   s   zTestConfig.test_cleanN)__name__
__module____qualname__r   r!   pytestmarkZskipifr1   r8   r?   r   r   r   r   r      s    

r   )__doc__r6   r*   Zdistutils._logr   Zdistutils.command.configr   r   Zdistutils.testsr   r   r   r   rC   Zfixturer   Zcombine_markersZTempdirManagerr   r   r   r   r   <module>   s    

