ķ
Ú6e]c           @` sū   d  Z  d d l m Z m Z m 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   Z e
 j j d	 d
 d g d d g  d    Z d   Z d   Z e
 j j d d d g  d    Z d S(   s0   See https://github.com/numpy/numpy/pull/11937.

i    (   t   divisiont   absolute_importt   print_functionN(   t   import_module(   t   assert_equali   (   t   utilc           C` sn   t  j d k r2 t  j d d k  r2 t j d  n  t j   sN t j d  n  t j   sj t j d  n  d  S(   Nt   win32i    i   s)   Fails with MinGW64 Gfortran (Issue #9673)s   Needs C compilers   Needs FORTRAN 77 compiler(   t   syst   platformt   version_infot   pytestt   skipR   t   has_c_compilert   has_f77_compiler(    (    (    sE   lib/python2.7/site-packages/numpy/f2py/tests/test_compile_function.pyt   setup_module   s    "t
   extra_argss   --noopts   --debugs   --noopt --debugt    c   
   	   C` sô   d } t  j   } t  j   } t j   } t j j | t t j	    d  } x | d  g D] } z5 t j |  t j j | d | d |  d | } Wd  t j |  Xt | d  t j d k r\ t |  } | j   }	 t |	 d  q\ q\ Wd  S(	   NsT   
        integer function foo()
        foo = 10 + 5
        return
        end
    s   .ft
   modulenameR   t	   source_fni    R   i   (   R   t   get_module_dirt   get_temp_module_namet   ost   getcwdt   patht   joint   strt   uuidt   uuid4t   Nonet   chdirt   numpyt   f2pyt   compileR   R   R   R   t   foo(
   R   t   fsourcet   moddirt   modnamet   cwdt   targetR   t   ret_valt   return_checkt   calc_result(    (    sE   lib/python2.7/site-packages/numpy/f2py/tests/test_compile_function.pyt   test_f2py_init_compile   s&    %	c          C` s#   t  j j d  }  t |  d  d  S(   Nt   invalidi   (   R   R   R    R   (   R'   (    (    sE   lib/python2.7/site-packages/numpy/f2py/tests/test_compile_function.pyt   test_f2py_init_compile_failureV   s    c          C` sF   z5 t  j }  d t  _ t j j d  } t | d  Wd  |  t  _ Xd  S(   Ns   does not existR+   i   (   R   t
   executableR   R   R    R   (   t   tempR'   (    (    sE   lib/python2.7/site-packages/numpy/f2py/tests/test_compile_function.pyt   test_f2py_init_compile_bad_cmd]   s    		R"   s'   program test_f2py
end program test_f2pyc         C` sc   t  j   } zB t  j t |    t j j | d d d d } t | d  Wd  t  j |  Xd  S(   NR   t   test_compile_from_stringst	   extensions   .f90i    (   R   R   R   R   R   R   R    R   (   t   tmpdirR"   R%   R'   (    (    sE   lib/python2.7/site-packages/numpy/f2py/tests/test_compile_function.pyR0   o   s    		(   t   __doc__t
   __future__R    R   R   R   R   R   t	   importlibR   R
   t
   numpy.f2pyR   t   numpy.testingR   R   R   R   t   markt   parametrizeR*   R,   R/   R0   (    (    (    sE   lib/python2.7/site-packages/numpy/f2py/tests/test_compile_function.pyt   <module>   s"   		$8		