
    z%i
                     F    d dl Z d dlZddlmZmZ ddZedk(  r e        yy)    N   )ZipFileZIP_DEFLATEDc                    dd l }d}|j                  |      }|j                  d      }|j                  dddd	
       |j                  ddddd       |j                  ddddd       |j                  dddd
       |j                  ddd
       |j	                  |       } | j
                  }| j                  [| j                  }t        |d|      5 }|j                         }d d d        rt        dj                  |             t        d       y | j                  4| j                  }t        |d|      5 }|j                          d d d        y | j                  8| j                  \  }}	t        |d|      5 }|j                  |	       d d d        y | j                  |r0t        d t         j"                  !       t!        j$                  d"       | j                  j'                  d      }
| j                  }fd#t        |
d$      5 }|D ]  }t(        j*                  j-                  |      }|s<t(        j*                  j-                  t(        j*                  j/                  |            }|d%t(        j0                  t(        j2                  fv rd%} |||        	 d d d        y y # 1 sw Y   xY w# 1 sw Y   y xY w# 1 sw Y   y xY w# 1 sw Y   y xY w)&Nr   z3A simple command-line interface for zipfile module.)descriptionT)requiredz-lz--list	<zipfile>zShow listing of a zipfile)metavarhelpz-ez	--extract   )r	   z<output_dir>zExtract zipfile into target dir)nargsr
   r   z-cz--create+)z<name>z<file>zCreate zipfile from sourcesz-tz--testzTest if a zipfile is validz--metadata-encodingz
<encoding>z2Specify encoding of member names for -l, -e and -tr)metadata_encodingz.The following enclosed file is corrupted: {!r}zDone testingz/Non-conforming encodings not supported with -c.)filer   c           	         t         j                  j                  |      r| j                  ||t               y t         j                  j                  |      r~|r| j                  ||       t        t        j                  |            D ]H  } | t         j                  j                  ||      t         j                  j                  ||             J y y N)	ospathisfilewriter   isdirsortedlistdirjoin)zfr   zippathnmaddToZips       D/home/uftp/.pyenv/versions/3.12.0/lib/python3.12/zipfile/__main__.pyr   zmain.<locals>.addToZip7   s    ww~~d#w5t$HHT7+ D!12 PBRWW\\$3RWW\\'25NPP %    w )argparseArgumentParseradd_mutually_exclusive_groupadd_argument
parse_argsr   testr   testzipprintformatlistprintdirextract
extractallcreatesysstderrexitpopr   r   basenamedirnamecurdirpardir)argsr$   r   parsergroupencodingsrcr   badfiler8   zip_namefilesr   r   r   s                 @r    mainrB      s   GK$$$=F///>E	tX{7  9	t[<=  ? 
tZs39  ; 
tX{8  :
-|Q  ST"D%%HyyiiS#: 	#bjjlG	#BII'RSn		iiS#: 	bKKM	 	 
	!llVS#: 	"bMM&!	" 	" 
	 Czz#HHQK;;??1%	P Xs# 	,r ,''**40 gg..rwwt/DEGr299bii88 GT7+,	, 	,) 
!!	# 	#	 	
	" 	".	, 	,s1   J4 KKBK4J>K
KK"__main__r   )r2   r   r#   r   r   rB   __name__ r!   r    <module>rF      s)    
 	 #C,L zF r!   