HOME


sh-3ll 1.0
DIR:/usr/local/lib64/python3.6/site-packages/numpy/distutils/command/__pycache__/
Upload File :
Current File : //usr/local/lib64/python3.6/site-packages/numpy/distutils/command/__pycache__/config.cpython-36.pyc
3

���h�P�@s�ddlZddlZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZddlm
Z
ddlmZmZddl
Z
ddlmZddlmZdd	lmZmZmZmZmZmZmZd
e	d<de	d
<Gdd�de�ZGdd�d�ZdS)�N)�config)�LANG_EXT)�log)�	copy_file)�CompileError�	LinkError)�filepath_from_subprocess_output)�generate_manifest)�check_gcc_function_attribute�,check_gcc_function_attribute_with_intrinsics�check_gcc_variable_attribute�check_gcc_version_at_least�check_inline�check_restrict�check_compiler_gccz.f�f77z.f90�f90c@s�eZdZejd/g7_dd�Zdd�Zdd	�Zd
d�Zdd
�Z	d0dd�Z
d1dd�Zd2dd�Zd3dd�Z
d4dd�Zd5dd�Zd6dd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd7d+d,�Zd8d-d.�ZdS)9r�
fcompiler=N�!specify the Fortran compiler typecCsd|_tj|�dS)N)�	fcompiler�
old_config�initialize_options)�self�r�?/tmp/pip-build-5_djhm0z/numpy/numpy/distutils/command/config.pyr$szconfig.initialize_optionscCsFtj|�ddlm}m}tjdkr�|jjdkr�|jj	s�y|jj
�WnTtk
r�}z8tj
d�||jjjf}ttj
d��tjj|��WYdd}~XnXdd	lm}|j�d
kr�x*|jj|jjgD]}d|kr�|jd�q�Wt|j|��sB||j|jd|jd
�|_|jdk	�rB|jj|j�|jj��rB|jj|�|jj �dS)Nr)�	FCompiler�
new_fcompiler�win32�msvc�intelw�intelemwas                        Could not initialize compiler instance: do you have Visual Studio
                        installed?  If you are trying to build with MinGW, please use "python setup.py
                        build -c mingw32" instead.  If you have Visual Studio installed, check it is
                        correctly installed, and the right version (VS 2008 for python 2.6, 2.7 and 3.2,
                        VS 2010 for >= 3.3).

                        Original exception was: %s, and the Compiler class was %s
                        ============================================================================zd                        ============================================================================)�
msvc9compiler�
z	/MANIFEST�)�compiler�dry_run�force�
c_compiler)rrr )!r�_check_compilerZnumpy.distutils.fcompilerrr�sys�platformr$�
compiler_typeZinitializedZ
initialize�IOError�textwrap�dedent�	__class__�__name__�print�	distutils�errors�DistutilsPlatformErrorr!Zget_build_versionZldflags_sharedZldflags_shared_debug�append�
isinstancerr%Z	customize�distribution�get_versionZ
customize_cmdZshow_customization)rrr�e�msgr!Zldflagsrrrr((s:
zconfig._check_compilerc	Cs�ddlm}ddlm}|j}|dkr.|j|_y||f|�}Wn8||fk
rx}zt|�||_|�WYdd}~XnX||_|S)Nr)r)�DistutilsExecErrorrr)rr)�distutils.ccompilerrZdistutils.errorsr;r$r�str)	rZmth�lang�argsrr;Z
save_compiler�retr9rrr�_wrap_methodYszconfig._wrap_methodcCs4|jtj|||||f�\}}|jj|d�||fS)Nz.d)rAr�_compile�
temp_filesr5)r�body�headers�include_dirsr>�src�objrrrrBhs
zconfig._compilec

