Your IP : 3.145.41.108
3
\�z � @ s� d dl Z d dlZd dlZd dlZd dlmZ d dlT d dlmZm Z d dlm
Z
d dlmZ d dl
mZ d dlmZ d d lmZ d d
lmZ ejd�Zdd
� ZG dd� de�ZdS )� N)�Command)�*)�customize_compiler�get_python_version)�get_config_h_filename)�newer_group)� Extension)�get_platform)�log)� USER_BASEz3^[a-zA-Z_][a-zA-Z_0-9]*(\.[a-zA-Z_][a-zA-Z_0-9]*)*$c C s ddl m} | � d S )Nr )�show_compilers)�distutils.ccompilerr )r � r �3/usr/lib64/python3.6/distutils/command/build_ext.pyr s r c @ s e Zd ZdZdej Zd`dad d
de� fdcddde fdddedfddde fdgdhdidjdkdldmdndodpgZdd%d(d1d8gZ d:d2d;e
fgZd<d=� Zd>d?� Z
d@dA� ZdBdC� ZdDdE� ZdFdG� ZdHdI� ZdJdK� ZdLdM� ZejdNdO� �ZdPdQ� ZdRdS� ZdTdU� ZdVdW� ZdXdY� ZdZd[� Zd\d]� Zd^d_� Zd2S )q� build_extz8build C/C++ extensions (compile/link to build directory)z (separated by '%s')�
build-lib=�b�(directory for compiled extension modules�build-temp=�t�1directory for temporary files (build by-products)z
plat-name=�pz>platform name to cross-compile for, if supported (default: %s)�inplace�iz=ignore build-lib and put compiled extensions into the source z,directory alongside your pure Python modulesz
include-dirs=�Iz.list of directories to search for header files�define=�D�C preprocessor macros to define�undef=�U�!C preprocessor macros to undefine�
libraries=�l�!external C libraries to link withz
library-dirs=�Lz.directories to search for external C libraries�rpath=�R�7directories to search for shared C libraries at runtime�
link-objects=�O�2extra explicit link objects to include in the link�debug�g�'compile/link with debugging information�force�f�2forcibly build everything (ignore file timestamps)� compiler=�c�specify the compiler type� parallel=�j�number of parallel build jobs�swig-cppN�)make SWIG create C++ files (default is C)�
swig-opts=�!list of SWIG command line options�swig=�path to the SWIG executable�user�#add user include, library and rpathz
help-compilerzlist available compilersc C s� d | _ d | _d | _d | _d| _d | _d | _d | _d | _d | _ d | _
d | _d | _d | _
d | _d | _d | _d | _d | _d | _d | _d S )Nr )�
extensions� build_lib� plat_name�
build_tempr �package�include_dirs�define�undef� libraries�library_dirs�rpath�link_objectsr+ r. �compiler�swig�swig_cpp� swig_optsr= �parallel)�selfr r r �initialize_optionsj s* zbuild_ext.initialize_optionsc
C s� ddl m} | jdd'd(d)d*d+d,d-� | jd kr8| jj| _| jj| _|j� }|jdd�}| j d krn| jj pjg | _ t
| j t�r�| j jt
j�| _ tjtjkr�| j jt
jjtjd
�� | j j|� ||kr�| j j|� | jd� | jd� | jd k� r�g | _| jd k�rg | _nt
| jt��r&| jjt
j�| _| jd k�r:g | _nt
| jt��rX| jjt
j�| _t
jdk�rT| jjt
jjtjd�� tjtjk�r�| jjt
jjtjd�� | j�r�t
jj| jd�| _nt
jj| jd�| _| j jt
jjt� �� ttdd �}|�r| jj|� | j dk�rd}n| j dd � }t
jjtjd�}|�rHt
jj||�}| jj|� tj!d d� dk�s|tj!d d� dk�r�tj"j#t
jjtjd���r�| jjt
jjtjddt$� d�� n| jjd� |j%d ��r�|j&�s�| jj|j%d!�� n| jjd� | j'�r| j'jd"�}d#d$� |D �| _'| j(�r4| j(jd"�| _(| j)d k�rHg | _)n| j)jd%�| _)| j*�r�t
jjt+d
�}t
jjt+d�} t
jj,|��r�| j j|� t
jj,| ��r�| jj| � | jj| � t
| j-t��r�yt.| j-�| _-W n t/k
�r� t0d&��Y nX d S ).Nr )� sysconfigZbuildr@ rB rK r+ r. rO rA � )Z
plat_specific�includerG rJ �ntZlibsZDebugZRelease�_home�win32� ZPCbuild� �cygwin�atheos�bin�lib�python�config�.�Py_ENABLE_SHARED�LIBDIR�,c S s g | ]}|d f�qS )�1r )�.0Zsymbolr r r �
<listcomp>� s z.build_ext.finalize_options.<locals>.<listcomp>� zparallel should be an integer)r@ r@ )rB rB )rK rK )r+ r+ )r. r. )rO rO )rA rA )1� distutilsrR Zset_undefined_optionsrC �distributionZext_packageZext_modulesr? Zget_python_incrD �
isinstance�str�split�os�pathsep�sys�exec_prefix�base_exec_prefix�append�path�joinZensure_string_listrG rH rI �name�prefixr+ rB �dirnamer �getattrrA �platform�
executable�
startswithr �get_config_varZpython_buildrE rF rN r= r �isdirrO �int�
ValueErrorZDistutilsOptionError)
rP rR Z
py_includeZplat_py_include� _sys_home�suffixZnew_libZdefinesZuser_includeZuser_libr r r �finalize_options� s�
(
zbuild_ext.finalize_optionsc C st ddl m} | jsd S | jj� rL| jd�}| jj|j� p:g � | j j
|j� || j| j
| j| jd�| _t| j� tjdkr�| jt� kr�| jj| j� | jd k r�| jj| j� | jd k r�x | jD ]\}}| jj||� q�W | jd k �r x| jD ]}| jj|� q�W | jd k �r| jj| j� | j d k �r4| jj| j � | jd k �rN| jj| j� | j d k �rh| jj!| j � | j"� d S )Nr )�new_compiler�
build_clib)rK �verbose�dry_runr. rU )#r
r� r? ri Zhas_c_libraries�get_finalized_commandrG �extendZget_library_namesrH rr r� rK r� r� r. r rm ru rA r Z
initializerD Zset_include_dirsrE Zdefine_macrorF Zundefine_macroZ
set_librariesZset_library_dirsrI Zset_runtime_library_dirsrJ Zset_link_objects�build_extensions)rP r� r� ru �value�macror r r �run s>