Your IP : 18.119.166.141


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

3

9��f	G�@sxdZddlmZddlmZmZddlmZddlm	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlmZddlmZmZmZdd	lmZdd
lmZddlmZyddlmZmZd
d�ZWn,ek
r�ddlm Z mZdd�ZYnXdd�Z!dd�Z"dd�Z#Gdd�de�Z$e%j&dj'��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)N�purelib)r�rr�/usr/lib/python3.6/bdist_egg.py�_get_purelibsr)�get_python_librcCstd�S)NF)rrrrrrscCs2d|krtjj|�d}|jd�r.|dd�}|S)N�.r�module�i����)�os�path�splitext�endswith)�filenamerrr�strip_module#s

rccs:x4tj|�D]&\}}}|j�|j�|||fVqWdS)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
Cs6tjd�j�}t|d��}|j||�WdQRXdS)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)Zresource�pyfileZ_stub_template�frrr�
write_stub5s
r-c@s�eZdZdZd*ddde�fd+d-d.d/gZdddgZdd�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zd d!�Z
d"d#�Zd$d%�Zd&d'�Zd(d)�Zd	S)0�	bdist_eggzcreate an "egg" distribution�
bdist-dir=�b�1temporary directory for creating the distributionz
plat-name=�pz;platform name to embed in generated filenames (default: %s)�exclude-source-filesN�+remove all .py files from the generated egg�	keep-temp�kz/keep the pseudo-installation tree around after z!creating the distribution archive�	dist-dir=�d�-directory to put final built distributions in�
skip-build�2skip rebuilding everything (for testing/debugging)cCs.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�|jd�}|_|j|_|jdkr>|jd�j}tjj|d�|_|jdkrPt	�|_|j
dd�|jdkr�tdd|j
|jt�|jj�o�|j�j
�}tjj|j|d�|_dS)N�egg_infoZbdistZeggr?z.egg)r?r?)�get_finalized_command�ei_cmdrEr<�
bdist_baserr�joinr=rZset_undefined_optionsrAr	Zegg_nameZegg_versionr�distribution�has_ext_modulesr?)rCrGrH�basenamerrr�finalize_optionscs


zbdist_egg.finalize_optionscCs�|j|jd�_tjjtjjt���}|jj	g}|j_	x�|D]�}t
|t�r�t|�dkr�tjj
|d�r�tjj|d�}tjj|�}||ks�|j|tj�r�|t|�dd�|df}|jj	j|�q<Wz"tjd|j�|jdddd�Wd||j_	XdS)N�install�r�zinstalling package data to %s�install_data)�force�root)r<rF�install_librr�normcase�realpathrrJ�
data_files�
isinstance�tuple�len�isabs�
startswith�sep�appendr�info�call_command)rCZ
site_packages�old�itemrVZ
normalizedrrr�do_install_data{s 
zbdist_egg.do_install_datacCs|jgS)N)rA)rCrrr�get_outputs�szbdist_egg.get_outputscKsTxtD]}|j||j�qW|jd|j�|jd|j�|j|f|�}|j|�|S)z8Invoke reinitialized command `cmdname` with keyword argsr@�dry_run)�INSTALL_DIRECTORY_ATTRS�
setdefaultr<r@reZreinitialize_command�run_command)rCZcmdname�kw�dirname�cmdrrrr`�s

zbdist_egg.call_commandcCs�|jd�tjd|j�|jd�}|j}d|_|jj�rJ|jrJ|jd�|j	ddd�}||_|j
�\}}g|_g}x�t|�D]|\}}t
jj|�\}	}
t
jj|jt|	�d�}|jj|�tjd	|�|js�tt
jj|�|�|j|�|jt
jd
�||<q~W|�r|j|�|jj�r |j�|j}t
jj|d�}
|j|
�|jj�rrt
jj|
d�}tjd
|�|j	d|dd�|j|
�t
jj|
d�}|�r�tjd|�|j�st|�t|d�}|j dj|��|j d�|j!�n,t
jj"|��rtjd|�|j�st
j#|�t$t
jj|d�|j%��t
jj&t
jj|j'd���rBtj(d�|j)�rR|j*�t+|j,||j-|j|j.�d�|j/�s�t0|j|jd�t1|jdg�jdt2�|j,f�dS)NrEzinstalling library code to %srNZ
build_clibrTr)Zwarn_dirz.pyzcreating stub loader for %s�/zEGG-INFO�scriptszinstalling scripts to %sZinstall_scriptsrP)�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.)�verbosere�mode)reZ
dist_filesr.)3rhrr_r<rFrSrJZhas_c_librariesr@r`�get_ext_outputs�stubs�	enumeraterrrrIrr^rer-rL�replacer]Zbyte_compilerWrcrrm�copy_metadata_tor
r)r*�close�isfile�unlink�write_safety_flag�zip_safe�existsrE�warnrB�zap_pyfiles�make_zipfilerArq�
gen_headerr>r�getattrr)rCZinstcmdZold_rootrk�all_outputs�ext_outputsZ
to_compiler2Zext_namer�extr+Zarchive_rootrEZ
script_dirZnative_libsZ	libs_filerrr�run�sz