Cs�|jjdk�r�|pgdd�}|p$gdd�}|dkr�d}|jr�x`|jjpLgD]P}|jd�r�ytjdd|g�}Wnttjfk
r�Yn
Xt	|�}|j
|�qNWx&|jjp�gD]}||kr�|j
|�q�Wx�|D]�}|jd�r�q�d}	x4|p�gD](}
tj
j|
d	|�}tj
j|�r�d
}	Pq�W|	�r"q�d}	x\|D]T}
tj
j|
d|�}tj
j|��r,tj
j|
d	|�}t||�|jj
|�d
}	P�q,W|	�r�q�tjd||f�q�Wn|jjd
k�r�t|�|jtj|||||||f�S)Nrrr�cz/usr/libZcygpathz-wFz%s.libTzlib%s.az+could not find library %r in directories %sZmingw32)rr)r$r+r�library_dirs�
startswith�
subprocess�check_output�OSError�CalledProcessErrorrr5�	libraries�os�path�join�isfilerrCr�warnr	rAr�_link)
rrDrErFrPrJr>�d�libnameZ
fileexistsZlibdirZlibfileZlibfile2rrrrVps^





zconfig._linkrIcCs|j�|jd|g|�S)Nz2/* we need a dummy line to make distutils happy */)r(�try_compile)r�headerrFrJr>rrr�check_header�szconfig.check_headercCs(|j�tjd�||f}|j|||�S)Nz�
            int main(void)
            {
            #ifndef %s
                (void) %s;
            #endif
                ;
                return 0;
            })r(r-r.rY)r�symbolrErFrDrrr�
check_decl�szconfig.check_declcCs&|j�tjd�|f}|j|||�S)Nz�
            int main(void)
            {
            #if %s
            #else
            #error false or undefined macro
            #endif
                ;
                return 0;
            })r(r-r.rY)rr\rErFrDrrr�check_macro_true�s	zconfig.check_macro_truecCsp|j�tjd�d|i}d}zBy |j|d|i||d�d}Wntjjk
r\d}YnXWd|j�X|S)zYCheck type availability. Return True if the type can be compiled,
        False otherwisez�
            int main(void) {
              if ((%(name)s *) 0)
                return 0;
              if (sizeof (%(name)s))
                return 0;
            }
            �nameF�typerITN)r(r-r.rBr2r3r�_clean)r�	type_namerErFrJrD�strrr�
check_type�s

zconfig.check_typecCsf|j�tjd�}|j|d|i||d�|j�|r�tjd�}xH|D]@}y&|j|||d�||d�|j�|Stk
r�YqFXqFWtjd�}d}d}	xVy(|j|||	d�||d�|j�PWq�tk
r�|	d}d	|	d}	Yq�Xq�W|	}
xh||
k�r`|
|d	|}	y*|j|||	d�||d�|j�|	}
Wq�tk
�r\|	d}Yq�Xq�W|S)
zCheck size of a given type.a,
            typedef %(type)s npy_check_sizeof_type;
            int main (void)
            {
                static int test_array [1 - 2 * !(((long) (sizeof (npy_check_sizeof_type))) >= 0)];
                test_array [0] = 0

                ;
                return 0;
            }
            r`rIaW
                typedef %(type)s npy_check_sizeof_type;
                int main (void)
                {
                    static int test_array [1 - 2 * !(((long) (sizeof (npy_check_sizeof_type))) == %(size)s)];
                    test_array [0] = 0

                    ;
                    return 0;
                }
                )r`�sizea3
            typedef %(type)s npy_check_sizeof_type;
            int main (void)
            {
                static int test_array [1 - 2 * !(((long) (sizeof (npy_check_sizeof_type))) <= %(size)s)];
                test_array [0] = 0

                ;
                return 0;
            }
            rr#�)r(r-r.rBrar)rrbrErFrJ�expectedrDre�lowZmid�highrrr�check_type_size�sR








