o
    U=ºiÏ  ã                   @   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   Zhas_c_compilerÚpytestÚskipZhas_f77_compiler© r   r   úlC:\Users\psant\Downloads\PAF backend\school\venv\Lib\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   ƒ q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   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 _d S | t _w )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   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   )Z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þþ