� c��jw � �" � d dl Z d dlZd dlZd dlZd dlZd dlZd dlZg d�ZdZej j d� rdZn ej � Z G d� de � Ze j d� � Zd � Zdd �Z dd�Zd� Zdd �Zedk( r e� yy)� N)�ZipAppError�create_archive�get_interpreterz8# -*- coding: utf-8 -*- import {module} {module}.{fn}() �win�utf-8c � � e Zd Zy)r N)�__name__� __module__�__qualname__� � �/usr/lib64/python3.12/zipapp.pyr r ! s � �r r c # � K � t | t t j f� rt | |� 5 }|�� d d d � y | �� y # 1 sw Y y xY w�w�N)� isinstance�str�os�PathLike�open)�archive�mode�fs r �_maybe_openr % sA � �� ��'�C����-�.� �'�4� �A��G� !� � � � !� �s �-A�A�A�A�Ac �b � |r-d|j t � z dz }| j |� yy)zWrite a shebang line.� #!� N)�encode�shebang_encoding�write)r �interpreter�shebangs r �_write_file_prefixr" . s1 � ���+�,�,�-=�>�>��F�� ����� r c �� � t | d� 5 }|j d� }|dk( rd}|j � t |d� 5 }t ||� |j |� t j ||� ddd� ddd� |rVt |t � rEt j |t j |� j t j z � yyy# 1 sw Y �jxY w# 1 sw Y �nxY w)z8Copy an application archive, modifying the shebang line.�rb� r r �wbN)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� � � �W�d� #�s� �(�(�1�+���e���G��L�L�N� ��d� +�s��s�K�0� �I�I�g�����s�C�(� ,� $�" �z�+�s�3� ����b�g�g�k�2�:�:�T�\�\�I�J� 4�{� ,� +�� $� #�s# �5C+�4C�6C+�C( �$C+�+C4c �H � d}t | d� rt | d� rd}n't j | � } | j � rd}|rt | ||� y| j � st d� �| dz j � }|r |rt d� �|s |st d � �d}|r�|j d � \ } } }t d� | j d� D � � }t d � |j d� D � � } | d k( r|r| st d|z � �t j | |�� }|�| j d� }n!t |d� st j |� }t |d� 5 }t ||� |rt j nt j" }t j$ |d|�� 5 }t' | j) d� � D ]> }|j+ | � }|� ||� s�|j- ||j/ � � �@ |r!|j1 d|j3 d� � ddd� ddd� |rHt |d� s;|j5 |j7 � j8 t6 j: z � yyy# 1 sw Y �\xY w# 1 sw Y �`xY w)ab Create 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. Fr' r( TNzSource does not existz__main__.pyz8Cannot specify entry point if the source has __main__.pyzArchive has no entry point�:c 3 �<