zconfig.check_type_sizeFc	
Cs�|j�g}	|r6t|�tkr(|	j|�n|	jd|�|	jd�|	jd|�|	jd�|	jd�|r�|dkrrd}|	jd||f�n|	jd|�|	jd	�|	jd
�dj|	�d}	|j|	||||�S)Nzint %s (void);z#ifdef _MSC_VERz#pragma function(%s)z#endifzint main (void) {�z	  %s(%s);z  %s;z  return 0;�}�
)r(r`r=r5rS�try_link)
r�funcrErFrPrJ�decl�call�	call_argsrDrrr�
check_func;s(





zconfig.check_funcc	Cs*|j�g}	|r8x&|j�D]\}
}|r|	jd|
�qW|	jd�x|D]}|	jd|�qHW|	jd�|	jd�|r�x~|D]X}
|
|kr�||
r�|o�|
|ko�||
s�d}
n||
}
|	jd|
|
f�q||	jd|
�q|Wnx|D]}
|	jd|
�q�W|	jd	�|	jd
�dj|	�d}	|j|	||||�S)a0Check a list of functions at once.

        This is useful to speed up things, since all the functions in the funcs
        list will be put in one compilation unit.

        Arguments
        ---------
        funcs : seq
            list of functions to test
        include_dirs : seq
            list of header paths
        libraries : seq
            list of libraries to link the code snippet to
        library_dirs : seq
            list of library paths
        decl : dict
            for every (key, value), the declaration in the value will be
            used for function in key. If a function is not in the
            dictionary, no declaration will be used.
        call : dict
            for every item (f, value), if the value is True, a call will be
            done to the function f.
        zint %s (void);z#ifdef _MSC_VERz#pragma function(%s)z#endifzint main (void) {rkz	  %s(%s);z  %s;z  return 0;rlrm)r(�itemsr5rSrn)r�funcsrErFrPrJrprqrrrD�f�vror?rrr�check_funcs_once]s4








zconfig.check_funcs_oncecCst|�S)zUReturn the inline keyword recognized by the compiler, empty string
        otherwise.)r)rrrrr�szconfig.check_inlinecCst|�S)zWReturn the restrict keyword recognized by the compiler, empty string
        otherwise.)r)rrrrr�szconfig.check_restrictcCst|�S)z$Return True if the C compiler is gcc)r)rrrrr�szconfig.check_compiler_gcccCst|||�S)N)r
)r�	attributer_rrrr
�sz#config.check_gcc_function_attributecCst|||||�S)N)r)rryr_�code�includerrrr�sz3config.check_gcc_function_attribute_with_intrinsicscCs
t||�S)N)r)rryrrrr�sz#config.check_gcc_variable_attributercCst||||�S)zYReturn True if the GCC version is greater than or equal to the
        specified version.)r
)r�major�minorZ
patchlevelrrrr
�sz!config.check_gcc_version_at_leastcCs~tjdtdd�|j�d\}}	�y&t�}
y&|j||||||�\}}}
|
j�Wn$tk
rt|
j}	|
j��YnXt	j
jd|
�}
ytj
|
gdd�}	WnHtjk
r�}z|j}d}	WYdd}~Xn$tk
r�d	}d}	Yn
Xt|	�}	tt	d
��r8t	j|�}t	j|��r<t	j|�}tjd|f�|tjk�r<t�n|}tjd�Wn$ttfk
�rltjd
�YnX|j�||	fS)z�Try to compile, link to an executable, and run a program
        built from 'body' and 'headers'. Returns the exit status code
        of the program and its output.
        z�
+++++++++++++++++++++++++++++++++++++++++++++++++
Usage of get_output is deprecated: please do not 
use it anymore, and avoid configuration checks 
involving running executable on the target machine.
+++++++++++++++++++++++++++++++++++++++++++++++++
rf)�
stacklevel�rk�.)�cwdN��WEXITSTATUSz subprocess exited with signal %dzsuccess!zfailure.)rrk)�warningsrU�DeprecationWarningr(�
GrabStdoutrV�restore�	Exception�datarQrRrSrLrMrO�
returncoderNr�hasattrr��WIFSIGNALED�WTERMSIGr�error�signal�SIGINT�KeyboardInterrupt�inforrra)rrDrErFrPrJr>Zuse_tee�exitcode�outputZgrabberrGrHZexe�excZ
exitstatus�sigrrr�
get_output�sJ




zconfig.get_output)rNr)NNrI)NN)NN)NNN)NNNN)NNNNFFN)NNNNFFN)rr)NNNNrIN)r0�
__module__�__qualname__r�user_optionsrr(rArBrVr[r]r^rdrjrsrxrrrr
rrr
r�rrrrrs:
16




T
 
:
rc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
r�cCstj|_d|_|t_dS)Nrk)r)�stdout�
sys_stdoutr�)rrrr�__init__�szGrabStdout.__init__cCs|jj|�|j|7_dS)N)r��writer�)rr�rrrr��szGrabStdout.writecCs|jj�dS)N)r��flush)rrrrr�szGrabStdout.flushcCs|jt_dS)N)r�r)r�)rrrrr�szGrabStdout.restoreN)r0r�r�r�r�r�r�rrrrr��sr�)rQr�rLr)r-r�Zdistutils.command.configrrrr2r�distutils.file_utilrr<rrZnumpy.distutils.exec_commandrZ numpy.distutils.mingw32ccompilerr	Z numpy.distutils.command.autodistr
rrr
rrrr�rrrr�<module>s*$Y