a
    hÝEbÕ  ã                   @   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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)Úassert_equalé   )Ú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   úf/home/ja/django-apps/lartica_env/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 ]t}z,t 
|¡ tjj||| |d�}W t 
|¡ nt 
|¡ 0 t|dƒ tjdkr>t|ƒ}| ¡ }	t|	dƒ tj|= q>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ÚchdirÚnumpyÚf2pyÚcompiler   Ú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¡} t| dƒ d S )Nó   invalidr   )r   r   r   r   )r$   r   r   r	   Útest_f2py_init_compile_failureV   s    r'   c                  C   s:   z,t j} dt _tj d¡}t|dƒ W | t _n| t _0 d S )Nzdoes not existr&   é   )r   Ú
executabler   r   r   r   )Útempr$   r   r   r	   Útest_f2py_init_compile_bad_cmd]   s    r+   r    z'program test_f2py
end program test_f2pys'   program test_f2py
end program test_f2pyc              	   C   sR   t  ¡ }z8t  t| ƒ¡ tjj|ddd�}t|dƒ W t  |¡ nt  |¡ 0 d S )NÚtest_compile_from_stringsz.f90)r   Ú	extensionr   )r   r   r   r   r   r   r   r   )Ztmpdirr    r"   r$   r   r   r	   r,   o   s    ýr,   )Ú__doc__r   r   r   Ú	importlibr   r   Z
numpy.f2pyr   Znumpy.testingr   r   r   r
   ÚmarkZparametrizeZleaks_referencesr%   r'   r+   r,   r   r   r   r	   Ú<module>   s,   	ÿ9ÿÿ