Your IP : 18.220.227.250


Current Path : /usr/lib/python3.6/site-packages/setuptools/command/__pycache__/
Upload File :
Current File : //usr/lib/python3.6/site-packages/setuptools/command/__pycache__/build_ext.cpython-36.pyc

3

9��fu3�@s�ddlZddlZddlZddlZddlmZddlmZddl	m
Z
ddlmZm
Z
ddlmZddlmZddlmZdd	lmZyddlmZed
�Wnek
r�eZYnXe
d�ddlmZd
d�ZdZdZdZej dkr�dZn>ej!dk�r,yddl"Z"e#e"d�ZZWnek
�r*YnXdd�Z$dd�Z%Gdd�de�Ze�s^ej!dk�rjd!dd�Z&ndZd"dd�Z&dd �Z'dS)#�N)�	build_ext)�	copy_file)�new_compiler)�customize_compiler�get_config_var)�DistutilsError)�log)�Library)�sixzCython.Compiler.Main�LDSHARED)�_config_varscCsZtjdkrNtj�}z$dtd<dtd<dtd<t|�Wdtj�tj|�Xnt|�dS)N�darwinz0gcc -Wl,-x -dynamiclib -undefined dynamic_lookuprz -dynamiclib�CCSHAREDz.dylib�SO)�sys�platform�_CONFIG_VARS�copyr�clear�update)�compilerZtmp�r�/usr/lib/python3.6/build_ext.py�_customize_compiler_for_shlibs
rFZsharedr
T�nt�RTLD_NOWcCstr|SdS)N�)�	have_rtld)�srrr�<lambda>>srcCs>x8dd�tj�D�D]"\}}}d|kr*|S|dkr|SqWdS)z;Return the file extension for an abi3-compliant Extension()css |]}|dtjkr|VqdS)�N)�impZC_EXTENSION)�.0rrrr�	<genexpr>Csz"get_abi3_suffix.<locals>.<genexpr>z.abi3z.pydN)r!Zget_suffixes)�suffix�_rrr�get_abi3_suffixAs
r&c@sveZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zddd�ZdS)rcCs.|jd}|_tj|�||_|r*|j�dS)z;Build extensions in build directory, then copy if --inplacerN)Zinplace�
_build_ext�run�copy_extensions_to_source)�selfZold_inplacerrrr(Ks

z
build_ext.runc
Cs�|jd�}x�|jD]�}|j|j�}|j|�}|jd�}dj|dd��}|j|�}tj	j|tj	j
|��}tj	j|j|�}	t|	||j
|jd�|jr|j|p�tj|d�qWdS)N�build_py�.�)�verbose�dry_runT���)�get_finalized_command�
extensions�get_ext_fullname�name�get_ext_filename�split�joinZget_package_dir�os�path�basename�	build_librr.r/�_needs_stub�
write_stub�curdir)
r*r+�ext�fullname�filenameZmodpath�packageZpackage_dirZ
dest_filenameZsrc_filenamerrrr)Ss




z#build_ext.copy_extensions_to_sourcecCs�tj||�}||jkr�|j|}tjo4t|d�o4t�}|r^td�}|dt|��}|t�}t	|t
�r�tjj
|�\}}|jj|t�Str�|jr�tjj|�\}}tjj|d|�S|S)NZpy_limited_api�
EXT_SUFFIXzdl-)r'r5�ext_mapr
ZPY3�getattrr&�_get_config_var_837�len�
isinstancer	r8r9�splitext�shlib_compiler�library_filename�libtype�	use_stubs�_links_to_dynamicr6r7)r*r@rAr?Zuse_abi3Zso_ext�fn�drrrr5is"





zbuild_ext.get_ext_filenamecCs tj|�d|_g|_i|_dS)N)r'�initialize_optionsrJ�shlibsrD)r*rrrrQ~s
zbuild_ext.initialize_optionscCs2tj|�|jpg|_|j|j�dd�|jD�|_|jrB|j�x|jD]}|j|j�|_qJWx�|jD]�}|j}||j	|<||j	|j
d�d<|jr�|j|�p�d}|o�to�t
|t�}||_||_|j|�}|_tjjtjj|j|��}|o�||jk�r|jj|�|rhtrhtj|jkrh|jjtj�qhWdS)NcSsg|]}t|t�r|�qSr)rHr	)r"r?rrr�
<listcomp>�sz.build_ext.finalize_options.<locals>.<listcomp>r,r-Fr0)r'�finalize_optionsr2Zcheck_extensions_listrR�setup_shlib_compilerr3r4�
_full_namerDr6�links_to_dynamicrMrHr	rNr<r5�
_file_namer8r9�dirnamer7r;�library_dirs�appendr>�runtime_library_dirs)r*r?r@Zltd�nsrAZlibdirrrrrT�s,

