Your IP : 3.144.6.236


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

U

�Qab�2�
@s�ddlZddlZddlZddlmZddlmZddlm	Z	ddl
mZmZddl
mZddlmZddlmZdd	lmZejr�ddlZd
d�e��D�ZnddlmZzddlmZed
�Wnek
r�eZYnXed�ddl
mZdd�Z dZ!dZ"dZ#ej$dk�rdZ"n>ej%dk�rTzddl&Z&e'e&d�Z"Z!Wnek
�rRYnXdd�Z(dd�Z)Gdd�de�Ze"�s�ej%dk�r�d"dd�Z*nd Z#d#d!d�Z*dS)$�N)�	build_ext)�	copy_file)�new_compiler)�customize_compiler�get_config_var)�DistutilsError)�log)�Library)�sixcCs g|]\}}}|tjkr|�qS�)�impZC_EXTENSION)�.0�s�_�tprr�@/usr/lib/python3.8/site-packages/setuptools/command/build_ext.py�
<listcomp>s
r��EXTENSION_SUFFIXESzCython.Compiler.Main�LDSHARED)�_config_varsc	CsZtjdkrNt��}z$dtd<dtd<dtd<t|�W5t��t�|�Xnt|�dS)N�darwinz0gcc -Wl,-x -dynamiclib -undefined dynamic_lookuprz -dynamiclibZCCSHAREDz.dylibZSO)�sys�platform�_CONFIG_VARS�copy�clear�updater)�compilerZtmprrr�_customize_compiler_for_shlib#s
�rFZsharedrT�nt�RTLD_NOWcCstr|SdS)N�)�	have_rtld)rrrr�<lambda>D�r$cCs.tD]$}d|kr|S|dkr|SqdS)z;Return the file extension for an abi3-compliant Extension()z.abi3z.pydNr)�suffixrrr�get_abi3_suffixGs
r'c@sveZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zddd�ZdS)rcCs.|jd}|_t�|�||_|r*|��dS)z;Build extensions in build directory, then copy if --inplacerN)Zinplace�
_build_ext�run�copy_extensions_to_source)�selfZold_inplacerrrr)Qs

z
build_ext.runc
Cs�|�d�}|jD]�}|�|j�}|�|�}|�d�}d�|dd��}|�|�}tj	�|tj	�
|��}tj	�|j|�}	t|	||j
|jd�|jr|�|p�tj|d�qdS)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/r0�_needs_stub�
write_stub�curdir)
r+r,�ext�fullname�filename�modpath�packageZpackage_dirZ
dest_filenameZsrc_filenamerrrr*Ys&





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

��


zbuild_ext.get_ext_filenamecCs t�|�d|_g|_i|_dS�N)r(�initialize_optionsrI�shlibsrD�r+rrrrQ�s
zbuild_ext.initialize_optionscCs,t�|�|jpg|_|�|j�dd�|jD�|_|jrB|��|jD]}|�|j�|_qH|jD]�}|j}||j	|<||j	|�
d�d<|jr�|�|�p�d}|o�to�t
|t�}||_||_|�|�}|_tj�tj�|j|��}|�r||jk�r|j�|�|rbtrbtj|jkrb|j�tj�qbdS)NcSsg|]}t|t�r|�qSr)rGr	�r
r?rrrr�s
�z.build_ext.finalize_options.<locals>.<listcomp>r-r.F)r(�finalize_optionsr2Zcheck_extensions_listrR�setup_shlib_compilerr3r4�
_full_namerDr6�links_to_dynamicrLrGr	rMr<r5�
_file_namer8r9�dirnamer7r;�library_dirs�appendr>�runtime_library_dirs)r+r?r@Zltd�nsrAZlibdirrrrrU�s,



zbuild_ext.finalize_optionscCs�t|j|j|jd�}|_t|�|jdk	r8|�|j�|jdk	r^|jD]\}}|�	||�qH|j
dk	r~|j
D]}|�|�qn|jdk	r�|�
|j�|jdk	r�|�|j�|jdk	r�|�|j�|jdk	r�|�|j�t�|�|_dS)N)rr0�force)rrr0r_rIrZinclude_dirsZset_include_dirsZdefineZdefine_macroZundefZundefine_macro�	librariesZ
set_librariesr[Zset_library_dirsZrpathZset_runtime_library_dirsZlink_objectsZset_link_objects�link_shared_object�__get__)r+rr4�valueZmacrorrrrV�s.�







