3
���h� � @ sz d Z dddgZddlZddlZddlZddlmZ ddlmZ dd lmZ ej Z ej
Z
ddd�Zddlm
Z
e
e�Z[
dS )z(Fortran to Python Interface Generator.
�run_main�compile�f2py_testing� N� )�f2py2e)r )�diagnose�untitled� T�.fc C sJ ddl }ddl}|dkr4|j|d�\}} tj|� n|} t| t�sLt| d�} z�t| d��}|j| � W dQ R X dd||j g}
t|t�r�tj dk}|j
||d �}|
j|� tj
dd
g|
}ytj|�}
W nJ tjk
r� } z|j}d}
W Y dd}~X n* tk
�r d}d}
Y nX d}|
j� }
|�r,t|
� W d|dk�rDtj| � 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)�suffixzutf-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�split�extend�sys�
executable�
subprocess�check_output�CalledProcessError�
returncode�OSError�decode�print�remove)�source�
modulename�
extra_args�verboseZ source_fn� extensionr r �f�fname�argsZis_posix�c�output�exc�status� r1 �4/tmp/pip-build-5_djhm0z/numpy/numpy/f2py/__init__.pyr sD 2
)�PytestTester)r r TNr
)�__doc__�__all__r r r r r r r r �mainr Znumpy._pytesttesterr3 �__name__�testr1 r1 r1 r2 �<module> s" |