Your IP : 3.133.153.224


Current Path : /opt/alt/python33/lib/python3.3/site-packages/pip/commands/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib/python3.3/site-packages/pip/commands/__pycache__/zip.cpython-33.pyc

�
7�Re�9c@s�ddlZddlZddlZddlZddlZddlZddlmZmZm	Z	ddl
mZddlm
Z
ddlmZGdd�de�ZdS(iN(udisplay_pathu
backup_dirurmtree(ulogger(uInstallationError(uCommandcs�|EeZdZdZdZdZdZ�fdd�Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Z�S(u
ZipCommanduZip individual packages.uzipu#
     %prog [options] <package> ...u$DEPRECATED. Zip individual packages.c
s9tt|�j||�|jdkrM|jjddddddd�n(|jjd	dd
dddddd�|jjd
dddddd�|jjdddddddd�|jjddddddd�|jjddddddd�|jjdddddd�|jjd|j�dS( Nuzipu--unzipuactionu
store_trueudestuunzipuhelpu"Unzip (rather than zip) a package.u--zipustore_falseudefaultu"Zip (rather than unzip) a package.u--no-pycuno_pycuEDo not include .pyc files in zip files (useful on Google App Engine).u-lu--listulistu2List the packages available, and their zip status.u--sort-filesu
sort_filesuDWith --list, sort packages according to how many files they contain.u--pathuappendupathsu?Restrict operations to the given paths (may include wildcards).u-nu
--simulateu0Do not actually perform the zip/unzip operation.iT(	usuperu
ZipCommandu__init__unameucmd_optsu
add_optionuTrueuparseruinsert_option_group(uselfuargsukw(u	__class__(u)/tmp/pip-zej_zi-build/pip/commands/zip.pyu__init__sL	
								uZipCommand.__init__cCsp|jstjSg}t�}x�tjD]�}tjjtjj|��}x�|jD]�}tjjtjj|��}d|kr�tjt	j
|d�|�r�|j|�|j|�Pq�qW|j
|�rW|j|�|j|�PqWqWWtjd|dj|j�f�q)WxJ|jD]?}||kr)d|kr)|j|�tjd|�q)q)W|S(u:All the entries of sys.path, possibly restricted by --pathu*u,Skipping path %s because it doesn't match %su, uDAdding path %s because it doesn't match anything already on sys.path(uselect_pathsusysupathusetuosunormcaseuabspathureusearchufnmatchu	translateuappenduaddu
startswithuloggerudebugujoin(uselfuresultu	match_anyupathumatch((u)/tmp/pip-zej_zi-build/pip/commands/zip.pyupaths>s2		



	
	uZipCommand.pathscCsVtjdd�|j|_|j|_|jrA|j||�S|sVtd��ng}x�|D]�}|j|�\}}|jr�t	j
