3
ßL]  ã               @   s–   d Z ddlmZmZmZ dddgZddlZddlZddlZddl	Z
ddlmZ dd	lmZ dd
lmZ ejZejZddd„ZddlmZ eeƒZ[dS )z(Fortran to Python Interface Generator.

é    )ÚdivisionÚabsolute_importÚprint_functionÚrun_mainÚcompileÚf2py_testingNé   )Úf2py2e)r   )ÚdiagnoseÚuntitledÚ Tú.fc             C   sF  ddl }ddl}|dkr4|j|d�\}}	tj|ƒ n|}	t| tƒsLt| dƒ} zÞt|	dƒ�}|j| ƒ W dQ R X dd||j	g}
t|t
jjƒr¢tj	dk}|j||d	�}|
j|ƒ tjdd
g|
 }ytj|ƒ}W nJ tjk
rø } z|j}d}W Y dd}~X n" tk
�r   d}d}Y nX d}|�r(t|ƒ W d|dk�r@tj|	ƒ X |S )a›  
    Build extension module from a Fortran 77 source string with f2py.

    Parameters
    ----------
    source : str or bytes
        Fortran source of module / subroutine to compile

        .. versionchanged:: 1.16.0
           Accept str as well as bytes

    modulename : str, optional
        The name of the compiled python module
    extra_args : str or list, optional
        Additional parameters passed to f2py

        .. versionchanged:: 1.16.0
            A list of args may also be provided.

    verbose : bool, optional
        Print f2py output to screen
    source_fn : str, optional
        Name of the file where the fortran source is written.
        The default is to use a temporary file with the extension
        provided by the `extension` parameter
    extension : {'.f', '.f90'}, optional
        Filename extension if `source_fn` is not provided.
        The extension tells which fortran standard is used.
        The default is `.f`, which implies F77 standard.

        .. versionadded:: 1.11.0

    Returns
    -------
    result : int
        0 on success

    Examples
    --------
    .. include:: compile_session.dat
        :literal:

    r   N)Úsuffixzutf-8Úwz-cz-mÚposix)r   z)import numpy.f2py as f2py2e;f2py2e.main()r   é   )ÚtempfileÚshlexÚmkstempÚosÚcloseÚ
isinstanceÚstrÚopenÚwriteÚnameÚnpÚcompatÚ
basestringÚsplitÚextendÚsysÚ
executableÚ
subprocessÚcheck_outputÚCalledProcessErrorÚ
returncodeÚOSErrorÚprintÚremove)ÚsourceÚ
modulenameÚ
extra_argsÚverboseZ	source_fnÚ	extensionr   r   ÚfÚfnameÚargsZis_posixÚcÚoutputÚexcÚstatus© r6   ú6/tmp/pip-install-q_7g0qgj/Numpy/numpy/f2py/__init__.pyr      sB    2






)ÚPytestTester)r   r   TNr   )Ú__doc__Ú
__future__r   r   r   Ú__all__r!   r#   r   Znumpyr   r   r	   r   r
   r   Úmainr   Znumpy._pytesttesterr8   Ú__name__Útestr6   r6   r6   r7   Ú<module>   s&   
    
[