ok

Mini Shell

Direktori : /opt/alt/python33/lib/python3.3/site-packages/pip/commands/
Upload File :
Current File : //opt/alt/python33/lib/python3.3/site-packages/pip/commands/zip.pyo

�
�2{Yc@s�ddlZddlZddlZddlZddlZddlZddlmZmZm	Z	ddl
mZddlm
Z
ddlmZdefd��YZdS(i����N(tdisplay_patht
backup_dirtrmtree(tlogger(tInstallationError(tCommandt
ZipCommandcBs�eZdZdZdZdZd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�ZRS(sZip individual packages.tzips#
     %prog [options] <package> ...s$DEPRECATED. Zip individual packages.c
Os9tt|�j||�|jdkrM|jjddddddd�n(|jjd	dd
dddtdd�|jjd
dddddd�|jjdddddddd�|jjddddddd�|jjddddddd�|jjdddddd�|jjd|j�dS(NRs--unziptactiont
store_truetdesttunzipthelps"Unzip (rather than zip) a package.s--ziptstore_falsetdefaults"Zip (rather than unzip) a package.s--no-pyctno_pycsEDo not include .pyc files in zip files (useful on Google App Engine).s-ls--listtlists2List the packages available, and their zip status.s--sort-filest
sort_filessDWith --list, sort packages according to how many files they contain.s--pathtappendtpathss?Restrict operations to the given paths (may include wildcards).s-ns
--simulates0Do not actually perform the zip/unzip operation.i(	tsuperRt__init__tnametcmd_optst
add_optiontTruetparsertinsert_option_group(tselftargstkw((sA/opt/alt/python33/lib/python3.3/site-packages/pip/commands/zip.pyRsL	
								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(s:All the entries of sys.path, possibly restricted by --patht*s,Skipping path %s because it doesn't match %ss, sDAdding path %s because it doesn't match anything already on sys.path(tselect_pathstsystpathtsettostnormcasetabspathtretsearchtfnmatcht	translateRtaddt
startswithRtdebugtjoin(Rtresultt	match_anyR"tmatch((sA/opt/alt/python33/lib/python3.3/site-packages/pip/commands/zip.pyR>s2		



	
	cCsVtjdd�|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(Ns1.7s_DEPRECATION: 'pip zip' and 'pip unzip` are deprecated, and will be removed in a future release.s2You must give at least one package to zip or unzips;The module %s (in %s) is not a zip file; cannot be unzippeds:The module %s (in %s) is not a directory; cannot be zipped(Rt
deprecatedRR tsimulateRRtfind_packageRR$R"tisdirRtNonet
unzip_packagetzip_packageR(RtoptionsRtpackagestargtmodule_nametfilenametlast_status((sA/opt/alt/python33/lib/python3.3/site-packages/pip/commands/zip.pytrun\s4	
	c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(
Ns3Module %s (in %s) isn't located in a zip file in %ss/Unpacking %s into %s, but %s is not on sys.pathsUnzipping %s (in %s)s3Skipping remaining operations because of --simulateitwbsRemoving now-empty zip file %ss(Removing entries in %s/ from zip file %stw( R$R"tdirnametisfiletzipfilet
is_zipfileRRRtwarnRtnotifyR3tindenttZipFiletinfolistR=R,tseptreadR.texiststmakedirstendswithtopentwritetcloseRtinfotunlinktremove_filename_from_pthtwritestr(RR<R=tzip_filenametpackage_pathRtto_saveRSRtcontentR
tf((sA/opt/alt/python33/lib/python3.3/site-packages/pip/commands/zip.pyR7{sX"	
	

 

cCsb|}tjd|t|�f�tjd7_|jd�rJ|}n
|d}z�||kr�t|�}tjd||f�|js�tj||�q�ny�tj	dt|��|jst
j|d�}|j|dd	�xt
j|�D]�\}}}	|rDg|	D]!}
|
j�jd
�s|
^q}	nx�|tf|	tfgD]�\}}x�|D]y}
t
jj||
�}t
jj||t|�jt
jj�|
�}|r�|j|dd	�qp|j||�qpWq]Wq�W|j�ntj	dt|��|js/t|�nWn
�nX|j|�Wdtjd8_XdS(NsZip %s (in %s)is.eggs.zipsMoving %s aside to %ssCreating zip file in %sRAt/ts.pycsRemoving old directory %s(RRGRRHRORR3tshutiltmoveRSRDRIRVR$twalktlowerRtFalseR"R.tlentlstripRKRQRRRtadd_filename_to_pth(RR<R=Rt
orig_filenamet
dest_filenameRtdirpathtdirnamest	filenamesR[tfnstis_dirtfntfullR
((sA/opt/alt/python33/lib/python3.3/site-packages/pip/commands/zip.pyR8�sH	
		
$%
1
	cCs9x|j�D]
}t|d�}|j�}|j�g|D]}|j�|kr?|^q?}||kr
tjdt|�t|�f�g|D]}|r�|^q�s�tjdt|��|jst	j
|�qn2|jst|d�}|j|�|j�ndSq
Wtjdt|��dS(Ntrs*Removing reference to %s from .pth file %ss %s file would be empty: deletingR@s.Cannot find a reference to %s in any .pth file(
t	pth_filesRPt	readlinesRRtstripRRSRR3R$RTt
writelinesRF(RR=tpthR[tlinestlt	new_linestline((sA/opt/alt/python33/lib/python3.3/site-packages/pip/commands/zip.pyRU�s$
+			

cCstjj|�}|d}||j�krHtjdt|��n|js�tjj|�r�t	|�}|j
�}|j�|r�|djd�r�|dcd7<n|j
|d�n
|dg}t	|d�}|j|�|j�ndS(Ns.pths.Adding .pth file %s, but it is not on sys.pathi����s
R@(R$R"RBRRRFRR3RMRPRqRRRORRs(RR=R"R
R[Ru((sA/opt/alt/python33/lib/python3.3/site-packages/pip/commands/zip.pyRe�s 
	


ccs�x�|j�D]r}tjj|�s
tjj|�r?q
nx=tj|�D],}|jd�rOtjj||�VqOqOWq
WdS(Ns.pth(RR$R"RMR5tlistdirROR.(RR"R=((sA/opt/alt/python33/lib/python3.3/site-packages/pip/commands/zip.pyRps&cCs�x�|j�D]�}tjj||�}tjj|�rD||fStjj|�r
tj|�r
tj|d�}y |j	tjj|d��Wnt
k
r�nX|j�||fS|j�q
q
Wtd|��dS(NRos__init__.pys!No package with the name %s found(
RR$R"R.RMR5RDRERIRLtKeyErrorRRR(RtpackageR"RnR((sA/opt/alt/python33/lib/python3.3/site-packages/pip/commands/zip.pyR4s
" 


c
CsA|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�|jdd��nt
jd�t
jd	7_z2x+|D]#\}}
t
jd||
f�q�WWdt
jd	8_Xn
t
jd�Wdt
jd	8_Xq(WdS(Ns'You cannot give an argument with --listsZipped egg: %ss
site-packagess
dist-packagess\R\s
lib/pythonsIn %s:iis.pths	.egg-infos	.egg-links.pys Not displaying %s: not a packagesUnknown file: %ssZipped packages:sNo zipped packages.tkeycSs	|dS(Ni((tx((sA/opt/alt/python33/lib/python3.3/site-packages/pip/commands/zip.pyt<lambda>LssUnzipped packages:s%s  (%i files)sNo unzipped packages.(s.pths	.egg-infos	.egg-link(RtsortedRR$R"RMtbasenametrstripRKRCRDRERBRRGRtreplaceRORHRytsplitextRaRSR.R5Rt
count_packageRtsort(RR9RR"R�tzippedtunzippedR=textRntcount((sA/opt/alt/python33/lib/python3.3/site-packages/pip/commands/zip.pyRsf!!


	
cCskd}x^tj|�D]M\}}}g|D]!}|j�jd�s,|^q,}|t|�7}qW|S(Nis.pyc(R$R`RaRORc(RR"ttotalRhRiRjR[((sA/opt/alt/python33/lib/python3.3/site-packages/pip/commands/zip.pyR�Ys
!(t__name__t
__module__t__doc__RtusagetsummaryRRR?R7R8RUReRpR4RR�(((sA/opt/alt/python33/lib/python3.3/site-packages/pip/commands/zip.pyR
s	*			3	,					;(R!R'R)R$R^RDtpip.utilRRRtpip.logRtpip.exceptionsRtpip.basecommandRR(((sA/opt/alt/python33/lib/python3.3/site-packages/pip/commands/zip.pyt<module>s

Zerion Mini Shell 1.0