3
­?d]v
  ã               @   sZ   d dl mZmZmZ d dlZd dlmZmZ d dlZ	dddddddgZ
dd„ Zdd„ ZdS )é    )ÚdivisionÚabsolute_importÚprint_functionN)Úassert_Úsuppress_warningsÚf77ÚF77FLAGSÚf90ÚF90FLAGSÚfreeÚ	FREEFLAGSÚarchÚFARCHÚdebugÚFDEBUGÚflagsÚFFLAGSÚ	linker_soÚLDFLAGSc             C   s   | j ddƒ tjjjdd�}|jjdd„ ƒ}xRtD ]J\}}dj|ƒ}t	||ƒ}| j ||ƒ t	||ƒ}| j
|ƒ t||gkƒ q2W | j ddƒ xntD ]f\}}dj|ƒ}t	||ƒ}| j ||ƒ t	||ƒ}| j
|ƒ |d kræt||gkƒ q’t|||g kƒ q’W d S )	NÚNPY_DISTUTILS_APPEND_FLAGSÚ0Únone)Úcompilerc              _   s   d S )N© )ÚargsÚkwargsr   r   úE/tmp/pip-build-op5p2y5_/numpy/numpy/distutils/tests/test_fcompiler.pyÚ<lambda>   s    z&test_fcompiler_flags.<locals>.<lambda>z-dummy-{}-flagÚ1)ÚsetenvÚnumpyÚ	distutilsÚ	fcompilerÚnew_fcompilerÚ	flag_varsÚcloneÚcustomizable_flagsÚformatÚgetattrÚdelenvr   )ÚmonkeypatchÚfcr$   ÚoptÚenvvarÚnew_flagÚ
prev_flagsÚ	new_flagsr   r   r   Útest_fcompiler_flags   s(    







r1   c             C   s  y6t ƒ �&}|jƒ  tjjjdd�}|jƒ  W d Q R X W n$ tjjjk
rZ   tj	dƒ Y nX | j
ddd� x tD ]˜\}}dj|ƒ}t ƒ �}|jƒ  t|j|ƒ}W d Q R X | j||ƒ t ƒ �0}|jƒ  t|j|ƒ}|ræt|jƒdksæt‚W d Q R X | j
|ƒ t||gkƒ qpW d S )	NZgnu95)r   z.gfortran not found, so can't execute this testr   F)Zraisingz-dummy-{}-flagé   )r   Úrecordr    r!   r"   r#   Z	customizeZCompilerNotFoundÚpytestÚskipr)   r&   r'   r(   r$   r   ÚlenÚlogÚAssertionErrorr   )r*   Úsupr+   r,   r-   r.   r/   r0   r   r   r   Ú#test_fcompiler_flags_append_warning1   s*    

r:   )r   r   )r	   r
   )r   r   )r   r   )r   r   )r   r   )r   r   )Ú
__future__r   r   r   r4   Znumpy.testingr   r   Znumpy.distutils.fcompilerr    r&   r1   r:   r   r   r   r   Ú<module>   s   