Your IP : 3.144.98.61


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

U

�Qab	G�@sxdZddlmZddlmZmZddlmZddlm	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlmZddlmZmZmZdd	lmZdd
lmZddlmZzddlmZmZd
d�ZWn,ek
r�ddlm Z mZdd�ZYnXdd�Z!dd�Z"dd�Z#Gdd�de�Z$e%�&d�'��Z(dd�Z)dd�Z*dd�Z+d d!d"�Z,d#d$�Z-d%d&�Z.d'd(�Z/d)d*d+d,gZ0d1d/d0�Z1dS)2z6setuptools.command.bdist_egg

Build .egg distributions�)�DistutilsSetupError)�remove_tree�mkpath)�log)�CodeTypeN)�six)�get_build_platform�Distribution�ensure_directory)�
EntryPoint)�Library)�Command)�get_path�get_python_versioncCstd�S)NZpurelib)r�rr�@/usr/lib/python3.8/site-packages/setuptools/command/bdist_egg.py�_get_purelibsr)�get_python_librcCstd�S)NF)rrrrrrscCs2d|krtj�|�d}|�d�r.|dd�}|S)N�.r�modulei����)�os�path�splitext�endswith)�filenamerrr�strip_module#s

rccs6t�|�D]&\}}}|��|��|||fVq
dS)zbDo os.walk in a reproducible way,
    independent of indeterministic filesystem readdir order
    N)r�walk�sort)�dir�base�dirs�filesrrr�sorted_walk+sr"c	Cs6t�d���}t|d��}|�||�W5QRXdS)NaR
        def __bootstrap__():
            global __bootstrap__, __loader__, __file__
            import sys, pkg_resources, imp
            __file__ = pkg_resources.resource_filename(__name__, %r)
            __loader__ = None; del __bootstrap__, __loader__
            imp.load_dynamic(__name__,__file__)
        __bootstrap__()
        �w)�textwrap�dedent�lstrip�open�write)�resource�pyfileZ_stub_template�frrr�
write_stub5s	r,c@s�eZdZdZdddde�fdddd	gZd
ddgZd
d�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd �Zd!d"�Zd#S)$�	bdist_eggzcreate an "egg" distribution)z
bdist-dir=�bz1temporary directory for creating the distributionz
plat-name=�pz;platform name to embed in generated filenames (default: %s))�exclude-source-filesNz+remove all .py files from the generated egg)�	keep-temp�kzPkeep the pseudo-installation tree around after creating the distribution archive)z	dist-dir=�dz-directory to put final built distributions in)�
skip-buildNz2skip rebuilding everything (for testing/debugging)r1r4r0cCs.d|_d|_d|_d|_d|_d|_d|_dS)Nr)�	bdist_dir�	plat_name�	keep_temp�dist_dir�
skip_build�
egg_output�exclude_source_files��selfrrr�initialize_optionsZszbdist_egg.initialize_optionscCs�|�d�}|_|j|_|jdkr>|�d�j}tj�|d�|_|jdkrPt	�|_|�
dd�|jdkr�tdd|j
|jt�|j��o�|j��
�}tj�|j|d�|_dS)N�egg_infoZbdistZegg)r8r8z.egg)�get_finalized_command�ei_cmdr?r5�
bdist_baserr�joinr6rZset_undefined_optionsr:r	Zegg_nameZegg_versionr�distribution�has_ext_modulesr8)r=rArB�basenamerrr�finalize_optionscs$