zbuild_ext.setup_shlib_compilercCst|t�r|jSt�||�SrP)rGr	�export_symbolsr(�get_export_symbols�r+r?rrrre�s
zbuild_ext.get_export_symbolscCs\|��|j}z@t|t�r"|j|_t�||�|jrL|�d�j	}|�
||�W5||_XdS)Nr,)Z_convert_pyx_sources_to_langrrGr	rIr(�build_extensionr<r1r;r=)r+r?Z	_compiler�cmdrrrrg�s
zbuild_ext.build_extensioncsPt�dd�|jD���d�|j�d�dd�dg��t��fdd�|jD��S)	z?Return true if 'ext' links to a dynamic lib in the same packagecSsg|]
}|j�qSr)rW)r
�librrrr�sz.build_ext.links_to_dynamic.<locals>.<listcomp>r-Nr.r"c3s|]}�|�kVqdSrPr)r
Zlibname�ZlibnamesZpkgrr�	<genexpr>�sz-build_ext.links_to_dynamic.<locals>.<genexpr>)�dict�fromkeysrRr7rWr6�anyr`rfrrjrrX�s zbuild_ext.links_to_dynamiccCst�|�|��SrP)r(�get_outputs�_build_ext__get_stubs_outputsrSrrrro�szbuild_ext.get_outputscs6�fdd��jD�}t�|����}tdd�|D��S)Nc3s0|](}|jrtjj�jf|j�d���VqdS)r-N)r<r8r9r7r;rWr6rTrSrrrk�s�z0build_ext.__get_stubs_outputs.<locals>.<genexpr>css|]\}}||VqdSrPr)r
�baseZfnextrrrrk�s)r2�	itertools�product�!_build_ext__get_output_extensions�list)r+Zns_ext_basesZpairsrrSrZ__get_stubs_outputs�s

�zbuild_ext.__get_stubs_outputsccs"dVdV|�d�jrdVdS)N�.pyz.pycr,z.pyo)r1�optimizerSrrrZ__get_output_extensions�sz!build_ext.__get_output_extensionsFcCs,t�d|j|�tjj|f|j�d���d}|rJtj�|�rJt|d��|j	s�t
|d�}|�d�ddd	td
�dtj�
|j�dd
dtd�dddtd�ddtd�dddg��|��|�r(ddlm}||gdd|j	d�|�d�j}|dk�r||g|d|j	d�tj�|��r(|j	�s(t�|�dS)Nz writing stub loader for %s to %sr-rvz 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__()r"r)�byte_compileT)rwr_r0Zinstall_lib)r�inforWr8r9r7r6�existsrr0�open�write�if_dlr:rY�closeZdistutils.utilrzr1rw�unlink)r+�
output_dirr?�compileZ	stub_file�frzrwrrrr=�sb
��

����
�zbuild_ext.write_stubN)F)�__name__�
__module__�__qualname__r)r*r5rQrUrVrergrXrorprtr=rrrrrPs
	rc

Cs(|�|j|||||||||	|
||�
dSrP)�linkZSHARED_LIBRARY)
r+�objects�output_libnamer�r`r[r]rd�debug�
extra_preargs�extra_postargs�
build_temp�target_langrrrra#s�raZstaticc
Cs^|dkst�tj�|�\}}
tj�|
�\}}|�d��d�rH|dd�}|�|||||�dS)N�xri�)�AssertionErrorr8r9r6rHrJ�
startswithZcreate_static_lib)r+r�r�r�r`r[r]rdr�r�r�r�r�rAr:r?rrrra2s�)
NNNNNrNNNN)
NNNNNrNNNN)+r8rrrZdistutils.command.build_extrZ
_du_build_extZdistutils.file_utilrZdistutils.ccompilerrZdistutils.sysconfigrrZdistutils.errorsrZ	distutilsrZsetuptools.extensionr	Zsetuptools.externr
ZPY2rZget_suffixesrZimportlib.machineryZCython.Distutils.build_extr(�
__import__�ImportErrorrrrr#rLrKrr4Zdl�hasattrrr'rarrrr�<module>sz
	Q�
�

?>