� �9Zc@`s dZddlmZmZmZddlZddlmZm Z m Z m Z ddl Z ddl mZmZddlZddlmZmZddlmZddlmZdd lmZe ee ej�d d ��Zed �Zee�d ��ZdS(s\ Test scripts Test that we can run executable scripts that have been installed with numpy. i(tdivisiontprint_functiontabsolute_importN(tjointisfiletdirnametbasename(tPopentPIPE(t basestringtasbytes(t assert_equal(tskipif(tassert_s..ssetup.pyc C`st|t�r|gn t|�}tjdkrjg|D]'}d|kr[dj|�n|^q:}nt|dtdt�}|j�\}}|j �d kr�|j �n|r|j dkrt djddd d d dd d g�j|||���n|j ||fS(sp Run command sequence `cmd` returning exit code, stdout, stderr Parameters ---------- cmd : str or sequence string with command name or sequence of strings defining command check_code : {True, False}, optional If True, raise error for non-zero return code Returns ------- returncode : int return code from execution of `cmd` stdout : bytes (python 3) or str (python 2) stdout from `cmd` stderr : bytes (python 3) or str (python 2) stderr from `cmd` Raises ------ RuntimeError If `check_code` is True, and return code !=0 tntt s"{0}"tstdouttstderris sCommand "{0}" failed withs------s{1}ts{2}N(t isinstanceR tlisttostnametformatRRt communicatetpolltNonet terminatet returncodet RuntimeErrorR(tcmdt check_codetctprocRR((sK/opt/alt/python27/lib64/python2.7/site-packages/numpy/tests/test_scripts.pyt run_commands$7   'c C`sPtjdkr�ttj�}|jd�r:d|}n d|}ttj|dg�\}}}|j�td�k}t|d�n�tj }t |d�}t |d �}d d |d |d |f} t }xW| D]O}y?t|dg�\}}}t |j�td��t }PWq�q�Xq�Wd | } t|| �dS( Ntwin32tScriptss %s\f2py.pys%s\Scripts\f2py.pys-vt2sWarning: f2py not found in pathiitf2pyt.s/Warning: neither %s nor %s nor %s found in path(tsystplatformRt executabletendswithR"tstripR R t version_infotstrtFalseR tTrue( texe_dirtf2py_cmdtcodeRRtsuccesstversiontmajortminort f2py_cmdstmsg((sK/opt/alt/python27/lib64/python2.7/site-packages/numpy/tests/test_scripts.pyt test_f2py=s.  !   ( t__doc__t __future__RRRRtos.pathRtpathjoinRRRR(t subprocessRRtnumpytnptnumpy.compat.py3kR R t nose.toolsR tnumpy.testing.decoratorsR t numpy.testingR t__file__t is_inplaceR0R"R:(((sK/opt/alt/python27/lib64/python2.7/site-packages/numpy/tests/test_scripts.pyt<module>s "  ! *