�zbdist_egg.finalize_optionscCs�|j|�d�_tj�tj�t���}|jj	g}|j_	|D]�}t
|t�r�t|�dkr�tj�
|d�r�tj�|d�}tj�|�}||ks�|�|tj�r�|t|�dd�|df}|jj	�|�q:z"t�d|j�|jdddd�W5||j_	XdS)N�install�r�zinstalling package data to %s�install_data)�force�root)r5r@�install_librr�normcase�realpathrrD�
data_files�
isinstance�tuple�len�isabs�
startswith�sep�appendr�info�call_command)r=Z
site_packages�old�itemrPZ
normalizedrrr�do_install_data{s"�zbdist_egg.do_install_datacCs|jgS)N)r:r<rrr�get_outputs�szbdist_egg.get_outputscKsPtD]}|�||j�q|�d|j�|�d|j�|j|f|�}|�|�|S)z8Invoke reinitialized command `cmdname` with keyword argsr9�dry_run)�INSTALL_DIRECTORY_ATTRS�
setdefaultr5r9r_Zreinitialize_command�run_command)r=Zcmdname�kw�dirname�cmdrrrrZ�s
zbdist_egg.call_commandcCs�|�d�t�d|j�|�d�}|j}d|_|j��rH|jsH|�d�|j	ddd�}||_|�
�\}}g|_g}t|�D]|\}}t
j�|�\}	}
t
j�|jt|	�d�}|j�|�t�d	|�|js�tt
j�|�|�|�|�|�t
jd
�||<qz|�r|�|�|jj�r|��|j}t
j�|d�}
|�|
�|jj�rlt
j�|
d�}t�d
|�|j	d|dd�|�|
�t
j�|
d�}|�r�t�d|�|j�st|�t|d�}|� d�|��|� d�|�!�n,t
j�"|��rt�d|�|j�st
�#|�t$t
j�|d�|�%��t
j�&t
j�|j'd���r<t�(d�|j)�rL|�*�t+|j,||j-|j|�.�d�|j/�s�t0|j|jd�t1|jdg��dt2�|j,f�dS)Nr?zinstalling library code to %srHZ
build_clibrNr)Zwarn_dir�.pyzcreating stub loader for %s�/�EGG-INFO�scriptszinstalling scripts to %sZinstall_scriptsrJ)�install_dirZno_epznative_libs.txtz
writing %s�wt�
zremoving %szdepends.txtzxWARNING: 'depends.txt' will not be used by setuptools 0.6!
Use the install_requires/extras_require setup() args instead.)�verboser_�mode�r_Z
dist_filesr-)3rbrrYr5r@rMrDZhas_c_librariesr9rZ�get_ext_outputs�stubs�	enumeraterrrrCrrXr_r,rF�replacerWZbyte_compilerQr]rri�copy_metadata_tor
r'r(�close�isfile�unlink�write_safety_flag�zip_safe�existsr?�warnr;�zap_pyfiles�make_zipfiler:rm�
gen_headerr7r�getattrr)r=ZinstcmdZold_rootre�all_outputs�ext_outputsZ
to_compiler/Zext_namer�extr*Zarchive_rootr?Z
script_dirZnative_libsZ	libs_filerrr�run�s�


�




�




����z
bdist_egg.runc

Cs�t�d�t|j�D]�\}}}|D]�}tj�||�}|�d�rTt�d|�t�	|�|�d�r"|}d}t
�||�}tj�|tj|�
d�d�}	t�d||	f�zt�|	�Wntk
r�YnXt�||	�q"qdS)	Nz+Removing .py files from temporary directoryrfzDeleting %s�__pycache__z#(?P<name>.+)\.(?P<magic>[^.]+)\.pyc�name�.pyczRenaming file from [%s] to [%s])rrY�walk_eggr5rrrCr�debugrw�re�match�pardir�group�remove�OSError�rename)
r=rr r!r�rZpath_old�pattern�mZpath_newrrrr|�s4



���zbdist_egg.zap_pyfilescCs2t|jdd�}|dk	r|St�d�t|j|j�S)Nryz4zip_safe flag not set; analyzing archive contents...)rrDrr{�analyze_eggr5rq)r=�saferrrrys

zbdist_egg.zip_safec
Cs�t�|jjpd�}|�di��d�}|dkr0dS|jr<|jrJtd|f��djt	j
�}|j}d�|j�}|jd}t
j�|j�}d	t�}|js�tt
j�|j�|jd
�t|jd�}	|	�|�|	��dS)N�zsetuptools.installationZeggsecutabler#zGeggsecutable entry point (%r) cannot have 'extras' or refer to a modulez{}.{}rraH#!/bin/sh
if [ `basename $0` = "%(basename)s" ]
then exec python%(pyver)s -c "import sys, os; sys.path.insert(0, os.path.abspath('$0')); from %(pkg)s import %(base)s; sys.exit(%(full)s())" "$@"
else
  echo $0 is not the correct name for this egg file.
  echo Please rename it back to %(basename)s and try again.
  exec false
fi
ro�a)rZ	parse_maprDZentry_points�getZattrsZextrasr�format�sys�version_infoZmodule_namerCrrrFr:�localsr_rrdr'r(ru)
r=ZepmZepZpyver�pkgZfullrrF�headerr+rrrr~s0��
�
zbdist_egg.gen_headercCshtj�|j�}tj�|d�}|jjjD]<}|�|�r&tj�||t	|�d��}t
|�|�||�q&dS)z*Copy metadata (egg info) to the target_dirr�N)rr�normpathr?rCrAZfilelistr!rVrTr
Z	copy_file)r=Z
target_dirZ
norm_egg_info�prefixr�targetrrrrt:s
zbdist_egg.copy_metadata_tocCsg}g}|jdi}t|j�D]f\}}}|D].}tj�|�d��tkr*|�|||�q*|D]"}|||d|tj�||�<q^q|j	�
�r�|�d�}|jD]Z}	t
|	t�r�q�|�|	j�}
|�|
�}tj�|��d�s�tj�tj�|j|��r�|�|�q�||fS)zAGet a list of relative paths to C extensions in the output distror�rJrgZ	build_extzdl-)r5r"rrr�lower�NATIVE_EXTENSIONSrXrCrDrEr@�
extensionsrRrZget_ext_fullnamer�Zget_ext_filenamerFrVrz)r=r�r��pathsrr r!rZ	build_cmdr��fullnamerrrrpFs0
��




