ó É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.pyts "  ! *