a
    ³ÐOcÉ  ã                	   @   s¾   d dl Z d dlmZmZ edko&edu ZerZej e e 	e 
e¡d¡¡¡ d dlmZ nd dlmZ edddddddd	�ZG d
d„ deƒZG dd„ deƒZG dd„ de jƒZerºe  ¡  dS )é    N)ÚsysÚpathÚ__main__z..)ÚCCompilerOpt)ÚgccÚclangZiccZiccwZmsvc)r   r   )r   )Úx86Úx64Úppc64Úppc64leZarmhfÚaarch64Znarchc                   @   s:   e Zd ZdZdd„ Zdd„ Zdd„ Zedd	œd
d„ƒZdS )ÚFakeCCompilerOpt)ÚarchÚcompilerÚ
extra_argsc                 O   s   t j| d fi |¤Ž d S ©N)r   Ú__init__)ÚselfÚargsÚkwargs© r   úd/var/www/html/gsl.tools/lib/python3.9/site-packages/numpy/distutils/tests/test_ccompiler_opt_conf.pyr      s    zFakeCCompilerOpt.__init__c                 K   s   |S r   r   )r   ÚsourcesÚflagsr   r   r   r   Údist_compile   s    zFakeCCompilerOpt.dist_compilec                 C   s   t jS r   )r   Ú	fake_info©r   r   r   r   Ú	dist_info   s    zFakeCCompilerOpt.dist_infoF)Ústderrc                 G   s   d S r   r   )r   r   r   r   r   Údist_log   s    zFakeCCompilerOpt.dist_logN)	Ú__name__Ú
__module__Ú__qualname__r   r   r   r   Ústaticmethodr   r   r   r   r   r      s   r   c                   @   sH   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dd„ Z
dS )Ú_TestConfFeatureszlA hook to check the sanity of configured features
-   before it called by the abstract class '_Feature'
    c                 C   sX   | j }| ¡ D ]\}}|  d|||¡ qt | ¡}| ¡ D ]\}}|  d|||¡ q:|S )Nzattribute conf_featureszconf_features_partial())Zconf_featuresÚitemsÚtest_featurer   Úconf_features_partial)r   Zconf_allÚfeature_nameÚfeatureZconf_partialr   r   r   r'   &   s    þ
þz'_TestConfFeatures.conf_features_partialc                 C   sŠ   d  ||| j| j¡}| ¡ s(t|d ƒ‚| ¡ D ]$\}}|  |||¡ |  |||¡ q0|  ||||¡ |  	||||¡ |  
||||¡ d S )NzJduring validate '{}' within feature '{}', march '{}' and compiler '{}'
>> z!feature name must be in uppercase)ÚformatZcc_marchZcc_nameÚisupperÚAssertionErrorr%   Útest_option_typesÚtest_duplicatesÚtest_impliesÚ
test_groupÚtest_extra_checks)r   ÚlogÚ	search_inr(   Úfeature_dictÚ	error_msgÚoptionÚvalr   r   r   r&   6   s    ÿýz_TestConfFeatures.test_featurec                 C   s¬   t tfdft fdftfdftfdfttd ƒfdffD ]^\}}||v }|sJq4t||ƒsŽdd„ g |¢R D ƒ}d |¡}t|d	||t|ƒjf  ƒ‚ q”q4|s¨t|d
|  ƒ‚d S )N©ÚimpliesÚheadersr   ÚgroupÚdetectÚextra_checks)Údisable)Zinterest)Zimplies_detect)Zautovecc                 S   s   g | ]
}|j ‘qS r   )r    )Ú.0Útr   r   r   Ú
<listcomp>U   ó    z7_TestConfFeatures.test_option_types.<locals>.<listcomp>z or z+expected '%s' type for option '%s' not '%s'zinvalid option name '%s')	ÚstrÚlistÚintÚboolÚtypeÚ
isinstanceÚjoinr,   r    )r   r5   r6   r7   ÚtpÚ	availableZfound_itZerror_tpr   r   r   r-   G   s(    
ù	

ÿÿz#_TestConfFeatures.test_option_typesc                 C   sF   |dvrd S t |tƒr| ¡ }t|ƒtt|ƒƒkrBt|d|  ƒ‚d S )Nr8   z duplicated values in option '%s')rH   rC   ÚsplitÚlenÚsetr,   )r   r5   r6   r7   r   r   r   r.   `   s    
z!_TestConfFeatures.test_duplicatesc                 C   s–   |  d¡d urd S |  dd¡}|s&d S t|tƒr8| ¡ }||v rLt|d ƒ‚|D ]@}|  |¡}|d ur€d|v rPt|d|  ƒ‚qPt|d|  ƒ‚qPd S )NÚdisabledr9   Ú zfeature implies itselfr>   zimplies disabled feature '%s'zimplies non-exist feature '%s'©ÚgetrH   rC   rL   r,   )r   r5   r3   r(   r4   r9   ÚimplÚ	impl_dictr   r   r   r/   k   s     

z_TestConfFeatures.test_impliesc                 C   sn   |  d¡d urd S |  dd¡}|s&d S t|tƒr8| ¡ }|D ],}|  |¡}|r<d|v rXq<t|d|  ƒ‚q<d S )NrO   r;   rP   r>   z8in option 'group', '%s' already exists as a feature namerQ   )r   r5   r3   r(   r4   r;   ÚfrT   r   r   r   r0      s    

ÿz_TestConfFeatures.test_groupc                 C   sn   |  d¡d urd S |  dd¡}|s&d S t|tƒr8| ¡ }|D ],}|  |¡}|r<d|v rXq<t|d|  ƒ‚q<d S )NrO   r=   rP   r>   zOin option 'extra_checks', extra test case '%s' already exists as a feature namerQ   )r   r5   r3   r(   r4   r=   rU   rT   r   r   r   r1   �   s    

ÿz#_TestConfFeatures.test_extra_checksN)r    r!   r"   Ú__doc__r'   r&   r-   r.   r/   r0   r1   r   r   r   r   r$   !   s   r$   c                   @   s&   e Zd Zd	dd„Zdd„ Zdd„ ZdS )
ÚTestConfFeaturesÚrunTestc                 C   s   t j | |¡ |  ¡  d S r   )ÚunittestÚTestCaser   Úsetup)r   Ú
methodNamer   r   r   r   ¢   s    zTestConfFeatures.__init__c                 C   s
   dt _d S )NT)r   Zconf_nocacher   r   r   r   r[   ¦   s    zTestConfFeatures.setupc                 C   s2   t  ¡ D ]$\}}|D ]}||dft_tƒ  qqd S )NrP   )Úarch_compilersr%   r   r   r$   )r   r   Z	compilersÚccr   r   r   Útest_features©   s    zTestConfFeatures.test_featuresN)rX   )r    r!   r"   r   r[   r_   r   r   r   r   rW   ¡   s   
rW   )rY   Úosr   r   r    Ú__package__Zis_standaloneÚappendÚabspathrI   ÚdirnameÚ__file__Zccompiler_optr   Znumpy.distutils.ccompiler_optÚdictr]   r   r$   rZ   rW   Úmainr   r   r   r   Ú<module>   s*    ù
 