a
    �¥»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   sf   dg| _ z t| j ttd�}| ¡ \}}W n8 ty` } z td| j › d�ƒ|‚W Y d }~n
d }~0 0 d S )NZldd©ÚstdoutÚstderrzcommand z cannot be run)Úcmdr   r   ÚcommunicateÚOSErrorÚRuntimeError)ÚselfÚpr   r	   Úe© r   úW/home/yuhw/wc/pochoir/venv/lib/python3.9/site-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 ]\}}| |¡r4| |¡ q4q(|S )Nc                 S   s   g | ]}|t  |¡f‘qS r   )ÚreÚcompile)Ú.0Údepr   r   r   Ú
<listcomp>    ó    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é   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*   )Ú
subprocessr   r   r5   r   r3   Znumpy.linalgr   Znumpy.testingr   r   r*   r   r   r   r   Ú<module>   s    