ok

Mini Shell

Direktori : /opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/__pycache__/zipapp.cpython-35.opt-1.pyc



N�Ma��@sddlZddlZddlZddlZddlZddlZddlZdddgZdZej	j
d�r�dZnej�ZGdd�de
�Zejd	d
��Zdd�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)zWrite a shebang line.s#!s
N)�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tj
B�dS)z8Copy an application archive, modifying the shebang line.�rb�s#!��wbN)r�read�readlinerr�shutilZcopyfileobjrr�os�chmod�stat�st_mode�S_IEXEC)rZnew_archiver�srcZfirst_2Zdstr	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
�\}}}	tdd�|j	d
�D��}
tdd�|	j	d
�D��}|d
ko=|
o=|sPtd|��t
jd|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)abCreate an application archive from SOURCE.

    The SOURCE can be the name of a directory, or a filename or a file-like
    object referring to an existing archive.

    The content of SOURCE is packed into an application archive in TARGET,
    which can be a filename or a file-like object.  If SOURCE is a directory,
    TARGET can be omitted and will default to the name of SOURCE with .pyz
    appended.

    The created application archive will have a shebang line specifying
    that it should run with INTERPRETER (there will be no shebang line if
    INTERPRETER is None), and a __main__.py which runs MAIN (if MAIN is
    not specified, an existing __main__.py will be used).  It is an error
    to specify MAIN for anything other than a directory source with no
    __main__.py, and it is an error to omit MAIN if the directory has no
    __main__.py.
    FrrTNzSource 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�formatZwith_suffixrr�zipfileZZipFileZrglobrZrelative_torZwritestrrr!r"r#r$)�source�targetr�mainZsource_is_fileZhas_mainZmain_py�mod�sepr.Zmod_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�|jdd	dddd
�|jdddddd
�|jddddddd�|jddd�|j|�}|jrtjj|j�s�t	d��t
|j�}tdj|p�d��t
jd�tjj|j�r�|jdks`tjj|j�rltjj|j|j�rlt	d��|jr�t	d��t|j|jd|jd|j�dS)z�Run the zipapp command line interface.

    The ARGS parameter lets you specify the argument list directly.
    Omitting ARGS (or setting it to None) works as for argparse, using
    sys.argv[1:] as the argument list.
    rNz--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: {}z<none>z-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�printr8�sys�exit�outputr3�samefiler<r�python)�argsrH�parserrr	r	r
r<�s6	
$	r<�__main__)�
contextlibr rrr"rQr9�__all__r7�platform�
startswithr�getfilesystemencoding�
ValueErrorr�contextmanagerrrr&rrr<rr	r	r	r
�<module>s(	G-

Zerion Mini Shell 1.0