o
    6a^                     @   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   sX   dg| _ zt| j ttd}| \}}W d S  ty+ } z
td| j  d|d }~ww )Nlddstdoutstderrzcommand z cannot be run)cmdr   r   communicateOSErrorRuntimeError)selfpr	   r
   e r   ?/usr/lib/python3/dist-packages/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 ]\}}||r(|| qq|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	   rdeps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markskipifsysplatformr4   r   r   r   r   r,   *   s
    r,   )
subprocessr   r   r8   r   r5   numpy.linalgr   numpy.testingr   r   r,   r   r   r   r   <module>   s     