
    =Ogo                     *   d dl Z d dlZd dlZd dlZd dlZd dlZd dlZg dZdZej	        
                    d          rdZn ej                    Z G d de          Ze j        d             Zd	 Zdd
Z	 	 ddZd ZddZedk    r e             dS dS )    N)ZipAppErrorcreate_archiveget_interpreterz8# -*- coding: utf-8 -*-
import {module}
{module}.{fn}()
winutf-8c                       e Zd ZdS )r   N)__name__
__module____qualname__     /usr/lib64/python3.11/zipapp.pyr   r   !   s        Dr   r   c              #      K   t          | t          t          j        f          r/t	          | |          5 }|V  d d d            d S # 1 swxY w Y   d S | V  d S N)
isinstancestrosPathLikeopen)archivemodefs      r   _maybe_openr   %   s      'C-.. '4   	AGGG	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 s   AA
A
c                 z    	 |r7d|                     t                    z   dz   }|                     |           d S d S )N   #!   
)encodeshebang_encodingwrite)r   interpretershebangs      r   _write_file_prefixr"   .   sM     +,,-=>>>F	 r   c                 &   	 t          | d          5 }|                    d          }|dk    rd}|                                 t          |d          5 }t          ||           |                    |           t          j        ||           d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   |rPt          |t                    r=t          j
        |t          j        |          j        t          j        z             d S d S d S )Nrb   r   r   wb)r   readreadliner"   r   shutilcopyfileobjr   r   r   chmodstatst_modeS_IEXEC)r   new_archiver    srcfirst_2dsts         r   _copy_archiver3   5   s   B	Wd	#	# )s ((1++eGLLNNNd++ 	)ssK000 IIgsC(((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	)) ) ) ) ) ) ) ) ) ) ) ) ) ) )"  Kz+s33 K
bgk22:T\IJJJJJK K K Ks6   AB2;BB2B	B2"B	#B22B69B6Fc                    	 d}t          | d          rt          | d          rd}n*t          j        |           } |                                 rd}|rt	          | ||           d S |                                 st          d          | dz                                  }|r|rt          d          |s|st          d          d }|r|                    d	          \  }	}
}t          d
 |		                    d          D                       }t          d |	                    d          D                       }|
d	k    r|r|st          d|z             t                              |	|          }||                     d          }n$t          |d          st          j        |          }t          |d          5 }t          ||           |rt          j        nt          j        }t          j        |d|          5 }|                     d          D ]L}|                    |           }| ||          r(|                    ||                                           M|r)|                    d|                    d                     d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   |rKt          |d          s=|                    |                                j        t4          j        z             d S d S d S )NFr'   r(   TzSource does not existz__main__.pyz8Cannot specify entry point if the source has __main__.pyzArchive has no entry point:c              3   >   K   | ]}|                                 V  d S r   isidentifier.0parts     r   	<genexpr>z!create_archive.<locals>.<genexpr>{   s.      DDTT&&((DDDDDDr   .c              3   >   K   | ]}|                                 V  d S r   r7   r9   s     r   r<   z!create_archive.<locals>.<genexpr>|   s.      BBDD%%''BBBBBBr   zInvalid entry point: )modulefnz.pyzr   r&   w)compression*r   )hasattrpathlibPathis_filer3   existsr   	partitionallsplitMAIN_TEMPLATEformatwith_suffixr   r"   zipfileZIP_DEFLATED
ZIP_STOREDZipFilerglobrelative_tor   as_posixwritestrr   r+   r,   r-   r.   )sourcetargetr    mainfilter
compressedsource_is_filehas_mainmain_pymodsepr@   mod_okfn_okfdrB   zchildarcnames                      r   r   r   L   s   & Nvv "76:#>#> "f%%>> 	"!N ffk222 ==?? 31222&//11H H HFH H 	H 8H 86777G :~~c**S"DDSYYs^^DDDDDBBBHHSMMBBBBBs

v
%
5<===&&cb&99~##F++VW%% &f%%	VT	"	" 
Cb2{+++/9 *w++) 	_R+>>> 	C!c** 7 7++F33>VVG__>GGE7#3#3#5#5666 C

='..*A*ABBB	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C	
C 
C 
C 
C 
C 
C 
C 
C 
C 
C 
C 
C 
C 
C 
C  ;76733 ;V[[]]*T\9:::::; ; ; ;s8   ?AJ2BJJ2J	J2"J	#J22J69J6c                     t          | d          5 }|                    d          dk    rJ|                                                                                    t
                    cd d d            S 	 d d d            d S # 1 swxY w Y   d S )Nr$   r%   r   )r   r'   r(   stripdecoder   )r   r   s     r   r   r      s    	Wd	#	# Aq66!99::<<%%''../?@@A A A A A A A AA A A A A A A A A A A A A A A A A As   ABB
Bc                 ,   	 dd l }|                                }|                    ddd d           |                    ddd d           |                    d	d
d d           |                    dddd           |                    dddd           |                    dd           |                    |           } | j        rt
          j                            | j                  st          d          t          | j                  }t          d                    |pd                     t          j        d           t
          j                            | j                  rz| j        Nt
          j                            | j                  r9t
          j                            | j        | j                  rt          d          | j        rt          d          t'          | j        | j        | j        | j        | j                   d S )Nr   z--outputz-ozAThe name of the output archive. Required if SOURCE is an archive.)defaulthelpz--pythonz-pzEThe name of the Python interpreter to use (default: no shebang line).z--mainz-mzLThe main function of the application (default: use an existing __main__.py).z
--compressz-c
store_truezQCompress files with the deflate method. Files are stored uncompressed by default.)actionrl   z--infoFz)Display the interpreter from the archive.)rk   rn   rl   rW   z'Source directory (or existing archive).)rl   z%Can only get info for an archive filezInterpreter: {}z<none>z-In-place editing of archives is not supportedz,Cannot change the main function when copying)r    rY   r[   )argparseArgumentParseradd_argument
parse_argsinfor   pathisfilerW   
SystemExitr   printrM   sysexitoutputrH   samefilerY   r   pythoncompress)argsro   parserr    s       r   rY   rY      sN    OOO$$&&F

D$5  6 6 6 
D$/  0 0 0 $;  < < < d<=  > > > %<  > > >
:  < < < T""D y w~~dk** 	FDEEE%dk22&&{'>h??@@@	w~~dk"" M;27>>$+#>#>#%7#3#3DK#M#M LMMM9 	MKLLL4;#{"m- - - - - -r   __main__r   )NNNNF)
contextlibr   rE   r)   r,   rx   rO   __all__rL   platform
startswithr   getfilesystemencoding
ValueErrorr   contextmanagerr   r"   r3   r   r   rY   r	   r   r   r   <module>r      sk       				    



 
>
>
> <5!! 30s022	 	 	 	 	* 	 	 	     K K K K. @D+0G; G; G; G;TA A A.- .- .- .-b zDFFFFF r   