z
bdist_egg.runc

Cs�tjd�x�t|j�D]�\}}}x�|D]�}tjj||�}|jd�rXtjd|�tj	|�|jd�r&|}d}t
j||�}tjj|tj|j
d�d�}	tjd||	f�ytj|	�Wntk
r�YnXtj||	�q&WqWdS)	Nz+Removing .py files from temporary directoryz.pyzDeleting %s�__pycache__z#(?P<name>.+)\.(?P<magic>[^.]+)\.pyc�namez.pyczRenaming file from [%s] to [%s])rr_�walk_eggr<rrrIr�debugrz�re�match�pardir�group�remove�OSError�rename)
rCr!r"r#r�rZpath_old�pattern�mZpath_newrrrr�s*




zbdist_egg.zap_pyfilescCs2t|jdd�}|dk	r|Stjd�t|j|j�S)Nr|z4zip_safe flag not set; analyzing archive contents...)r�rJrr~�analyze_eggr<rt)rC�saferrrr|s

zbdist_egg.zip_safec
Cs�tj|jjpd�}|jdi�jd�}|dkr0dS|js>|jrLtd|f��tj	dd�}|j
}dj|j�}|jd}tj
j|j�}d	t�}|js�ttj
j|j�|jd
�t|jd�}	|	j|�|	j�dS)N�zsetuptools.installationZeggsecutabler%zGeggsecutable entry point (%r) cannot have 'extras' or refer to a module�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
)re�a)rZ	parse_maprJZentry_points�getZattrsZextrasr�sys�versionZmodule_namerIrrrLrA�localsrerrjr)r*rx)
rCZepmZepZpyver�pkgZfullr!rL�headerr,rrrr�s*


zbdist_egg.gen_headercCsltjj|j�}tjj|d�}xJ|jjjD]<}|j|�r(tjj||t	|�d��}t
|�|j||�q(WdS)z*Copy metadata (egg info) to the target_dirr�N)rr�normpathrErIrGZfilelistr#r\rZr
Z	copy_file)rCZ
target_dirZ
norm_egg_info�prefixr�targetrrrrw:s
zbdist_egg.copy_metadata_tocCsg}g}|jdi}x|t|j�D]n\}}}x6|D].}tjj|�dj�tkr.|j|||�q.Wx*|D]"}|||d|tjj||�<qfWqW|j	j
��r|jd�}xd|jD]Z}	t
|	t�r�q�|j|	j�}
|j|
�}tjj|�jd�s�tjjtjj|j|��r�|j|�q�W||fS)zAGet a list of relative paths to C extensions in the output distror�rPrlZ	build_extzdl-)r<r$rrr�lower�NATIVE_EXTENSIONSr^rIrJrKrF�
extensionsrXrZget_ext_fullnamer�Zget_ext_filenamerLr\r})rCr�r��pathsr!r"r#rZ	build_cmdr��fullnamerrrrsFs(


&


