3
ßL]¨  ã               @   sx   d dl mZmZmZ d dlmZmZ d dlZd dlZd dl	Z	d dl
mZ d dlmZ G dd„ deƒZG dd	„ d	eƒZdS )
é    )ÚdivisionÚabsolute_importÚprint_function)ÚPIPEÚPopenN)Úlapack_lite)Úassert_c               @   s$   e Zd Zdd„ Zdd„ Zdd„ ZdS )ÚFindDependenciesLddc             C   sP   dg| _ y t| j ttd�}|jƒ \}}W n" tk
rJ   td| j  ƒ‚Y nX d S )NZldd)ÚstdoutÚstderrzcommand %s cannot be run)Úcmdr   r   ÚcommunicateÚOSErrorÚRuntimeError)ÚselfÚpr
   r   © r   ú@/tmp/pip-install-q_7g0qgj/Numpy/numpy/linalg/tests/test_build.pyÚ__init__   s    zFindDependenciesLdd.__init__c             C   s<   t | j|g ttd�}|jƒ \}}|jdks8td| ƒ‚|S )N)r
   r   r   z failed dependencies check for %s)r   r   r   r   Ú
returncoder   )r   Úlfiler   r
   r   r   r   r   Úget_dependencies   s
    
z$FindDependenciesLdd.get_dependenciesc       	      C   s`   | j |ƒ}tdd„ |D ƒƒ}g }x:|jƒ D ].}x(|jƒ D ]\}}|j|ƒr8|j|ƒ q8W q*W |S )Nc             S   s   g | ]}|t j|ƒf‘qS r   )ÚreÚcompile)Ú.0Údepr   r   r   ú
<listcomp>"   s    z9FindDependenciesLdd.grep_dependencies.<locals>.<listcomp>)r   ÚdictÚ
splitlinesÚitemsÚsearchÚappend)	r   r   Údepsr
   ZrdepsZfoundsÚlÚkÚvr   r   r   Úgrep_dependencies   s    

z%FindDependenciesLdd.grep_dependenciesN)Ú__name__Ú
__module__Ú__qualname__r   r   r&   r   r   r   r   r	      s   	r	   c               @   s4   e Zd Zejjejdd… dk dd�dd„ ƒZdS )ÚTestF77MismatchNé   Úlinuxz)no fortran compiler on non-Linux platform)Úreasonc             C   s.   t ƒ }|jtjddgƒ}tt|ƒdkdƒ d S )Ns   libg2cs   libgfortrané   zœBoth g77 and gfortran runtimes linked in lapack_lite ! This is likely to
cause random crashes and wrong results. See numpy INSTALL.txt for more
information.)r	   r&   r   Ú__file__r   Úlen)r   Úfr"   r   r   r   Útest_lapack.   s
    
zTestF77Mismatch.test_lapack)	r'   r(   r)   ÚpytestÚmarkZskipifÚsysÚplatformr2   r   r   r   r   r*   ,   s   r*   )Ú
__future__r   r   r   Ú
subprocessr   r   r5   r   r3   Znumpy.linalgr   Znumpy.testingr   Úobjectr	   r*   r   r   r   r   Ú<module>   s    