o
    g                     @   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 d S )NzNeeds C compilerzNeeds FORTRAN 77 compiler)r   has_c_compilerpytestskiphas_f77_compiler r
   r
   d/home/ubuntu/cloudmapper/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 ]:}zt
| tjj||| |d}W t
| nt
| w t|d tjdkrYt|}| }	t|	d tj|= q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chdirnumpyf2pycompiler   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} t| d d S )N   invalidr   )r   r   r    r   )r*   r
   r
   r   test_f2py_init_compile_failureV   s   r/   c                  C   s8   zt j} dt _tjd}t|d W | t _d S | t _w )Nzdoes not existr.      )r!   
executabler   r   r    r   )tempr*   r
   r
   r   test_f2py_init_compile_bad_cmd]   s   r3   r%   z'program test_f2py
end program test_f2pys'   program test_f2py
end program test_f2pyc              	   C   sP   t  }zt t|  tjj|ddd}t|d W t | d S t | w )Ntest_compile_from_stringsz.f90)r   	extensionr   )r   r   r   r   r   r   r    r   )tmpdirr%   r(   r*   r
   r
   r   r4   o   s   r4   )__doc__r!   r   r   	importlibr   r   
numpy.f2pyr   numpy.testingr   r   r   r   markparametrizeleaks_referencesr-   r/   r3   r4   r
   r
   r
   r   <module>   s.    	9