zbdist_egg.get_ext_outputs)r/r0r1)r3Nr4�Pkeep the pseudo-installation tree around after creating the distribution archive)r5r6r�)r7r8r9)r:Nr;)�__name__�
__module__�__qualname__�descriptionrZuser_optionsZboolean_optionsrDrMrcrdr`r�rr|r�rwrsrrrrr.Cs4
	
Q'r.z.dll .so .dylib .pydccsLt|�}t|�\}}}d|kr(|jd�|||fVx|D]
}|Vq:WdS)z@Walk an unpacked egg's contents, skipping the metadata directoryzEGG-INFON)r$�nextr�)�egg_dirZwalkerr!r"r#Zbdfrrrr�fs

r�c	Cs�x0tj�D]$\}}tjjtjj|d|��r
|Sq
Wt�s<dSd}xbt|�D]V\}}}xJ|D]B}|jd�sZ|jd�rvqZqZ|jd�s�|jd�rZt	||||�o�|}qZWqJW|S)NzEGG-INFOFTz.pyz.pywz.pycz.pyo)
�safety_flags�itemsrrr}rI�can_scanr�r�scan_module)	r�rt�flag�fnr�r!r"r#r�rrrr�qs
r�cCs�x~tj�D]r\}}tjj||�}tjj|�rL|dks@t|�|kr|tj|�q
|dk	r
t|�|kr
t|d�}|j	d�|j
�q
WdS)Nrorp)r�r�rrrIr}�boolrzr)r*rx)r�r�r�r�r,rrrr{�s

r{zzip-safeznot-zip-safe)TFc
Cstjj||�}|dd�|kr"dS|t|�dd�jtjd�}||rJdpLdtjj|�d}tjdkrpd}ntjd kr�d
}nd}t	|d�}|j
|�tj|�}	|j
�d}
tjt|	��}x&d!D]}||kr�tjd||�d}
q�Wd|k�rx*d"D]"}||k�r�tjd||�d}
�q�W|
S)#z;Check whether module possibly uses unsafe-for-zipfile stuffNrPTrr�rr������rb�__file__�__path__z%s: module references %sF�inspect�	getsource�
getabsfile�
getsourcefile�getfilegetsourcelines�
findsource�getcomments�getframeinfo�getinnerframes�getouterframes�stack�tracez"%s: module MAY be using inspect.%s���)r�r�)r�r�)r�r�)r�r�r�r�r�r�r�r�r�r�r�)rrrIrZrvr]rr��version_infor)�read�marshal�loadrx�dict�fromkeys�iter_symbolsrr~)
r�r!r�rtrr�r�skipr,�coder�ZsymbolsZbadrrrr��s: 








r�ccs`x|jD]
}|VqWxD|jD]:}t|tj�r6|Vqt|t�rxt|�D]
}|VqJWqWdS)zBYield names and strings used by `code` and its nested code objectsN)�co_names�	co_constsrXrZstring_typesrr�)r�r��constrrrr��s

r�cCs4tjjd�rtjdkrdStjd�tjd�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��platformr\rr~rrrrr��s
r�rTrnrQZinstall_baseTr%c
s�ddl}ttjj|��d�tjd|����fdd�}|rB|jn|j}�s�|j	|||d�}	x"t
��D]\}
}}||	|
|�qfW|	j�n$x"t
��D]\}
}}|d|
|�q�W|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.
    rN)rez#creating '%s' and adding '%s' to itcsdx^|D]V}tjjtjj||��}tjj|�r|t��dd�}�sP|j||�tjd|�qWdS)NrPzadding '%s')	rrr�rIryrZr*rr�)�zrj�namesr�rr2)�base_dirrerr�visit�s
zmake_zipfile.<locals>.visit)�compression)�zipfilerrrrjrr_ZZIP_DEFLATEDZ
ZIP_STOREDZZipFiler$rx)
Zzip_filenamer�rqre�compressrrr�r�r�r�rjr"r#r)r�rerr��s	
r�)rrTr%)2�__doc__Zdistutils.errorsrZdistutils.dir_utilrrZ	distutilsr�typesrr�rr�r&r�Zsetuptools.externrZ
pkg_resourcesrr	r
rZsetuptools.extensionrZ
setuptoolsr
�	sysconfigrrr�ImportErrorZdistutils.sysconfigrrr$r-r.r�r��splitr�r�r�r{r�r�r�r�rfr�rrrr�<module>sL
"$


?>