o
    5‘ðih
  ã                   @   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   új/root/parts/websockify/install/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    

