a
    Lf                  	   @   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re   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   f/var/www/ai-form-bot/venv/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||sdd g |R D }d|}t|d	||t|jf   qq4|st|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rd|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*    
 