ó
Ú6e]c           @` 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 e d d d  Z d d l m Z e e  Z [ d S(   s(   Fortran to Python Interface Generator.

i    (   t   divisiont   absolute_importt   print_functiont   run_maint   compilet   f2py_testingNi   (   t   f2py2e(   R   (   t   diagnoset   untitledt    s   .fc         C` sĪ  d d l  } d d l } | d k rL | j d |  \ } }	 t j |  n | }	 t |  t  ss t |  d  }  n  zt |	 d   } | j	 |   Wd QXd d | | j
 g }
 t | t j j  rė t j
 d k } | j | d | } n  |
 j |  t j d d	 g |
 } y t j |  } WnA t j k
 rI} | j } d
 } n# t k
 red } d
 } n Xd } | rt |  n  Wd | d k rt j |	  n  X| S(   s  
    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:

    i    Nt   suffixs   utf-8t   ws   -cs   -mt   posixs)   import numpy.f2py as f2py2e;f2py2e.main()R	   i   (   t   tempfilet   shlext   Nonet   mkstempt   ost   closet
   isinstancet   strt   opent   writet   namet   npt   compatt
   basestringt   splitt   extendt   syst
   executablet
   subprocesst   check_outputt   CalledProcessErrort
   returncodet   OSErrort   printt   remove(   t   sourcet
   modulenamet
   extra_argst   verboset	   source_fnt	   extensionR   R   t   ft   fnamet   argst   is_posixt   ct   outputt   exct   status(    (    s2   lib/python2.7/site-packages/numpy/f2py/__init__.pyR      sB    2		
(   t   PytestTester(   t   __doc__t
   __future__R    R   R   t   __all__R   R   R   t   numpyR   R	   R   R   R   R   t   maint   TrueR   R   t   numpy._pytesttesterR4   t   __name__t   test(    (    (    s2   lib/python2.7/site-packages/numpy/f2py/__init__.pyt   <module>   s&   		[