o
    Ô­jZ  ã                   @   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 d S )NzNeeds C compilerzNeeds FORTRAN 77 compiler)r   Úhas_c_compilerÚpytestÚskipÚhas_f77_compiler© r	   r	   úc/var/www/html/CropPilot/venv/lib/python3.10/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  
|¡� tjj||| |d�}|dks7J ‚W d   ƒ n1 sAw   Y  qtjdkr`t|ƒ}| ¡ }	|	dksZJ ‚tj|= d S d S )NzT
        integer function foo()
        foo = 10 + 5
        return
        end
    z.f)Ú
modulenamer   Ú	source_fnr   Úwin32é   )r   Úget_module_dirÚget_temp_module_nameÚosÚgetcwdÚpathÚjoinÚstrÚuuidÚuuid4Ú	switchdirÚnumpyÚf2pyÚcompileÚsysÚplatformr   ÚfooÚmodules)
r   ÚfsourceÚmoddirÚmodnameÚcwdÚtargetr   Úret_valÚreturn_checkÚ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 _d S | t _w )Nzdoes not existr-   é   )r    Ú
executabler   r   r   )Útempr)   r	   r	   r
   Útest_f2py_init_compile_bad_cmdV   s   r2   r$   z'program test_f2py
end program test_f2pys'   program test_f2py
end program test_f2pyc                 C   sN   t  | ¡� tjj|ddd�}|dksJ ‚W d   ƒ d S 1 s w   Y  d S )NÚtest_compile_from_stringsz.f90)r   Ú	extensionr   )r   r   r   r   r   )Útmpdirr$   r)   r	   r	   r
   r3   h   s   	þ"ür3   )Ú__doc__r    r   r   Ú	importlibr   r   Ú
numpy.f2pyr   r   r   r   ÚmarkÚparametrizeÚleaks_referencesr,   r.   r2   r3   r	   r	   r	   r
   Ú<module>   s.    	ÿ4þþ