zbdist_egg.get_ext_outputsN)�__name__�
__module__�__qualname__�descriptionrZuser_optionsZboolean_optionsr>rGr]r^rZr�r|ryr~rtrprrrrr-Cs2���	
Q'r-z.dll .so .dylib .pydccsHt|�}t|�\}}}d|kr(|�d�|||fV|D]
}|Vq8dS)z@Walk an unpacked egg's contents, skipping the metadata directoryrhN)r"�nextr�)�egg_dirZwalkerrr r!Zbdfrrrr�fs
r�c	Cs�t��D](\}}tj�tj�|d|��r|Sqt�s<dSd}t|�D]R\}}}|D]B}|�d�sV|�d�rrqVqV|�d�s�|�d�rVt	||||�o�|}qVqH|S)NrhFTrfz.pywr�z.pyo)
�safety_flags�itemsrrrzrC�can_scanr�r�scan_module)	r�rq�flag�fnr�rr r!r�rrrr�qs
r�cCs�t��D]r\}}tj�||�}tj�|�rJ|dks>t|�|krzt�|�q|dk	rt|�|krt|d�}|�	d�|�
�qdS)Nrkrl)r�r�rrrCrz�boolrwr'r(ru)r�r�r�r�r+rrrrx�s

rxzzip-safeznot-zip-safe)TFc
Cstj�||�}|dd�|kr"dS|t|�dd��tjd�}||rJdpLdtj�|�d}tjrld}nt	j
d	kr|d
}nd}t|d�}|�|�t
�|�}	|��d}
t�t|	��}d
D]}||kr�t�d||�d}
q�d|k�r
dD]}||kr�t�d||�d}
q�|
S)z;Check whether module possibly uses unsafe-for-zipfile stuffN���TrJrr�r�)�����rb)�__file__�__path__z%s: module references %sF�inspect)Z	getsourceZ
getabsfileZ
getsourcefileZgetfilegetsourcelinesZ
findsourceZgetcommentsZgetframeinfoZgetinnerframesZgetouterframes�stackZtracez"%s: module MAY be using inspect.%s)rrrCrTrsrWrrZPY2r�r�r'�read�marshal�loadru�dict�fromkeys�iter_symbolsrr{)
r�rr�rqrr�r�skipr+�coder�ZsymbolsZbadrrrr��s4 




r�ccsT|jD]
}|Vq|jD]6}t|tj�r0|Vqt|t�rt|�D]
}|VqBqdS)zBYield names and strings used by `code` and its nested code objectsN)�co_names�	co_constsrRrZstring_typesrr�)r�r��constrrrr��s


r�cCs2tj�d�stjdkrdSt�d�t�d�dS)N�javaZcliTz1Unable to analyze compiled code on this platform.zfPlease ask the author to include a 'zip_safe' setting (either True or False) in the package's setup.py)r��platformrVrr{rrrrr��s
r�rNrjrKZinstall_baseTr#c
s�ddl}ttj�|��d�t�d|����fdd�}|rB|jn|j}�s�|j	|||d�}	t
��D]\}
}}||	|
|�qd|	��n t
��D]\}
}}|d|
|�q�|S)aqCreate a zip file from all the files under 'base_dir'.  The output
    zip file will be named 'base_dir' + ".zip".  Uses either the "zipfile"
    Python module (if available) or the InfoZIP "zip" utility (if installed
    and found on the default search path).  If neither tool is available,
    raises DistutilsExecError.  Returns the name of the output zip file.
    rNroz#creating '%s' and adding '%s' to itcs`|D]V}tj�tj�||��}tj�|�r|t��dd�}�sN|�||�t�d|�qdS)NrJzadding '%s')	rrr�rCrvrTr(rr�)�zrd�namesr�rr/��base_dirr_rr�visit�szmake_zipfile.<locals>.visit)�compression)�zipfilerrrrdrrYZZIP_DEFLATEDZ
ZIP_STOREDZZipFiler"ru)
Zzip_filenamer�rmr_�compressrnr�r�r�r�rdr r!rr�rr}�s	
r})rrTr#)2�__doc__Zdistutils.errorsrZdistutils.dir_utilrrZ	distutilsr�typesrr�rr�r$r�Zsetuptools.externrZ
pkg_resourcesrr	r
rZsetuptools.extensionrZ
setuptoolsr
Z	sysconfigrrr�ImportErrorZdistutils.sysconfigrrr"r,r-r�r��splitr�r�r�rxr�r�r�r�r`r}rrrr�<module>sX
"�$
��

?>