File Manager

Current Directory: /lib64/python3.6/__pycache__
Viewing File: /lib64/python3.6/__pycache__/zipapp.cpython-36.opt-2.pyc
3 \��@s�ddlZddlZddlZddlZddlZddlZddlZdddgZdZej j d�rXdZ nej �Z Gdd�de �Zejd d ��Zd d �Zdd d�Zddd�Zdd�Zddd�Zedkr�e�dS)�N� ZipAppError�create_archive�get_interpreterz8# -*- coding: utf-8 -*- import {module} {module}.{fn}() �winzutf-8c@s eZdZdS)rN)�__name__� __module__� __qualname__�r r �/usr/lib64/python3.6/zipapp.pyr!sc csFt|tj�rt|�}t|t�r<t||�� }|VWdQRXn|VdS)N)� isinstance�pathlib�Path�str�open)�archive�mode�fr r r � _maybe_open%s    rcCs$|r d|jt�d}|j|�dS)Ns#!� )�encode�shebang_encoding�write)r� interpreterZshebangr r r �_write_file_prefix0srcCs�t|d��Z}|jd�}|dkr*d}|j�t|d��&}t||�|j|�tj||�WdQRXWdQRX|r�t|t�r�t j |t j |�j t j B�dS)N�rb�s#!��wb)r�read�readlinerr�shutilZ copyfileobjr r�os�chmod�stat�st_mode�S_IEXEC)rZ new_archiver�srcZfirst_2�dstr r r � _copy_archive7s      r(cCs�d}t|d�rt|d�rd}ntj|�}|j�r4d}|rHt|||�dS|j�sXtd��|dj�}|rt|rttd��|pz|s�td��d}|r�|jd �\}}} td d �|j d �D��} td d �| j d �D��} |d ko�| o�| s�td|��t j || d�}|dk�r |j d�}nt|d��s"tj|�}t |d��~} t| |�tj| d��\} tj|�}x2|jd�D]$}t|j|��}| jt|�|��q\W|�r�| 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 � <genexpr>|sz!create_archive.<locals>.<genexpr>�.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�zipfileZZipFileZrglobrZ relative_torZwritestrrr"r#r$r%)�source�targetr�mainZsource_is_fileZhas_mainZmain_py�mod�sepr0Zmod_okZfn_ok�fd�z�rootZchildZarcnamer r r rNsP           &c Cs:t|d��&}|jd�dkr,|j�j�jt�SWdQRXdS)Nrrs#!)rrr�strip�decoder)rrr r r r�s cCs ddl}|j�}|jddddd�|jddddd�|jd d dd d�|jd d ddd�|jddd�|j|�}|jr�tjj|j�s�t d��t |j�}t dj |p�d��t jd�tjj|j��r|jdks�tjj|j�r�tjj|j|j�r�t d��|j�rt d��t|j|j|j|jd�dS)Nrz--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--infoF� store_truez)Display the interpreter from the archive.)rF�actionrGr<z'Source directory (or existing archive).)rGz%Can only get info for an archive filezInterpreter: {}z<none>z-In-place editing of archives is not supportedz,Cannot change the main function when copying)rr>)�argparse�ArgumentParser� add_argument� parse_args�infor!�path�isfiler<� SystemExitr�printr:�sys�exit�outputr5�samefiler>r�python)�argsrJ�parserrr r r r>�s6        r>�__main__)N)NNN)N)� contextlibr!r r r#rSr;�__all__r9�platform� startswithr�getfilesystemencoding� ValueErrorr�contextmanagerrrr(rrr>rr r r r �<module>s(     G -