U
    X	a^                     @   s`   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Z
G dd dZdS )	    )PIPEPopenN)lapack_lite)assert_c                   @   s$   e Zd Zdd Zdd Zdd ZdS )FindDependenciesLddc              
   C   sd   dg| _ z t| j ttd}| \}}W n6 tk
r^ } ztd| j  d|W 5 d }~X Y nX d S )NZlddstdoutstderrzcommand z cannot be run)cmdr   r   communicateOSErrorRuntimeError)selfpr   r	   e r   A/tmp/pip-unpacked-wheel-zbzmve17/numpy/linalg/tests/test_build.py__init__   s    zFindDependenciesLdd.__init__c                 C   s>   t | j|g ttd}| \}}|jdks:td| |S )Nr   r   zfailed dependencies check for )r   r
   r   r   
returncoder   )r   lfiler   r   r	   r   r   r   get_dependencies   s
    
z$FindDependenciesLdd.get_dependenciesc           	      C   sX   |  |}tdd |D }g }| D ]*}| D ]\}}||r4|| q4q(|S )Nc                 S   s   g | ]}|t |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  }|tjddg}tt|dkd d S )Ns   libg2cs   libgfortran   zBoth 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platformr1   r   r   r   r   r)   *   s   r)   )
subprocessr   r   r4   r   r2   Znumpy.linalgr   Znumpy.testingr   r   r)   r   r   r   r   <module>   s    