a
    ³ÐOcZ  ã                   @   s¨   d Z ddlZddlZddlZddlmZ ddlZddlZddl	m
Z
 dd„ Zej dd	d
gddg¡ejjdd�dd„ ƒƒZdd„ Zdd„ Zej dddg¡dd„ ƒZdS )z0See https://github.com/numpy/numpy/pull/11937.

é    N)Úimport_moduleé   )Úutilc                   C   s(   t  ¡ st d¡ t  ¡ s$t d¡ d S )NzNeeds C compilerzNeeds FORTRAN 77 compiler)r   Zhas_c_compilerÚpytestÚskipZhas_f77_compiler© r   r   ú]/var/www/html/gsl.tools/lib/python3.9/site-packages/numpy/f2py/tests/test_compile_function.pyÚsetup_module   s    
r	   Ú
extra_argsz--nooptz--debugz--noopt --debugÚ z$Imported module seems never deleted.)Úreasonc           
   	   C   sÀ   d}t  ¡ }t  ¡ }t ¡ }tj |tt 	¡ ƒd ¡}|d fD ]N}t  
|¡�0 tjj||| |d�}|dksnJ ‚W d   ƒ q>1 s‚0    Y  q>tjdkr¼t|ƒ}| ¡ }	|	dks´J ‚tj|= d S )NzT
        integer function foo()
        foo = 10 + 5
        return
        end
    z.f)Ú
modulenamer
   Ú	source_fnr   Úwin32é   )r   Zget_module_dirZget_temp_module_nameÚosÚgetcwdÚpathÚjoinÚstrÚuuidÚuuid4Ú	switchdirÚnumpyÚf2pyÚcompileÚsysÚplatformr   ZfooÚmodules)
r
   ÚfsourceZmoddirÚmodnameÚcwdÚtargetr   Úret_valZreturn_checkZcalc_resultr   r   r   Útest_f2py_init_compile   s$    
ý,
r$   c                  C   s   t j d¡} | dksJ ‚d S )Nó   invalidr   )r   r   r   )r#   r   r   r   Útest_f2py_init_compile_failureO   s    r&   c                  C   s<   z.t j} dt _tj d¡}|dks&J ‚W | t _n| t _0 d S )Nzdoes not existr%   é   )r   Ú
executabler   r   r   )Útempr#   r   r   r   Útest_f2py_init_compile_bad_cmdV   s    r*   r   z'program test_f2py
end program test_f2pys'   program test_f2py
end program test_f2pyc                 C   sL   t  | ¡�. tjj|ddd�}|dks*J ‚W d   ƒ n1 s>0    Y  d S )NÚtest_compile_from_stringsz.f90)r   Ú	extensionr   )r   r   r   r   r   )Útmpdirr   r#   r   r   r   r+   h   s    	þr+   )Ú__doc__r   r   r   Ú	importlibr   r   Z
numpy.f2pyr   r   r   r	   ÚmarkZparametrizeZleaks_referencesr$   r&   r*   r+   r   r   r   r   Ú<module>   s,   	ÿ4þþ