j|�r�td||f��n6|jr�t	j
j|�r�td||f��n|j||f�qcWd}xJ|D]B\}}|jr6|j||�}q|j|||j�}qW|S(Nu1.7u_DEPRECATION: 'pip zip' and 'pip unzip` are deprecated, and will be removed in a future release.u2You must give at least one package to zip or unzipu;The module %s (in %s) is not a zip file; cannot be unzippedu:The module %s (in %s) is not a directory; cannot be zipped(uloggeru
deprecatedupathsuselect_pathsusimulateulistuInstallationErrorufind_packageuunzipuosupathuisdiruappenduNoneu
unzip_packageuzip_packageuno_pyc(uselfuoptionsuargsupackagesuargumodule_nameufilenameulast_status((u)/tmp/pip-zej_zi-build/pip/commands/zip.pyurun\s4	
	uZipCommand.runc
Cs�tjj|�}tjj|�rPtj|�rPtd|||f��ntjj|�}||j�kr�tj	dt
|�t
|�t
|�f�ntjd|t
|�f�|jr�tjd�dStj
d7_
z�tj|�}g}x|j�D]}|j}|j|tjj�r�|j|�}	tjj||�}
tjjtjj|
��s�tjtjj|
��n|	r�|
jtjj�r�tjj|
�s�tj|
�q�qt|
d�}|j|	�|j�q|j||j|�f�qW|j�|sbtjdt
|��tj|�|j|�n`tjd|t
|�f�tj|d	�}x$|D]\}}	|j||	�q�W|j�Wdtj
d8_
XdS(
Nu3Module %s (in %s) isn't located in a zip file in %su/Unpacking %s into %s, but %s is not on sys.pathuUnzipping %s (in %s)u3Skipping remaining operations because of --simulateiuwbuRemoving now-empty zip file %su(Removing entries in %s/ from zip file %suw( uosupathudirnameuisfileuzipfileu
is_zipfileuInstallationErrorupathsuloggeruwarnudisplay_pathunotifyusimulateuindentuZipFileuinfolistufilenameu
startswithusepureadujoinuexistsumakedirsuendswithuopenuwriteucloseuappenduinfouunlinkuremove_filename_from_pthuwritestr(uselfumodule_nameufilenameuzip_filenameupackage_pathuziputo_saveuinfounameucontentudestuf((u)/tmp/pip-zej_zi-build/pip/commands/zip.pyu
unzip_package{sX"	
	

 

uZipCommand.unzip_packagecCsN|}tjd|t|�f�tjd7_|jd�rJ|}n
|d}z�||kr�t|�}tjd||f�|js�tj||�q�nyvtj	dt|��|js�t
j|d�}|j|dd	�x�t
j|�D]�\}}}	|r)d
d�|	D�}	nx�|d
f|	dfgD]�\}
}x�|
D]}t
jj||�}
t
jj||t|�d�jt
jj�|�}|r�|j|dd	�qU|j|
|�qUWqBWq�W|j�ntj	dt|��|jst|�nWn�YnX|j|�Wdtjd8_XdS(NuZip %s (in %s)iu.eggu.zipuMoving %s aside to %suCreating zip file in %suwu/ucSs+g|]!}|j�jd�s|�qS(u.pyc(uloweruendswith(u.0uf((u)/tmp/pip-zej_zi-build/pip/commands/zip.pyu
<listcomp>�s	u*ZipCommand.zip_package.<locals>.<listcomp>uRemoving old directory %sTF(uloggerunotifyudisplay_pathuindentuendswithu
backup_dirusimulateushutilumoveuinfouzipfileuZipFileuwritestruosuwalkuTrueuFalseupathujoinulenulstripusepuwriteucloseurmtreeuadd_filename_to_pth(uselfumodule_nameufilenameuno_pycu
orig_filenameu
dest_filenameuzipudirpathudirnamesu	filenamesufnsuis_dirufnufulludest((u)/tmp/pip-zej_zi-build/pip/commands/zip.pyuzip_package�sF	
		%
7
	uZipCommand.zip_packagecsx�|j�D]�}t|d�}|j�}|j��fdd�|D�}||kr
tjdt��t|�f�dd�|D�s�tjdt|��|js�tj	|�q�n2|js�t|d�}|j
|�|j�ndSq
Wtjdt���dS(	Nurcs(g|]}|j��kr|�qS((ustrip(u.0ul(ufilename(u)/tmp/pip-zej_zi-build/pip/commands/zip.pyu
<listcomp>�s	u7ZipCommand.remove_filename_from_pth.<locals>.<listcomp>u*Removing reference to %s from .pth file %scSsg|]}|r|�qS(((u.0uline((u)/tmp/pip-zej_zi-build/pip/commands/zip.pyu
<listcomp>�s	u %s file would be empty: deletinguwbu.Cannot find a reference to %s in any .pth file(u	pth_filesuopenu	readlinesucloseuloggeruinfoudisplay_pathusimulateuosuunlinku
writelinesuwarn(uselfufilenameupthufulinesu	new_lines((ufilenameu)/tmp/pip-zej_zi-build/pip/commands/zip.pyuremove_filename_from_pth�s$
			

u#ZipCommand.remove_filename_from_pthcCs�tjj|�}|d}||j�krHtjdt|��n|js�tjj|�r�t	|�}|j
�}|j�|r�|djd�r�|dd7<n|j
|d�n
|dg}t	|d�}|j|�|j�ndS(Nu.pthu.Adding .pth file %s, but it is not on sys.pathiu
uwbi����i����(uosupathudirnameupathsuloggeruwarnudisplay_pathusimulateuexistsuopenu	readlinesucloseuendswithuappendu
writelines(uselfufilenameupathudestufulines((u)/tmp/pip-zej_zi-build/pip/commands/zip.pyuadd_filename_to_pth�s 
	


uZipCommand.add_filename_to_pthccs�x�|j�D]r}tjj|�s
tjj|�r?q
nx=tj|�D],}|jd�rOtjj||�VqOqOWq
WdS(Nu.pth(upathsuosupathuexistsuisdirulistdiruendswithujoin(uselfupathufilename((u)/tmp/pip-zej_zi-build/pip/commands/zip.pyu	pth_filess&uZipCommand.pth_filesc
Cs�x�|j�D]�}tjj||�}tjj|�rD||fStjj|�r
tj|�r
tj|d�}y |j	tjj|d��Wnt
k
r�YnX|j�||fS|j�q
q
Wtd|��dS(Nuru__init__.pyu!No package with the name %s found(
upathsuosupathujoinuexistsuisdiruzipfileu
is_zipfileuZipFileureaduKeyErrorucloseuInstallationError(uselfupackageupathufulluzip((u)/tmp/pip-zej_zi-build/pip/commands/zip.pyufind_packages
" 


uZipCommand.find_packagecCsD|rtd��nx(t|j��D]}tjj|�sFq(ntjj|jtjj��}tjj	|�r�t
j|�r�tjj|�|j�kr(t
jdt|��q(q(n|dkr|dkr|jdd�jd�rq(nt
jdt|��t
jd	7_g}g}z�x�ttj|��D]�}tjj|�d
j�}|dkrqKn|dkr�t
jdt|��qKntjj||�}	tjj|	�r�|j||j|	�f�qKt
j|	�r
|j|�qKt
jdt|��qKW|r�t
jd�t
jd	7_z"x|D]}t
j|�qTWWdt
jd	8_Xn
t
jd�|r|jr�|jddd��nt
jd�t
jd	7_z2x+|D]#\}}
t
jd||
f�q�WWdt
jd	8_Xn
t
jd�Wdt
jd	8_Xq(WdS(Nu'You cannot give an argument with --listuZipped egg: %su
site-packagesu
dist-packagesu\u/u
lib/pythonuIn %s:iiu.pthu	.egg-infou	.egg-linku.pyu Not displaying %s: not a packageuUnknown file: %suZipped packages:uNo zipped packages.ukeycSs	|dS(Ni((ux((u)/tmp/pip-zej_zi-build/pip/commands/zip.pyu<lambda>Lsu!ZipCommand.list.<locals>.<lambda>uUnzipped packages:u%s  (%i files)uNo unzipped packages.(u.pthu	.egg-infou	.egg-link(uInstallationErrorusortedupathsuosupathuexistsubasenameurstripusepuisfileuzipfileu
is_zipfileudirnameuloggerunotifyudisplay_pathureplaceuendswithuindentulistdirusplitextuloweruinfoujoinuisdiruappendu
count_packageu
sort_filesusort(uselfuoptionsuargsupathubasenameuzippeduunzippedufilenameuextufullucount((u)/tmp/pip-zej_zi-build/pip/commands/zip.pyulistsf!!


	
uZipCommand.listcCsPd}xCtj|�D]2\}}}dd�|D�}|t|�7}qW|S(NicSs+g|]!}|j�jd�s|�qS(u.pyc(uloweruendswith(u.0uf((u)/tmp/pip-zej_zi-build/pip/commands/zip.pyu
<listcomp>\s	u,ZipCommand.count_package.<locals>.<listcomp>(uosuwalkulen(uselfupathutotaludirpathudirnamesu	filenames((u)/tmp/pip-zej_zi-build/pip/commands/zip.pyu
count_packageYs
uZipCommand.count_package(u__name__u
__module__u__qualname__u__doc__unameuusageusummaryu__init__upathsurunu
unzip_packageuzip_packageuremove_filename_from_pthuadd_filename_to_pthu	pth_filesufind_packageulistu
count_package(u
__locals__((u	__class__u)/tmp/pip-zej_zi-build/pip/commands/zip.pyu
ZipCommand
s*3,;u
ZipCommand(usysureufnmatchuosushutiluzipfileupip.utiludisplay_pathu
backup_dirurmtreeupip.loguloggerupip.exceptionsuInstallationErrorupip.basecommanduCommandu
ZipCommand(((u)/tmp/pip-zej_zi-build/pip/commands/zip.pyu<module>s

?>