Your IP : 18.226.88.18


Current Path : /usr/lib/python2.7/site-packages/setuptools/command/
Upload File :
Current File : //usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyo

�
�fc@sedZddlmZddlmZddlmZmZddlmZmZm	Z	m
Z
ddlmZm
Z
ddlmZmZddlmZdd	lmZdd
lZdd
lZdd
lZdd
lZdd
lZdd
lZdd
lZdd
lZdd
lZdd
lZdd
lZdd
l Z dd
l!Z!dd
l"Z"dd
l#Z#dd
l$Z$dd
l%Z%ddl&m'Z'ddl(m)Z)m*Z*dd
l+m,Z,ddl-m.Z.ddl/m0Z0m1Z1ddl2m3Z3ddl4m5Z5ddl6m7Z7ddl8m9Z9m:Z:m;Z;ddl4m<Z<m=Z=ddl>m?Z?ddl@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJmKZKmLZLmMZMmNZNmOZOdd
lPZ@ejQdde@jR�ddddddgZSd�ZTd �ZUe'jVrd!�ZWd"�ZXnd#�ZWd$�ZXd%�ZYde,fd&��YZZd'�Z[d(�Z\d)�Z]d*�Z^d+�Z_deGfd,��YZ`d-e`fd.��YZaejbjcd/d0�d1kr�eaZ`nd2�Zdd3�Zed4�Zfd5�Zgehd6�Zid7�Zjd8�Zkd9ejlkrekZmn	d:�Zmd;d<�Znd=�Zod>�Zpd?�Zqydd@lmrZsWnetk
rzdA�ZsnXdB�ZrdCeufdD��YZvevjw�ZxdEevfdF��YZydGezfdH��YZ{dIe{fdJ��YZ|dKe|fdL��YZ}e{j~Z~e{jZdM�Z�dN�Z�e�eedO�Z�dP�Z�dQ�Z�ehdR�Z�e"j�dS��Z�d
S(Ts%
Easy Install
------------

A tool for doing automatic download/extract/build of distutils-based Python
packages.  For detailed documentation, see the accompanying EasyInstall.txt
file, or visit the `EasyInstall home page`__.

__ https://setuptools.readthedocs.io/en/latest/easy_install.html

i����(tglob(tget_platform(tconvert_patht
subst_vars(tDistutilsArgErrortDistutilsOptionErrortDistutilsErrortDistutilsPlatformError(tINSTALL_SCHEMEStSCHEME_KEYS(tlogtdir_util(t
first_line_re(tfind_executableN(tsix(tconfigparsertmap(tCommand(t	run_setup(tget_pathtget_config_vars(trmtree_safe(tsetopt(tunpack_archive(tPackageIndextparse_requirement_argt
URL_SCHEME(t	bdist_eggtegg_info(tWheel(tyield_linestnormalize_pathtresource_stringtensure_directorytget_distributiontfind_distributionstEnvironmenttRequirementtDistributiontPathMetadatatEggMetadatat
WorkingSettDistributionNotFoundtVersionConflicttDEVELOP_DISTtdefaulttcategorytsamefileteasy_installtPthDistributionstextract_wininst_cfgtmaintget_exe_prefixescCstjd�dkS(NtPi(tstructtcalcsize(((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pytis_64bitIscCs�tjj|�o!tjj|�}ttjd�o9|}|rUtjj||�Stjjtjj|��}tjjtjj|��}||kS(s�
    Determine if two paths reference the same file.

    Augments os.path.samefile to work on Windows and
    suppresses errors if the path doesn't exist.
    R/(tostpathtexiststhasattrR/tnormpathtnormcase(tp1tp2t
both_existtuse_samefiletnorm_p1tnorm_p2((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR/Ms$cCs|S(N((ts((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt	_to_ascii_scCs1ytj|d�tSWntk
r,tSXdS(Ntascii(Rt	text_typetTruetUnicodeErrortFalse(RE((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pytisasciibs

cCs
|jd�S(NRG(tencode(RE((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRFjscCs.y|jd�tSWntk
r)tSXdS(NRG(RMRIRJRK(RE((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRLms


cCstj|�j�jdd�S(Ns
s; (ttextwraptdedenttstriptreplace(ttext((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt<lambda>utcBsreZdZdZeZd�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�gZdddd
dd-d0d6d9g	Ze	j
r�d=e	jZej
d>d�ef�ej
d>�nidd'6ZeZd?�Zd@�ZdA�ZedB��ZdC�ZdD�ZdE�ZdF�ZdG�ZdH�ZdI�ZdJ�ZdK�Zej dL�j!�Z"ej dM�j!�Z#ej dN�j!�Z$dO�Z%dP�Z&dQ�Z'dR�Z(dS�Z)dT�Z*e+j,dU��Z-e.dV�Z/e.dW�Z0dX�Z1edY�Z2dZ�Z3d[�Z4d\�Z5d�d]�Z6ed^��Z7d_d�d`�Z8da�Z9db�Z:dc�Z;dd�Z<de�Z=df�Z>ej dg�j!�Z?ej dh�Z@didj�ZAej dk�j!�ZBdl�ZCdm�ZDdn�ZEdo�ZFdp�ZGdq�ZHdr�ZIds�ZJej dt�j!�ZKdu�ZLdv�ZMdw�ZNeOdxeOdydzd{d|��ZPeOdyd}d{d~�ZQd�ZRRS(�s'Manage a download/build/install processs Find/get/install Python packagessprefix=sinstallation prefixszip-oktzsinstall package as a zipfiles
multi-versiontms%make apps have to require() a versiontupgradetUs1force upgrade (searches PyPI for latest versions)sinstall-dir=tdsinstall package to DIRsscript-dir=REsinstall scripts to DIRsexclude-scriptstxsDon't install scriptssalways-copytas'Copy all needed packages to install dirs
index-url=tis base URL of Python Package Indexsfind-links=tfs(additional URL(s) to search for packagessbuild-directory=tbs/download/extract/build in DIR; keep the resultss	optimize=tOslalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0]srecord=s3filename in which to record list of installed filessalways-unziptZs*don't install as a zipfile, no matter whats
site-dirs=tSs)list of directories where .pth files workteditabletes+Install specified packages in editable formsno-depstNsdon't install dependenciessallow-hosts=tHs$pattern(s) that hostnames must matchslocal-snapshots-oktls(allow building eggs from local checkoutstversions"print version information and exits
no-find-linkss9Don't load find-links defined in packages being installeds!install in user site-package '%s'tusercCs�d|_d|_|_d|_|_|_d|_d|_d|_	d|_
d|_|_d|_
|_|_d|_|_|_d|_|_|_d|_d|_d|_d|_d|_d|_d|_d|_d|_tj rtj!|_"tj#|_$nd|_"d|_$d|_%d|_&d|_'|_(d|_)i|_*t+|_,d|_-|j.j/|_/|j.j0||j.j1d��dS(NiR0(2RhtNonetzip_oktlocal_snapshots_oktinstall_dirt
script_dirtexclude_scriptst	index_urlt
find_linkstbuild_directorytargstoptimizetrecordRWtalways_copyt
multi_versionRbtno_depstallow_hoststroottprefixt	no_reportRgtinstall_purelibtinstall_platlibtinstall_headerstinstall_libtinstall_scriptstinstall_datatinstall_basetinstall_platbasetsitetENABLE_USER_SITEt	USER_BASEtinstall_userbaset	USER_SITEtinstall_usersitet
no_find_linkst
package_indextpth_filetalways_copy_fromt	site_dirstinstalled_projectsRKtsitepy_installedt_dry_runtdistributiontverboset_set_command_optionstget_option_dict(tself((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pytinitialize_options�sF																								cCs*d�|D�}tt|j|��dS(Ncss9|]/}tjj|�s-tjj|�r|VqdS(N(R9R:R;tislink(t.0tfilename((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pys	<genexpr>�s(tlistRt_delete_path(R�tblockerstextant_blockers((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pytdelete_blockers�scCsetjd|�|jrdStjj|�o?tjj|�}|rNtntj}||�dS(NsDeleting %s(	R
tinfotdry_runR9R:tisdirR�trmtreetunlink(R�R:tis_treetremover((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR��s	%cCs=tjd }td�}d}|jt��GHt��dS(sT
        Render the Setuptools version and installation details, then exit.
        it
setuptoolss=setuptools {dist.version} from {dist.location} (Python {ver})N(tsysRgR"tformattlocalst
SystemExit(tvertdistttmpl((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt_render_version�s

c
Cs�|jo|j�tjj�d}tdd�\}}i|jj�d6|jj�d6|jj�d6|d6|dd!d	6|d|d
d6|d6|d6|d
6|d6t	tdd�d6|_
tjr�|j
|j
d<|j|j
d<n|j�|j�|j�|jdddd�|jdkrI|j|_n|jdkrdt|_n|jdd%�|jdd&�|jr�|jr�|j|_|j|_n|jdd'�tttj�}t�|_ |j!dk	r�g|j!jd�D]}t"jj#|j$��^q}xq|D]f}t"jj%|�sWt&j'd|�q,t|�|kr|t(|d��q,|j j)t|��q,Wn|j*s�|j+�n|j,p�d|_,|j |_-xE|jt|j�fD]+}||j-kr�|j-j.d|�q�q�W|j/dk	rSg|j/jd�D]}|j$�^q8}	n	dg}	|j0dkr�|j1|j,d|j-d |	�|_0nt2|j-tj�|_3|j4dk	r�t5|j4t6j7�r�|j4j�|_4q�n	g|_4|j8r|j0j9|j-tj�n|js5|j0j:|j4�n|jdd(�t5|j;t<�s�y>t<|j;�|_;d|j;ko�d
kns�t=�nWq�t=k
r�t(d"��q�Xn|j*r�|j>r�t?d#��n|j@s�t?d$��ng|_AdS()NiRztexec_prefixt	dist_nametdist_versiont
dist_fullnamet
py_versionitpy_version_shortitpy_version_nodott
sys_prefixtsys_exec_prefixtabiflagsRTtuserbasetusersiteRlRmRqR�RR�tinstallRtt,s"%s (in --site-dirs) does not exists$ (in --site-dirs) is not on sys.pathshttps://pypi.python.org/simplet*tsearch_paththostsRss--optimize must be 0, 1, or 2s9Must specify a build directory (-b) when using --editables:No urls, filenames, or requirements specified (see --help)(RlRl(RlRm(RtRt(RsRs(BRgR�R�tsplitRR�tget_nametget_versiontget_fullnametgetattrtconfig_varsR�R�R�R�t_fix_install_dir_for_user_sitetexpand_basedirstexpand_dirst_expandRmRiRlR�RKtset_undefined_optionsRhR|R�RRR:t
get_site_dirst
all_site_dirsR�R9t
expanduserRPR�R
twarnRtappendRbtcheck_site_dirRotshadow_pathtinsertRxR�tcreate_indexR$tlocal_indexRpt
isinstanceRtstring_typesRktscan_egg_linkstadd_find_linksRstintt
ValueErrorRqRRrtoutputs(
R�R�RzR�R=RER�RYt	path_itemR�((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pytfinalize_options�s�	


	

4
	

.	!			

	cCs�|jstjrdS|j�|jdkrFd}t|��n|j|_|_t	j
jdd�d}|j|�dS(s;
        Fix the install_dir if "--user" was used.
        Ns$User base directory is not specifiedtposixtunixt_user(
RhR�R�tcreate_home_pathR�RiRR�R�R9tnameRQt
select_scheme(R�tmsgtscheme_name((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR�ms
cCs�x�|D]y}t||�}|dk	rtjdksFtjdkr[tjj|�}nt||j�}t|||�qqWdS(NR�tnt(	R�RiR9R�R:R�RR�tsetattr(R�tattrstattrtval((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt
_expand_attrs|s
cCs|jdddg�dS(sNCalls `os.path.expanduser` on install_base, install_platbase and
        root.R�R�RyN(R�(R�((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR��scCs)ddddddg}|j|�dS(s+Calls `os.path.expanduser` on install dirs.R|R}RR~R�R�N(R�(R�tdirs((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR��s	cCs|j|jjkr(tj|j�nz�x%|jD]}|j||j�q5W|jr�|j}|j	r�t
|j	�}x/tt
|��D]}|||||<q�Wnddlm
}|j|j|j|fd|j�n|j�Wdtj|jj�XdS(Ni����(t	file_utils'writing list of installed files to '%s'(R�R�R
t
set_verbosityRrR0RwRtR�Rytlentranget	distutilsR�texecutet
write_filetwarn_deprecated_options(R�tspecR�troot_lentcounterR�((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pytrun�s$			cCsSytj�}Wn&tk
r8tjdtj�}nXtjj|j	d|�S(s�Return a pseudo-tempname base in the install directory.
        This code is intentionally naive; if a malicious party can write to
        the target directory you're already in deep doodoo.
        istest-easy-install-%s(
R9tgetpidt	ExceptiontrandomtrandintR�tmaxsizeR:tjoinRl(R�tpid((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pytpseudo_tempname�s

cCsdS(N((R�((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR��scCs�t|j�}tjj|d�}||jk}|rS|jrS|j�}n�|j�d}tjj	|�}y:|r�tj
|�nt|d�j�tj
|�Wn!t
tfk
r�|j�nX|r�|jr�t|j���n|r)|jdkr2t||j�|_q2n	d|_|ttt��krVt|_n1|jr�tjj	|�r�t|_d|_n||_dS(s;Verify that self.install_dir is .pth-capable dir, if neededseasy-install.pths.write-testtwN(RRlR9R:R�R�Rvtcheck_pth_processingRR;R�topentclosetOSErrortIOErrortcant_write_to_targetRtno_default_version_msgR�RiR1Rt_pythonpathRIR�(R�tinstdirR�tis_site_dirttestfilettest_exists((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR��s4		sS
        can't create or remove files in install directory

        The following error occurred while trying to add or remove files in the
        installation directory:

            %s

        The installation directory you specified (via --install-dir, --prefix, or
        the distutils default setting) was:

            %s
        s�
        This directory does not currently exist.  Please create it and try again, or
        choose a different installation directory (using the -d or --install-dir
        option).
        s�
        Perhaps your account does not have write access to this directory?  If the
        installation directory is a system-owned directory, you may need to sign in
        as the administrator or "root" account.  If you do not have administrative
        access to this machine, you may wish to choose a different installation
        directory, preferably one that is listed in your PYTHONPATH environment
        variable.

        For information on other options, you may wish to consult the
        documentation at:

          https://setuptools.readthedocs.io/en/latest/easy_install.html

        Please make the appropriate changes for your system and try again.
        cCsj|jtj�d|jf}tjj|j�sI|d|j7}n|d|j7}t	|��dS(Nis
(
t_easy_install__cant_write_msgR�texc_infoRlR9R:R;t_easy_install__not_exists_idt_easy_install__access_msgR(R�R�((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR	s
 c
Cs<|j}tjd|�|j�d}|d}tjj|�}td�d}yQ|rntj|�ntjj	|�}t
jj|dt
�t|d�}Wn!ttfk
r�|j�nSXz�|j|jt���|j�d}tj}tjdkrqtjj|�\}}	tjj|d	�}
|	j�d
ko\tjj|
�}|rq|
}qqnddlm}||d
ddgd�tjj|�r�tjd|�t
SWd|r�|j�ntjj|�r�tj|�ntjj|�rtj|�nX|js8tj d|�nt!S(s@Empirically verify whether .pth files are supported in inst. dirs Checking .pth file support in %ss.pths.oksz
            import os
            f = open({ok_file!r}, 'w')
            f.write('OK')
            f.close()
            s
texist_okRR�spythonw.exes
python.exei����(tspawns-Es-ctpassis-TEST PASSED: %s appears to support .pth filesNs+TEST FAILED: %s does NOT support .pth files("RlR
R�RR9R:R;t
_one_linerR�tdirnamet
pkg_resourcest
py31compattmakedirsRIRRRRtwriteR�R�RRiR�t
executableR�R�R�tlowertdistutils.spawnRRvR�RK(
R�RR�tok_filet	ok_existsR�RR]Rtbasenametalttuse_altR((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRsV	


	
	cCs�|jro|jd�roxS|jd�D]?}|jd|�rHq)n|j|||jd|��q)Wn|j|�dS(s=Write all the scripts for `dist`, unless scripts are excludedtscriptssscripts/N(Rntmetadata_isdirtmetadata_listdirtinstall_scripttget_metadatatinstall_wrapper_scripts(R�R�tscript_name((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pytinstall_egg_scriptsMscCs|tjj|�rhxctj|�D]?\}}}x-|D]%}|jjtjj||��q8Wq"Wn|jj|�dS(N(R9R:R�twalkR�R�R�(R�R:tbaseR�tfilesR�((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt
add_output[s

*cCs#|jrtd|f��ndS(NsjInvalid argument %r: you can't use filenames or URLs with --editable (except via the --find-links option).(RbR(R�R�((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pytnot_editablecs	cCsW|js
dStjjtjj|j|j��rStd|j|jf��ndS(Ns2%r already exists in %s; can't do a checkout there(RbR9R:R;R�RqtkeyR(R�R�((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pytcheck_editableks	'ccsTtjdtjd��}zt|�VWdtjj|�oNtt	|��XdS(NRzs
easy_install-(
ttempfiletmkdtempRtutstrR9R:R;R�R(R�ttmpdir((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt_tmpdiruscCs�|js|j�n|j��\}t|t�s�t|�r{|j|�|jj||�}|j	d|||t�Stj
j|�r�|j|�|j	d|||t�St|�}n|j|�|jj|||j|j|j|j�}|dkr8d|}|jr)|d7}nt|��nB|jtkra|j|||d�|S|j	||j||�SWdQXdS(Ns+Could not find suitable distribution for %rs2 (--always-copy skips system and development eggs)tUsing(Rbtinstall_site_pyR8R�R%RR0R�tdownloadtinstall_itemRiRIR9R:R;RR2tfetch_distributionRWRuR�Rt
precedenceR,tprocess_distributiontlocation(R�R�tdepsR7tdlR�R�((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR0~s2	



	
	
cCs�|p|j}|p*tjj|�|k}|p@|jd�}|p||jdk	o|tjjt|��t|j�k}|r�|r�x4|j|j	D]}|j
|kr�Pq�q�Wt}ntj
dtjj|��|r!|j|||�}xP|D]}|j|||�qWn,|j|�g}|j||d|d�|dk	r}x!|D]}||kr`|Sq`WndS(Ns.eggs
Processing %siR9(RuR9R:RtendswithR�RiRR�tproject_nameR@RIR
R�R!tinstall_eggsR?tegg_distribution(R�R�R;R7RAtinstall_neededR�tdists((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR<�s.
	

cCsUt|}xDtD]<}d|}t||�dkrt||||�qqWdS(s=Sets the install directories by applying the install schemes.tinstall_N(RR	R�RiR�(R�R�tschemeR1tattrname((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR��s



cGs*|j|�|jj|�||j|jkrF|jj|�n|jj|�|j|�||j|j<tj	|j
|||��|jd�r�|jr�|jj
|jd��n|r�|jr�dS|dk	r|j|jkrtjd|�dS|dks#||krD|j�}tt|��}ntj	d|�y(tg�j|g|j|j�}WnItk
r�}tt|���n%tk
r�}t|j���nX|js�|jrx9|D].}|j|jkr�|j|j��q�q�Wntj	d|�dS(Nsdependency_links.txtsSkipping dependencies for %ssProcessing dependencies for %ss'Finished processing dependencies for %s(t
update_pthR�taddR�R1tremoveR+R�R
R�tinstallation_reportthas_metadataR�R�tget_metadata_linesRuRiR�tas_requirementR%R6R)tresolveR0R*RR+treportR�(R�trequirementR�RAR�tdistreqtdistrosRc((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR?�sB


	
cCsA|jdk	r|jS|jd�r*tS|jd�s=tStS(Nsnot-zip-safeszip-safe(RjRiRPRIRK(R�R�((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pytshould_unzip�scCstjj|j|j�}tjj|�rSd}tj||j|j|�|Stjj|�rn|}n�tjj	|�|kr�tj
|�ntj|�}t|�dkr�tjj||d�}tjj|�r�|}q�nt
|�tj||�|S(Ns<%r already exists in %s; build directory %s will not be keptii(R9R:R�RqR1R;R
R�R�RR�tlistdirR�R!tshutiltmove(R�R�t
dist_filenamet
setup_basetdstR�tcontents((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt
maybe_move�s"	
cCs>|jr
dSx*tj�j|�D]}|j|�q#WdS(N(RntScriptWritertbesttget_argstwrite_script(R�R�Rr((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR)s	cCspt|j��}t||�}|rS|j|�t�}tj|�|}n|j|t|�d�dS(s/Generate a legacy script wrapper and install itR^N(	R6RRtis_python_scriptt_load_templateR�Rat
get_headerRdRF(R�R�R*tscript_texttdev_pathR�t	is_scripttbody((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR'scCs=d}|r!|jdd�}ntd|�}|jd�S(s�
        There are a couple of template scripts in the package. This
        function loads one of them and prepares it for use.
        sscript.tmpls.tmpls (dev).tmplR�sutf-8(RQR tdecode(RiR�t	raw_bytes((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRf&s
ttc	Cs�|jg|D]}tjj|j|�^q
�tjd||j�tjj|j|�}|j|�|jrzdSt	�}t
|�tjj|�r�tj|�nt
|d|��}|j|�WdQXt|d|�dS(s1Write an executable file to the scripts directorysInstalling %s script to %sNRi�(R�R9R:R�RmR
R�R/R�t
current_umaskR!R;R�RRtchmod(	R�R*R_tmodeR�RZttargettmaskR]((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRd5s,
		
cCs�|j�jd�r(|j||�gS|j�jd�rP|j||�gS|j�jd�rx|j||�gS|}tjj|�r�|jd�r�t|||j	�n'tjj
|�r�tjj|�}n|j|�r|j
r|dk	r|j|||�}ntjj|d�}tjj|�s�ttjj|dd��}|s�tdtjj|���nt|�dkr�td	tjj|���n|d
}n|jr�tj|j||��gS|j||�SdS(Ns.eggs.exes.whls.pyssetup.pyR�s"Couldn't find a setup script in %sisMultiple setup scripts in %si(RRCtinstall_eggtinstall_exet
install_wheelR9R:tisfileRtunpack_progressR�tabspatht
startswithRqRiR`R�R;RRR�RbR
R�treport_editabletbuild_and_install(R�R�R\R7R]tsetup_scripttsetups((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyREIs<"
	cCs[tjj|�r3t|tjj|d��}nttj|��}tj	|d|�S(NsEGG-INFOtmetadata(
R9R:R�R'R�R(t	zipimporttzipimporterR&t
from_filename(R�tegg_pathR((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRFus
cCs%tjj|jtjj|��}tjj|�}|jsLt|�n|j|�}t	||�stjj
|�r�tjj|�r�tj
|d|j�n2tjj|�r�|jtj|fd|�nyt}tjj
|�r*|j|�rtjd}}q�tjd}}ng|j|�rY|j|�|jd}}n8t}|j|�r�tjd}}ntjd}}|j|||f|dtjj|�tjj|�f�t|d|�Wqtk
rt|dt��qXn|j|�|j|�S(NR�s	Removing tMovingtCopyingt
Extractings	 %s to %stfix_zipimporter_caches(R9R:R�RlR!RyR�R!RFR/R�R�Rtremove_treeR;R�R�RKRzRZR[tcopytreeRXtmkpathtunpack_and_compileRItcopy2Rtupdate_dist_cachesR�R/(R�R�R7tdestinationR�tnew_dist_is_zippedR]RV((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRt}sT		
%
	


cCst|�}|dkr+td|��ntdd|jdd�d|jdd�dt��}tjj||j	�d�}||_
|d}tjj|d	�}tjj|d
�}t|�t||�|_
|j||�tjj|�st|d�}	|	jd�xU|jd�D]D\}
}|
d
kr*|	jd|
jdd�j�|f�q*q*W|	j�ntjj|d�}|jgtj|�D]}
tjj||
d�^q��tj||d|jd|j�|j||�S(Ns(%s is not a valid distutils Windows .exeRDRR�Rgtplatforms.eggs.tmpsEGG-INFOsPKG-INFORsMetadata-Version: 1.0
ttarget_versions%s: %s
t_t-R$iR�R�(R2RiRR&tgetRR9R:R�tegg_nameR@R!R't	_providert
exe_to_eggR;RRtitemsRQttitleRR�RaRcRtmake_zipfileR�R�Rt(R�R\R7tcfgR�R�tegg_tmpt	_egg_infotpkg_infR]tktvRmRr((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRu�s<	


0
3cs�t|��g�g�i������fd�}t|�|�g}x��D]�}|j�jd�rV|jd�}|d}tj|d�d|d<tjj	�|�}�j
|�|j
|�tj||�qVqVW|j��tj
tjj	�d�tj�|��x�d
D]�}	t�|	r*tjj	�d|	d	�}
tjj|
�s�t|
d
�}|jdj	t�|	�d�|j�q�q*q*WdS(s;Extract a bdist_wininst to the directories an egg would usecsL|j�}x�D]\}}|j|�r||t|�}|jd�}tjj�|�}|j�}|jd�s�|jd�r�tj	|d�|d<d�tjj
|d�d<�j|�nI|jd�r|dkrd�tjj
|d�d<�j|�n|SqW|jd	�sHtj
d
|�ndS(Nt/s.pyds.dlli����iis.pysSCRIPTS/s.pthsWARNING: can't process %s(RRzR�R�R9R:R�RCRtstrip_moduletsplitextR�R
R�Ri(tsrcR^REtoldtnewtpartsRB(R�tnative_libstprefixest
to_compilet	top_level(sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pytprocess�s$s.pydR�i����s.pysEGG-INFOR�R�s.txtRs
N(R�R�(R4RRRCR�RR�R9R:R�R�t
write_stubtbyte_compiletwrite_safety_flagtanalyze_eggR�R;RRR(R�R\R�R�tstubstresR�tresourcetpyfileR�ttxtR]((R�R�R�R�R�sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR��s6






!cCs/t|�}tjj|j|j��}tjj|�}|jsRt|�ntjj	|�r�tjj
|�r�tj|d|j�n2tjj
|�r�|jtj|fd|�nz?|j|j|fdtjj|�tjj|�f�Wdt|dt�X|j|�|j|�S(NR�s	Removing sInstalling %s to %sR�(RR9R:R�RlR�RyR�R!R�R�RR�R;R�R�tinstall_as_eggR!RR�RKR/RF(R�t
wheel_pathR7twheelR�((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRvs,	
%
s(
        Because this distribution was installed --multi-version, before you can
        import modules from this package in an application, you will need to
        'import pkg_resources' and then use a 'require()' call similar to one of
        these examples, in order to select the desired version:

            pkg_resources.require("%(name)s")  # latest installed version
            pkg_resources.require("%(name)s==%(version)s")  # this exact version
            pkg_resources.require("%(name)s>=%(version)s")  # this version or higher
        s�
        Note also that the installation directory must be on sys.path at runtime for
        this to work.  (e.g. by being the application's script directory, by being on
        PYTHONPATH, or by being added to sys.path by your code.)
        t	Installedc	Cs�d}|jr\|jr\|d|j7}|jtttj�kr\|d|j7}q\n|j	}|j
}|j}d}|t�S(s9Helpful installation message for display to package userss
%(what)s %(eggloc)s%(extras)ss
RT(
RvR{t_easy_install__mv_warningRlRRR�R:t_easy_install__id_warningR@RDRgR�(	R�treqR�twhatR�tegglocR�Rgtextras((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyROCs			sR
        Extracted editable version of %(spec)s to %(dirname)s

        If it uses setuptools in its setup script, you can activate it in
        "development" mode by going to that directory and running::

            %(python)s setup.py develop

        See the setuptools documentation for the "develop" command for more info.
        cCs-tjj|�}tj}d|jt�S(Ns
(R9R:RR�Rt_easy_install__editable_msgR�(R�R�R}Rtpython((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR{\s	cCstjjdt�tjjdt�t|�}|jdkrid|jd}|jdd|�n"|jdkr�|jdd�n|jr�|jdd	�nt	j
d
|t|�ddj|��yt
||�Wn-tk
r}td|jdf��nXdS(
Nsdistutils.command.bdist_eggsdistutils.command.egg_infoiR�iiR�s-qs-ns
Running %s %st sSetup script exited with %s(R�tmodulest
setdefaultRRR�R�R�R�R
R�R�R�RR�RRr(R�R}R]RrR�((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRas 	$c	Csddg}tjdddtjj|��}z�|jtjj|��|j|�|j|||�t|g�}g}x?|D]7}x.||D]"}|j|j	|j
|��q�Wq�W|r�|jr�tj
d|�n|SWdt|�tj|j�XdS(NRs
--dist-dirRzs
egg-dist-tmp-tdirs+No eggs found in %s (setup script problem?)(R3R4R9R:Rt_set_fetcher_optionsR�RR$RtR@R�R
R�R�R�R�(	R�R}R]Rrtdist_dirtall_eggsteggsR1R�((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR|us$	

$	

c	Cs�|jjd�j�}d}i}xF|j�D]8\}}||krOq1n|d||jdd	�<q1Wtd|�}tjj|d
�}t	j
||�dS(
s
        When easy_install is about to run bdist_egg on a source dist, that
        source dist might have 'setup_requires' directives, requiring
        additional fetching. Ensure the fetcher options given to easy_install
        are available to that command as well.
        R0RpR�RoRsRxiR�R�s	setup.cfgN(RpR�RoRsR�Rx(R�R�tcopyR�RQtdictR9R:R�Rtedit_config(	R�R-tei_optstfetch_directivest
fetch_optionsR1R�tsettingstcfg_filename((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR��s	cCs�|jdkrdSx~|j|jD]l}|jsE|j|jkr$tjd|�|jj|�|j|jkr�|jj|j�q�q$q$W|js|j|jj	kr�tjd|�qtjd|�|jj
|�|j|jkr|jj|j�qn|js�|jj
�|jdkr�tjj|jd�}tjj|�rotj|�nt|d�}|j|jj|j�d�|j�q�ndS(Ns&Removing %s from easy-install.pth files4%s is already the active version in easy-install.pths"Adding %s to easy-install.pth fileR�ssetuptools.pthtwts
(R�RiR1RvR@R
R�RNR�tpathsRMR�R�tsaveR9R:R�RlR�R�RRt
make_relativeR(R�R�RYR�R]((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRL�s4	
	
 cCstjd||�|S(NsUnpacking %s to %s(R
tdebug(R�R�R^((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRx�scs�g�g����fd�}t|||��j���js�x<�D]1}tj|�tjdBd@}t||�qNWndS(Ncs�|jd�r/|jd�r/�j|�n.|jd�sM|jd�r]�j|�n�j||��jr}|p�dS(Ns.pys	EGG-INFO/s.dlls.so(RCRzR�RxR�Ri(R�R^(R�tto_chmodR�(sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pytpf�simi�(RR�R�R9tstattST_MODERp(R�R�R�R�R]Rq((R�R�R�sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR��s
	
cCs�tjr
dSddlm}zetj|jd�||ddddd|j�|jr�||d|jddd|j�nWdtj|j�XdS(Ni����(R�iRsitforceR�(	R�tdont_write_bytecodetdistutils.utilR�R
R�R�R�Rs(R�R�R�((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR��s		s�
        bad install directory or PYTHONPATH

        You are attempting to install a package to a directory that is not
        on PYTHONPATH and which Python does not read ".pth" files from.  The
        installation directory you specified (via --install-dir, --prefix, or
        the distutils default setting) was:

            %s

        and your PYTHONPATH environment variable currently contains:

            %r

        Here are some of your options for correcting the problem:

        * You can choose a different installation directory, i.e., one that is
          on PYTHONPATH or supports .pth files

        * You can add the installation directory to the PYTHONPATH environment
          variable.  (It must then also be on PYTHONPATH whenever you run
          Python and want to use the package(s) you are installing.)

        * You can set up the installation directory to support ".pth" files by
          using one of the approaches described here:

          https://setuptools.readthedocs.io/en/latest/easy_install.html#custom-installation-locations


        Please make the appropriate changes for your system and try again.cCs)|j}||jtjjdd�fS(Nt
PYTHONPATHRT(t_easy_install__no_default_msgRlR9tenvironR�(R�ttemplate((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR	s	cCs7|jr
dStjj|jd�}tdd�}|jd�}d}tjj|�r�tj	d|j�t
j|��}|j�}WdQX|j
d�s�td	|��q�n||kr*tjd
|�|jst|�t
j|ddd��}|j|�WdQXn|j|g�nt|_dS(
s8Make sure there's a site.py in the target dir, if neededNssite.pyR�s
site-patch.pysutf-8RTsChecking existing site.py in %ss
def __boot():s;%s is not a setuptools-generated site.py; please remove it.sCreating %sRtencoding(R�R9R:R�RlR RlR;R
R�tioRtreadRzRR�R�R!RR�RI(R�tsitepytsourcetcurrenttstrm((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR:s,		
cCs�|js
dSttjjd��}xftj|j�D]R\}}|j|�r8tjj	|�r8|j
d|�tj|d�q8q8WdS(sCreate directories under ~.Nt~sos.makedirs('%s', 0o700)i�(RhRR9R:R�Rt	iteritemsR�RzR�tdebug_printR(R�thomeR�R:((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR�8s	"R�Rls/$base/lib/python$py_version_short/site-packagesRms	$base/bins$base/Lib/site-packagess
$base/ScriptscGs |jd�j}|jr�|j�}|j|d<|jjtj|j�}xH|j	�D]7\}}t
||d�dkr\t|||�q\q\Wnddl
m}xo|D]g}t
||�}|dk	r�|||�}tjdkrtjj|�}nt|||�q�q�WdS(NR�R-i����(RR�(tget_finalized_commandR�RzR�RR�R9R�tDEFAULT_SCHEMER�R�RiR�R�RR:R�(R�R�R�RJR�R�R((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR�Ns 	

N(sprefix=Nsinstallation prefix(szip-okRUsinstall package as a zipfile(s
multi-versionRVs%make apps have to require() a version(RWRXs1force upgrade (searches PyPI for latest versions)(sinstall-dir=RYsinstall package to DIR(sscript-dir=REsinstall scripts to DIR(sexclude-scriptsRZsDon't install scripts(salways-copyR[s'Copy all needed packages to install dir(s
index-url=R\s base URL of Python Package Index(sfind-links=R]s(additional URL(s) to search for packages(sbuild-directory=R^s/download/extract/build in DIR; keep the results(s	optimize=R_slalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0](srecord=Ns3filename in which to record list of installed files(salways-unzipR`s*don't install as a zipfile, no matter what(s
site-dirs=Ras)list of directories where .pth files work(RbRcs+Install specified packages in editable form(sno-depsRdsdon't install dependencies(sallow-hosts=Res$pattern(s) that hostnames must match(slocal-snapshots-okRfs(allow building eggs from local checkouts(RgNs"print version information and exit(s
no-find-linksNs9Don't load find-links defined in packages being installed((St__name__t
__module__t__doc__tdescriptionRItcommand_consumes_argumentsRituser_optionstboolean_optionsR�R�R�thelp_msgR�tnegative_optRR�R�R�R�tstaticmethodR�R�R�R�R�R�R�RR�R�RNROtlstripRRRRRR+R/R0R2t
contextlibtcontextmanagerR8RKR0R<R�R?RXR`R)R'RfRdRERFRtRuR�RvR�R�ROR�R{RR|R�RLRxR�R�R�R	R:R�R�RR�R�(((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR0xs�		

	0				z									*			;				
	$$		'				
	,		6	-	5									%					 	
	cCs.tjjdd�jtj�}td|�S(NR�RT(R9R�R�R�tpathseptfilterRi(R�((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR
es!cCs!g}|jt��tjg}tjtjkrG|jtj�nx2|D]*}|rNtjdkr�|jtjj	|dd��n|tj
dkr�|jtjj	|ddtjd d�tjj	|dd	�g�n%|j|tjj	|dd�g�tjd
krxd|krutjj
d�}|rrtjj	|d
dtjd d�}|j|�qrquqxqNqNWtd�td�f}x*|D]"}||kr�|j|�q�q�Wtjr�|jtj�ny|jtj��Wntk
rnXttt|��}|S(s&
    Return a list of 'site' dirs
    tos2emxtriscostLibs
site-packagesR�tlibR�issite-pythontdarwinsPython.frameworktHOMEtLibrarytPythontpurelibtplatlib(R�R�(textendR
R�RzR�R�R�R9R:R�tsepRgR�R�RR�R�R�tgetsitepackagestAttributeErrorR�RR(tsitedirsR�RzR�thome_spt	lib_pathstsite_lib((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR�jsV
"		
	
	
ccs^i}xQ|D]I}t|�}||kr1q
nd||<tjj|�sSq
ntj|�}||fVx�|D]�}|jd�s�qtn|dkr�qtnttjj||��}tt	|��}|j
�xw|D]o}|jd�s�t|j��}||krNd||<tjj|�s4q�n|tj|�fVqNq�q�WqtWq
WdS(sBYield sys.path directories that might contain "old-style" packagesis.pthseasy-install.pthssetuptools.pthtimportN(seasy-install.pthssetuptools.pth(
RR9R:R�RYRCRR�R�RRRztrstrip(tinputstseenRR.R�R]tlinestline((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pytexpand_paths�s4





cCst|d�}z^tj|�}|dkr1dS|d|d|d}|dkr[dS|j|d�tjd|jd��\}}}|dkr�dS|j|d|�id	d
6d	d6}tj	|�}yT|j|�}	|	j
dd
�d}
|
jtj
��}
|jtj|
��Wntjk
rCdSX|jd�sd|jd�rhdS|SWd|j�XdS(snExtract configuration data from a bdist_wininst .exe

    Returns a configparser.RawConfigParser, or None
    trbi	iiis<iiiizV4i{V4RTRgR�siiRtSetupN(izV4i{V4(Rtzipfilet_EndRecDataRitseekR6tunpackR�RtRawConfigParserR�RlR�tgetfilesystemencodingtreadfpRtStringIOtErrorthas_sectionR(R\R]tendrect	prependedttagtcfglentbmlentinitR�tparttconfig((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR2�s4$ c
Cs�dddddg}tj|�}zqxj|j�D]\}|j}|jd�}t|�d	kr�|d
dkr�|djd
�r�|jddj|d
 �df�Pq�nt|�d
ks4|jd�r�q4n|jd�r�q4n|dj	�dkr4|j
|�}tjr+|j
�}nxbt|�D]Q}|j�jdd�}|jd�s8|jd|d|fdf�q8q8Wq4q4WWd|j�Xg|D]\}}	|j�|	f^q�}|j�|j�|S(s4Get exe->egg path translations for a given .exe filesPURELIB/RTsPLATLIB/pywin32_system32sPLATLIB/sSCRIPTS/sEGG-INFO/scripts/sDATA/lib/site-packagesR�iisPKG-INFOis	.egg-infois	EGG-INFO/s.pths
-nspkg.pthtPURELIBtPLATLIBs\Rs%s/%s/N(sPURELIB/RT(sPLATLIB/pywin32_system32RT(sPLATLIB/RT(sSCRIPTS/sEGG-INFO/scripts/(sDATA/lib/site-packagesRT(R+R,(RtZipFiletinfolistR�R�R�RCR�R�tupperR�RtPY3RlRRPRQRzR�RRtsorttreverse(
texe_filenameR�RUR�R�R�R_tpthRZty((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR4�s>		"#"	3+

cBs\eZdZeZdd�Zd�Zd�Zed��Z	d�Z
d�Zd�ZRS(	s)A .pth file with Distribution paths in itcCs�||_ttt|��|_ttjj|j��|_|j	�t
j|gdd�x6t
|j�D]%}tt|jt|t���qoWdS(N(R�R�RRRR9R:Rtbasedirt_loadR$t__init__RiRR�RMR#RI(R�R�RR:((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR8)s	
cCs�g|_t}tj|j�}tjj|j�r3t	|jd�}x�|D]�}|j
d�rpt}qOn|j�}|jj
|�|j�sO|j�j
d�r�qOnttjj|j|��}|jd<tjj|�s�||kr|jj�t|_qOnd||<qOW|j�n|jrO|rOt|_nx.|jr|jdj�r|jj�qRWdS(NtrtRt#i����i(R�RKR�tfromkeysRR9R:RwR�RRzRIRR�RPRR�R6R;tpoptdirtyR(R�t
saw_importRR]RR:((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR72s2	
"&
	
 cCs�|js
dStt|j|j��}|r�tjd|j�|j|�}dj	|�d}t
jj|j�r�t
j
|j�nt|jd��}|j|�WdQXn;t
jj|j�r�tjd|j�t
j
|j�nt|_dS(s$Write changed .pth file back to diskNs	Saving %ss
R�sDeleting empty %s(R=R�RR�R�R
R�R�t_wrap_linesR�R9R:R�R�RRR;RK(R�t	rel_pathsRtdataR]((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR�Qs	cCs|S(N((R((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR?gscCsr|j|jko6|j|jkp6|jtj�k}|r^|jj|j�t|_ntj	||�dS(s"Add `dist` to the distribution mapN(
R@R�RR9tgetcwdR�RIR=R$RM(R�R�tnew_path((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRMkscCsIx2|j|jkr4|jj|j�t|_qWtj||�dS(s'Remove `dist` from the distribution mapN(R@R�RNRIR=R$(R�R�((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRNys
cCs�tjjt|��\}}t|j�}|g}tjdkrKdpQtj}xut|�|kr�||jkr�|jtj	�|j
�|j|�Stjj|�\}}|j|�qWW|SdS(NR�(R9R:R�RR�R6taltsepR	R�tcurdirR2R�(R�R:tnpathtlasttbaselenR�R	((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR��s	

((
R�R�R�RKR=R8R7R�R�R?RMRNR�(((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR1$s					tRewritePthDistributionscBs/eZed��Zed�Zed�ZRS(ccs*|jVx|D]}|VqW|jVdS(N(tpreludetpostlude(tclsRR((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR?�s
	s?
        import sys
        sys.__plen = len(sys.path)
        s�
        import sys
        new = sys.path[sys.__plen:]
        del sys.path[sys.__plen:]
        p = getattr(sys, '__egginsert', 0)
        sys.path[p:p] = new
        sys.__egginsert = p + len(new)
        (R�R�tclassmethodR?RRJRK(((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRI�s
	tSETUPTOOLS_SYS_PATH_TECHNIQUEtrawtrewritecCs,ttjt�rtStjtjj��S(s_
    Return a regular expression based on first_line_re suitable for matching
    strings.
    (R�RtpatternR6tretcompileRl(((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt_first_line_re�scCs�|tjtjgkrAtjdkrAt|tj�||�Stj�\}}}t	j
||d|dd||ff�dS(NR�iis %s %s(R9R�RNR�RpR�tS_IWRITER�RRtreraise(tfunctargtexctettevR�((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt
auto_chmod�s
'
cCs=t|�}t|tj�|r/t|�n
t|�dS(sa

    Fix any globally cached `dist_path` related data

    `dist_path` should be a path of a newly installed egg distribution (zipped
    or unzipped).

    sys.path_importer_cache contains finder objects that have been cached when
    importing data from the original distribution. Any such finders need to be
    cleared since the replacement distribution might be packaged differently,
    e.g. a zipped egg distribution might get replaced with an unzipped egg
    folder or vice versa. Having the old finders cached may then cause Python
    to attempt loading modules from the replacement distribution using an
    incorrect loader.

    zipimport.zipimporter objects are Python loaders charged with importing
    data packaged inside zip archives. If stale loaders referencing the
    original distribution, are left behind, they can fail to load modules from
    the replacement distribution. E.g. if an old zipimport.zipimporter instance
    is used to load data from a new zipped egg archive, it may cause the
    operation to attempt to locate the requested data in the wrong location -
    one indicated by the original distribution's zip archive directory
    information. Such an operation may then fail outright, e.g. report having
    read a 'bad local file header', or even worse, it may fail silently &
    return invalid data.

    zipimport._zip_directory_cache contains cached zip archive directory
    information for all existing zipimport.zipimporter instances and all such
    instances connected to the same archive share the same cached directory
    information.

    If asked, and the underlying Python implementation allows it, we can fix
    all existing zipimport.zipimporter instances instead of having to track
    them down and remove them one by one, by updating their shared cached zip
    archive directory information. This, of course, assumes that the
    replacement distribution is packaged as a zipped egg.

    If not asked to fix existing zipimport.zipimporter instances, we still do
    our best to clear any remaining zipimport.zipimporter related cached data
    that might somehow later get used when attempting to load data from the new
    distribution and thus cause such load operations to fail. Note that when
    tracking down such remaining stale data, we can not catch every conceivable
    usage from here, and we clear only those that we know of and have found to
    cause problems if left alive. Any remaining caches should be updated by
    whomever is in charge of maintaining them, i.e. they should be ready to
    handle us replacing their zip archives with new distributions at runtime.

    N(Rt_uncacheR�tpath_importer_cachet!_replace_zip_directory_cache_datat*_remove_and_clear_zip_directory_cache_data(t	dist_pathR�tnormalized_path((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR��s
<
cCsrg}t|�}xY|D]Q}t|�}|j|�r|||d!tjdfkr|j|�qqW|S(sp
    Return zipimporter cache entry keys related to a given normalized path.

    Alternative path spellings (e.g. those using different character case or
    those using alternative path separators) related to the same path are
    included. Any sub-path entries are included as well, i.e. those
    corresponding to zip archives embedded in other zip archives.

    iRT(R�RRzR9R	R�(Rbtcachetresultt
prefix_lentptnp((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt"_collect_zipimporter_cache_entriess

 cCs]xVt||�D]E}||}||=|o9|||�}|dk	r|||<qqWdS(s�
    Update zipimporter cache data for a given normalized path.

    Any sub-path entries are processed as well, i.e. those corresponding to zip
    archives embedded in other zip archives.

    Given updater is a callable taking a cache entry key and the original entry
    (after already removing the entry from the cache), and expected to update
    the entry and possibly return a new one to be inserted in its place.
    Returning None indicates that the entry should not be replaced with a new
    one. If no updater is given, the cache entries are simply removed without
    any additional processing, the same as if the updater simply returned None.

    N(RhRi(RbRctupdaterRft	old_entryt	new_entry((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt_update_zipimporter_cache$s

cCst||�dS(N(Rl(RbRc((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR]DscCs#d�}t|tjd|�dS(NcSs|j�dS(N(tclear(R:Rj((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt2clear_and_remove_cached_zip_archive_directory_dataIsRi(RlR�t_zip_directory_cache(RbRn((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR`Hs	t__pypy__cCs#d�}t|tjd|�dS(NcSs/|j�tj|�|jtj|�|S(N(RmR�R�tupdateRo(R:Rj((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt)replace_cached_zip_archive_directory_data_s

Ri(RlR�Ro(RbRr((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR_^s	
s<string>cCs7yt||d�Wnttfk
r.tSXtSdS(s%Is this string a valid Python script?texecN(RStSyntaxErrort	TypeErrorRKRI(RRR�((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt	is_pythonqs
cCsVy1tj|dd��}|jd�}WdQXWnttfk
rK|SX|dkS(sCDetermine if the specified executable is a .sh (contains a #! line)R�slatin-1iNs#!(R�RR�RR(Rtfptmagic((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pytis_sh{scCstj|g�S(s@Quote a command line argument according to Windows parsing rules(t
subprocesstlist2cmdline(RX((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pytnt_quote_arg�scCsb|jd�s|jd�r"tSt||�r5tS|jd�r^d|j�dj�kStS(sMIs this text, as a whole, a Python script? (as opposed to shell/bat/etc.
    s.pys.pyws#!R�i(RCRIRvRzt
splitlinesRRK(RhR�((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRe�s(RpcGsdS(N((Rr((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt_chmod�scCsQtjd||�yt||�Wn&tjk
rL}tjd|�nXdS(Nschanging mode of %s to %oschmod failed: %s(R
R�R~R9terror(R:RqRc((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRp�s
tCommandSpeccBs�eZdZgZe�Zed��Zed��Zed��Z	ed��Z
ed��Zd�Ze
d��Zd�Ze
d	��Ze
d
��ZRS(sm
    A command spec for a #! header, specified as a list of arguments akin to
    those passed to Popen.
    cCs|S(sV
        Choose the best CommandSpec class based on environmental conditions.
        ((RL((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRb�scCs(tjjtj�}tjjd|�S(Nt__PYVENV_LAUNCHER__(R9R:R=R�RR�R�(RLt_default((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt_sys_executable�scCsOt||�r|St|t�r,||�S|dkrB|j�S|j|�S(sg
        Construct a CommandSpec from a parameter to build_scripts, which may
        be None.
        N(R�R�Ritfrom_environmenttfrom_string(RLtparam((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt
from_param�s

cCs||j�g�S(N(R�(RL((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR��scCstj||j�}||�S(s}
        Construct a command spec from a simple string representing a command
        line parseable by shlex.split.
        (tshlexR�t
split_args(RLtstringR�((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR��scCsMtj|j|��|_tj|�}t|�sIdg|jd*ndS(Ns-xi(R�R�t_extract_optionstoptionsRzR{RL(R�Rhtcmdline((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pytinstall_options�scCsQ|dj�d}t�j|�}|rA|jd�pDdnd}|j�S(sH
        Extract any options from the first line of the script.
        s
iiRT(R}RTtmatchtgroupRP(torig_scripttfirstR�R�((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR��s!cCs|j|t|j��S(N(t_renderR�R�(R�((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt	as_header�scCsDd}x7|D]/}|j|�r
|j|�r
|dd!Sq
W|S(Ns"'ii����(RzRC(titemt_QUOTEStq((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt
_strip_quotes�s

cCs%tjd�|D��}d|dS(Ncss$|]}tj|j��VqdS(N(R�R�RP(R�R�((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pys	<genexpr>�ss#!s
(RzR{(R�R�((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR��s(R�R�R�R�R�R�RMRbR�R�R�R�R�R�R�R�R�R�(((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR��s			
	tWindowsCommandSpeccBseZede�ZRS(R�(R�R�R�RKR�(((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR��sRacBs�eZdZejd�j�ZeZe	ded��Ze	ded��Z
e	dd��Zed��Ze	d��Ze	d��Ze	d��Ze	d	dd
��ZRS(s`
    Encapsulates behavior around writing entry point scripts for console and
    gui apps.
    s�
        # EASY-INSTALL-ENTRY-SCRIPT: %(spec)r,%(group)r,%(name)r
        __requires__ = %(spec)r
        import re
        import sys
        from pkg_resources import load_entry_point

        if __name__ == '__main__':
            sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
            sys.exit(
                load_entry_point(%(spec)r, %(group)r, %(name)r)()
            )
    cCsMtjdt�|rtntj�}|jd||�}|j||�S(NsUse get_argsRT(twarningsR�tDeprecationWarningtWindowsScriptWriterRaRbtget_script_headerRc(RLR�Rtwininsttwritertheader((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pytget_script_argsscCsNtjdt�|rd}n|jj�j|�}|j|�|j�S(NsUse get_headers
python.exe(R�R�R�tcommand_spec_classRbR�R�R�(RLRhRR�tcmd((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR�!s	
ccs�|dkr|j�}nt|j��}x�dD]�}|d}xn|j|�j�D]W\}}|j|�|jt�}|j	||||�}	x|	D]}
|
Vq�WqZWq4WdS(s�
        Yield write_script() argument tuples for a distribution's
        console_scripts and gui_scripts entry points.
        tconsoletguit_scriptsN(R�R�(
RiRgR6RRt
get_entry_mapR�t_ensure_safe_nameR�R�t_get_script_args(RLR�R�R�ttype_R�R�tepRhRrR�((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRc+s

"

cCs+tjd|�}|r'td��ndS(s?
        Prevent paths in *_scripts entry point names.
        s[\\/]s+Path separators not allowed in script namesN(RRtsearchR�(R�thas_path_sep((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR�=scCs*tjdt�|r tj�S|j�S(NsUse best(R�R�R�R�Rb(RLt
force_windows((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt
get_writerFscCs?tjdks-tjdkr7tjdkr7tj�S|SdS(sD
        Select the best ScriptWriter for this environment.
        twin32tjavaR�N(R�R�R9R�t_nameR�Rb(RL((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRbLs-
ccs|||fVdS(N((RLR�R�R�Rh((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR�VsRTcCs/|jj�j|�}|j|�|j�S(s;Create a #! line, getting options (if any) from script_text(R�RbR�R�R�(RLRhRR�((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRg[s
N(R�R�R�RNROR�R�R�R�RMRiRKR�R�RcR�R�R�RbR�Rg(((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRas 		
R�cBsYeZeZed��Zed��Zed��Zed��Ze	d��Z
RS(cCstjdt�|j�S(NsUse best(R�R�R�Rb(RL((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR�fscCs2tdtd|�}tjjdd�}||S(sC
        Select the best ScriptWriter suitable for Windows
        RtnaturaltSETUPTOOLS_LAUNCHER(R�tWindowsExecutableLauncherWriterR9R�R�(RLt
writer_lookuptlauncher((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRbls
	c
cs�tdddd�|}|tjdj�jd�kr`djt��}tj|t	�nddd	d
dddg}|j
|�|j||�}g|D]}||^q�}	||||d
|	fVdS(s For Windows, add a .py extensionR�s.pyaR�s.pywtPATHEXTt;sK{ext} not listed in PATHEXT; scripts will not be recognized as executables.s.pys
-script.pys.pycs.pyos.exeRnN(R�R9R�RR�R�R�R�R�tUserWarningRNt_adjust_header(
RLR�R�R�RhtextR�R�RZR�((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR�ys"
cCsud}d}|dkr(||}}ntjtj|�tj�}|jd|d|�}|j|�rq|S|S(s�
        Make sure 'pythonw' is used for gui and and 'python' is used for
        console (regardless of what sys.executable is).
        spythonw.exes
python.exeR�R�trepl(RRRStescapet
IGNORECASEtsubt_use_header(RLR�torig_headerRQR�t
pattern_obt
new_header((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR��scCs/|dd!jd�}tjdkp.t|�S(s�
        Should _adjust_header use the replaced header?

        On non-windows systems, always use. On
        Windows systems, only use the replaced header if it resolves
        to an executable on the system.
        ii����t"R�(RPR�R�R
(R�tclean_header((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR��s	(R�R�R�R�RMR�RbR�R�R�R�(((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR�cs
R�cBseZed��ZRS(ccs�|dkr$d}d}dg}nd}d}dddg}|j||�}g|D]}	||	^qX}
||||d	|
fV|d
t|�dfVt�s�|d}|t|�d	fVnd
S(sG
        For Windows, add a .py extension and an .exe launcher
        R�s-script.pyws.pywtclis
-script.pys.pys.pycs.pyoRns.exeR^s
.exe.manifestN(R�tget_win_launcherR8tload_launcher_manifest(RLR�R�R�Rht
launcher_typeR�R�thdrRZR�tm_name((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR��s	
(R�R�RMR�(((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR��scCsGd|}t�r(|jdd�}n|jdd�}td|�S(s�
    Load the Windows launcher (executable) suitable for launching a script.

    `type` should be either 'cli' or 'gui'

    Returns the executable as a byte string.
    s%s.exet.s-64.s-32.R�(R8RQR (ttypetlauncher_fn((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR��s

	cCs>tjtd�}tjr&|t�S|jd�t�SdS(Nslauncher manifest.xmlsutf-8(RR R�RtPY2tvarsRl(R�tmanifest((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR��s	cCstj|||�S(N(RZR�(R:t
ignore_errorstonerror((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR��scCs tjd�}tj|�|S(Ni(R9tumask(ttmp((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRo�s
cCsMddl}tjj|jd�}|tjd<tjj|�t�dS(Ni����i(	R�R9R:Rt__path__R�targvR�R3(R�targv0((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt	bootstrap�s

cs�ddlm}ddlm�d�f�fd��Y}|dkrXtjd}nt��;|ddd	d
g|dtjdp�d	d
||�WdQXdS(Ni����(tsetup(R&tDistributionWithoutHelpCommandscseZdZ�fd�ZRS(RTcs't���j|||�WdQXdS(N(t_patch_usaget
_show_help(R�Rrtkw(R&(sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR��s
(R�R�tcommon_usageR�((R&(sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR��sitscript_argss-qR0s-vR*it	distclass(R�R�tsetuptools.distR&RiR�R�R�(R�R�R�R�((R&sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR3�s
c#seddl}tjd�j���fd�}|jj}||j_z	dVWd||j_XdS(Ni����se
        usage: %(script)s [options] requirement_or_url ...
           or: %(script)s --help
        cs�tdtjj|��S(Ntscript(R�R9R:R!(R*(tUSAGE(sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt	gen_usage	s	(tdistutils.coreRNROR�tcoreR�(R�R�tsaved((R�sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR�	s	(�R�RR�RRRtdistutils.errorsRRRRtdistutils.command.installRR	R�R
Rtdistutils.command.build_scriptsRRR
R�R9R�RZR3RRRR�R�RNR�R�R6R�RzR�R�tsetuptools.externRtsetuptools.extern.six.movesRRR�Rtsetuptools.sandboxRtsetuptools.py31compatRRtsetuptools.py27compatRtsetuptools.commandRtsetuptools.archive_utilRtsetuptools.package_indexRRRRRtsetuptools.wheelRRRRR R!R"R#R$R%R&R'R(R)R*R+R,tpkg_resources.py31compattfilterwarningst
PEP440Warningt__all__R8R/R�RFRLRR0R
R�RR2R4R1RIR�R�RTR\R�RhRiRlR]R`tbuiltin_module_namesR_RvRyR|ReRpR~tImportErrorR�R�R�tsys_executableR�tobjectRaR�R�R�R�R�R�RKR�RoR�R3R�R�(((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt<module>s�"d							�����		A	)	)	'l				R	 				
	
		

	T`A 						


?>