zbuild_ext.finalize_optionscCs�t|j|j|jd�}|_t|�|jdk	r8|j|j�|jdk	rbx|jD]\}}|j	||�qJW|j
dk	r�x|j
D]}|j|�qtW|jdk	r�|j
|j�|jdk	r�|j|j�|jdk	r�|j|j�|jdk	r�|j|j�tj|�|_dS)N)rr/�force)rrr/r^rJrZinclude_dirsZset_include_dirsZdefineZdefine_macroZundefZundefine_macro�	librariesZ
set_librariesrZZset_library_dirsZrpathZset_runtime_library_dirsZlink_objectsZset_link_objects�link_shared_object�__get__)r*rr4�valueZmacrorrrrU�s(






zbuild_ext.setup_shlib_compilercCst|t�r|jStj||�S)N)rHr	�export_symbolsr'�get_export_symbols)r*r?rrrrd�s
zbuild_ext.get_export_symbolscCs\|j�|j}z@t|t�r"|j|_tj||�|jrL|jd�j	}|j
||�Wd||_XdS)Nr+)Z_convert_pyx_sources_to_langrrHr	rJr'�build_extensionr<r1r;r=)r*r?Z	_compiler�cmdrrrre�s
zbuild_ext.build_extensioncsPtjdd�|jD���dj|jjd�dd	�dg��t��fdd�|jD��S)
z?Return true if 'ext' links to a dynamic lib in the same packagecSsg|]
}|j�qSr)rV)r"�librrrrS�sz.build_ext.links_to_dynamic.<locals>.<listcomp>r,Nr-rc3s|]}�|�kVqdS)Nr)r"Zlibname)�libnames�pkgrrr#�sz-build_ext.links_to_dynamic.<locals>.<genexpr>r0)�dict�fromkeysrRr7rVr6�anyr_)r*r?r)rhrirrW�s zbuild_ext.links_to_dynamiccCstj|�|j�S)N)r'�get_outputs�_build_ext__get_stubs_outputs)r*rrrrm�szbuild_ext.get_outputscs6�fdd��jD�}tj|�j��}tdd�|D��S)Nc3s0|](}|jrtjj�jf|jjd���VqdS)r,N)r<r8r9r7r;rVr6)r"r?)r*rrr#�sz0build_ext.__get_stubs_outputs.<locals>.<genexpr>css|]\}}||VqdS)Nr)r"�baseZfnextrrrr#�s)r2�	itertools�product�!_build_ext__get_output_extensions�list)r*Zns_ext_basesZpairsr)r*rZ__get_stubs_outputs�s

zbuild_ext.__get_stubs_outputsccs"dVdV|jd�jrdVdS)Nz.pyz.pycr+z.pyo)r1�optimize)r*rrrZ__get_output_extensions�sz!build_ext.__get_output_extensionsFcCs.tjd|j|�tjj|f|jjd���d}|rJtjj|�rJt|d��|j	s�t
|d�}|jdjddd	td
�dtjj
|j�dd
dtd�dddtd�ddtd�dddg��|j�|�r*ddlm}||gdd|j	d�|jd�j}|dk�r||g|d|j	d�tjj|��r*|j	�r*tj|�dS)Nz writing stub loader for %s to %sr,z.pyz already exists! Please delete.�w�
zdef __bootstrap__():z-   global __bootstrap__, __file__, __loader__z%   import sys, os, pkg_resources, impz, dlz:   __file__ = pkg_resources.resource_filename(__name__,%r)z   del __bootstrap__z    if '__loader__' in globals():z       del __loader__z#   old_flags = sys.getdlopenflags()z   old_dir = os.getcwd()z   try:z(     os.chdir(os.path.dirname(__file__))z$     sys.setdlopenflags(dl.RTLD_NOW)z(     imp.load_dynamic(__name__,__file__)z   finally:z"     sys.setdlopenflags(old_flags)z     os.chdir(old_dir)z__bootstrap__()rr)�byte_compileT)rtr^r/Zinstall_lib)r�inforVr8r9r7r6�existsrr/�open�write�if_dlr:rX�closeZdistutils.utilrwr1rt�unlink)r*�
output_dirr?�compileZ	stub_file�frwrtrrrr=�sP




zbuild_ext.write_stubN)F)�__name__�
__module__�__qualname__r(r)r5rQrTrUrdrerWrmrnrrr=rrrrrJs
	rc

Cs(|j|j|||||||||	|
||�
dS)N)�linkZSHARED_LIBRARY)
r*�objects�output_libnamerr_rZr\rc�debug�
extra_preargs�extra_postargs�
build_temp�target_langrrrr`s
r`Zstaticc
Cs^|dkst�tjj|�\}}
tjj|
�\}}|jd�jd�rH|dd�}|j|||||�dS)N�xrg�)�AssertionErrorr8r9r6rIrK�
startswithZcreate_static_lib)r*r�r�rr_rZr\rcr�r�r�r�r�rAr:r?rrrr`,scCstjdkrd}t|�S)z�
    In https://github.com/pypa/setuptools/pull/837, we discovered
    Python 3.3.0 exposes the extension suffix under the name 'SO'.
    r�r-r)r�r�r-)r�version_infor)r4rrrrFDs
rF)
NNNNNrNNNN)
NNNNNrNNNN)(r8rrpr!Zdistutils.command.build_extrZ
_du_build_extZdistutils.file_utilrZdistutils.ccompilerrZdistutils.sysconfigrrZdistutils.errorsrZ	distutilsrZsetuptools.extensionr	Zsetuptools.externr
ZCython.Distutils.build_extr'�
__import__�ImportErrorrrrrrMrLrr4Zdl�hasattrr|r&r`rFrrrr�<module>sZ

	Q	


?>