grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026 й¼]õã@sddlZddlZddlZddlZddlZddlZddlZdddgZdZej j dƒr„dZ n ej ƒZ Gdd„de ƒZejd d „ƒZd d „Zdd d„Zddddd„Zdd„Zddd„ZedkreƒdS)éNÚ ZipAppErrorÚcreate_archiveÚget_interpreterz8# -*- coding: utf-8 -*- import {module} {module}.{fn}() Úwinzutf-8c@seZdZdS)rN)Ú__name__Ú __module__Ú __qualname__©r r ú+/opt/alt/python35/lib64/python3.5/zipapp.pyr!s c csWt|tjƒrt|ƒ}t|tƒrNt||ƒ� }|VWdQRXn|VdS)N)Ú isinstanceÚpathlibÚPathÚstrÚopen)ÚarchiveÚmodeÚfr r r Ú _maybe_open%s  rcCs.|r*d|jtƒd}|j|ƒdS)Ns#!s )ÚencodeÚshebang_encodingÚwrite)rÚ interpreterZshebangr r r Ú_write_file_prefix0srcCsÃt|dƒ�u}|jdƒ}|dkr=d}|jƒt|dƒ�1}t||ƒ|j|ƒtj||ƒWdQRXWdQRX|r¿t|tƒr¿t j |t j |ƒj t j BƒdS)NÚrbés#!óÚwb)rÚreadÚreadlinerrÚshutilÚ copyfileobjr rÚosÚchmodÚstatÚst_modeÚS_IEXEC)rZ new_archiverÚsrcZfirst_2Údstr r r Ú _copy_archive7s    r(cCs�d}t|dƒr-t|dƒr-d}n!tj|ƒ}|jƒrNd}|rht|||ƒdS|jƒs€tdƒ‚|djƒ}|r¨|r¨tdƒ‚|p±|sÀtdƒ‚d}|rh|jd ƒ\}}} td d „|j d ƒDƒƒ} td d „| j d ƒDƒƒ} |d ko=| o=| sPtd|ƒ‚t j d|d| ƒ}|dkr†|j dƒ}nt|dƒs¤tj|ƒ}t |dƒ�£} t| |ƒtj| dƒ�z} tj|ƒ}xB|jdƒD]1}t|j|ƒƒ}| jt|ƒ|ƒq÷W|rK| jd|jdƒƒWdQRXWdQRX|rŒt|dƒ rŒ|j|jƒjtjBƒdS)NFrrTzSource does not existz __main__.pyz8Cannot specify entry point if the source has __main__.pyzArchive has no entry pointú:css|]}|jƒVqdS)N)Ú isidentifier)Ú.0Úpartr r r ú |sz!create_archive..Ú.css|]}|jƒVqdS)N)r*)r+r,r r r r-}szInvalid entry point: ÚmoduleÚfnz.pyzrrÚwÚ*zutf-8)Úhasattrr r Úis_filer(ÚexistsrÚ partitionÚallÚsplitÚ MAIN_TEMPLATEÚformatZ with_suffixrrÚzipfileÚZipFileZrglobrZ relative_torZwritestrrr"r#r$r%)ÚsourceÚtargetrÚmainZsource_is_fileZhas_mainZmain_pyÚmodÚsepr0Zmod_okZfn_okÚfdÚzÚrootZchildZarcnamer r r rNsP        ""  'c CsKt|dƒ�5}|jdƒdkr@|jƒjƒjtƒSWdQRXdS)Nrrs#!)rrrÚstripÚdecoder)rrr r r r•scCsªddl}|jƒ}|jddddddƒ|jdddddd ƒ|jd d dddd ƒ|jd ddddddƒ|jdddƒ|j|ƒ}|jr tjj|jƒs×t dƒ‚t |jƒ}t dj |pødƒƒt jdƒtjj|jƒr�|jdks`tjj|jƒrltjj|j|jƒrlt dƒ‚|jr�t dƒ‚t|j|jd|jd|jƒdS)Nrz--outputz-oÚdefaultÚhelpzAThe name of the output archive. Required if SOURCE is an archive.z--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--infoFÚactionÚ store_truez)Display the interpreter from the archive.r=z'Source directory (or existing archive).z%Can only get info for an archive filezInterpreter: {}zz-In-place editing of archives is not supportedz,Cannot change the main function when copyingrr?)ÚargparseÚArgumentParserÚ add_argumentÚ parse_argsÚinfor!ÚpathÚisfiler=Ú SystemExitrÚprintr:ÚsysÚexitÚoutputr5Úsamefiler?rÚpython)ÚargsrKÚparserrr r r r?›s6      $   r?Ú__main__)Ú contextlibr!r rr#rTr;Ú__all__r9ÚplatformÚ startswithrÚgetfilesystemencodingÚ ValueErrorrÚcontextmanagerrrr(rrr?rr r r r Ús(           G -