HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/setuptools/__pycache__/_scripts.cpython-310.pyc
o

��h�+�@s:ddlmZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZddlm
Z
mZddlmZmZe
rDddlmZddlmZdd	lmZdd
lmZGdd�ded
d�ZGdd�de�ZGdd�de�ZGdd�d�ZGdd�de�ZGdd�de�Z dd�Z!dd�Z"dd�Z#dd �Z$d!d"�Z%dS)#�)�annotationsN)�Iterable)�
TYPE_CHECKING�	TypedDict�)�metadata�	resources)�Self)�SetuptoolsWarning)�
first_line_re)�get_platformc@seZdZUded<ded<dS)�
_SplitArgs�bool�comments�posixN)�__name__�
__module__�__qualname__�__annotations__�rr�>/usr/local/lib/python3.10/dist-packages/setuptools/_scripts.pyr
s
r
F)�totalc@s�eZdZUdZgZded<e�Zedd��Z	edd��Z
ed dd
��Zedd��Zed!dd��Z
d"dd�Zedd��Zdd�Zedd��Zedd��ZdS)#�CommandSpeczm
    A command spec for a #! header, specified as a list of arguments akin to
    those passed to Popen.
    z	list[str]�optionscCs|S)zV
        Choose the best CommandSpec class based on environmental conditions.
        r��clsrrr�best'szCommandSpec.bestcCstj�tj�}tj�d|�S)N�__PYVENV_LAUNCHER__)�os�path�normpath�sys�
executable�environ�get)r�_defaultrrr�_sys_executable.szCommandSpec._sys_executable�param�!Self | str | Iterable[str] | None�returnr	cCsVt||�r|St|t�r|�|�St|t�r||�S|dur"|��Stdt|�����)zg
        Construct a CommandSpec from a parameter to build_scripts, which may
        be None.
        Nz!Argument has an unsupported type )�
isinstance�str�from_stringr�from_environment�	TypeError�type)rr'rrr�
from_param3s



zCommandSpec.from_paramcCs||��g�S�N)r&rrrrr-CszCommandSpec.from_environment�stringr+cCstj|fi|j��}||�S)z}
        Construct a command spec from a simple string representing a command
        line parseable by shlex.split.
        )�shlex�split�
split_args)rr2�itemsrrrr,GszCommandSpec.from_string�script_textcCs<t�|�|��|_t�|�}t|�sdg|jdd�<dSdS)Nz-xr)r3r4�_extract_optionsr�
subprocess�list2cmdline�isascii)�selfr7�cmdlinerrr�install_optionsPs

�zCommandSpec.install_optionscCs:|d��d}t��|�}|r|�d�pdnd}|��S)zH
        Extract any options from the first line of the script.
        �
rr�)�
splitlines�_first_line_re�match�group�strip)�orig_script�firstrCrrrrr8Vs�zCommandSpec._extract_optionscCs|�|t|j��Sr1)�_render�listr)r<rrr�	as_header`szCommandSpec.as_headercCs6d}|D]}|�|�r|�|�r|dd�Sq|S)Nz"'r���)�
startswith�endswith)�item�_QUOTES�qrrr�
_strip_quotescs�zCommandSpec._strip_quotescCs t�dd�|D��}d|dS)Ncss�|]
}t�|���VqdSr1)rrQrE)�.0rNrrr�	<genexpr>ms�
�z&CommandSpec._render.<locals>.<genexpr>z#!r?)r9r:)r6r=rrrrHks
�zCommandSpec._renderN)r'r(r)r	)r2r+r)r	)r7r+)rrr�__doc__rrr
r5�classmethodrr&r0r-r,r>�staticmethodr8rJrQrHrrrrrs,





	
rc@seZdZedd�ZdS)�WindowsCommandSpecF)rN)rrrr
r5rrrrrWssrWc@sheZdZdZe�d���ZeZ	e
ddd��Zedd��Z
e
dd	��Ze
d
d��Ze
		dddd��ZdS)�ScriptWriterz`
    Encapsulates behavior around writing entry point scripts for console and
    gui apps.
    aJ
        # EASY-INSTALL-ENTRY-SCRIPT: %(spec)r,%(group)r,%(name)r
        import re
        import sys

        # for compatibility with easy_install; see #2198
        __requires__ = %(spec)r

        try:
            from importlib.metadata import distribution
        except ImportError:
            try:
                from importlib_metadata import distribution
            except ImportError:
                from pkg_resources import load_entry_point


        def importlib_load_entry_point(spec, group, name):
            dist_name, _, _ = spec.partition('==')
            matches = (
                entry_point
                for entry_point in distribution(dist_name).entry_points
                if entry_point.group == group and entry_point.name == name
            )
            return next(matches).load()


        globals().setdefault('load_entry_point', importlib_load_entry_point)


        if __name__ == '__main__':
            sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
            sys.exit(load_entry_point(%(spec)r, %(group)r, %(name)r)())
        Nc
cs��t|d�st�d�tj�|j�}|dur|��}|j�d|j	��}dD].}|�d�}|j
j|d�D]}|j}|�|j�|j
t�}|�||j||�}	|	EdHq3q%dS)z�
        Yield write_script() argument tuples for a distribution's
        console_scripts and gui_scripts entry points.
        �entry_pointsz%Unsupported distribution encountered.Nz==��console�gui�_scripts)rD)�hasattrr
�emitr�Distribution�at�egg_info�
get_header�name�versionrY�select�_ensure_safe_name�template�locals�_get_script_args)
r�dist�header�spec�type_rD�eprdr7�argsrrr�get_args�s"�
	

��zScriptWriter.get_argscCst�d|�}|rtd��dS)z?
        Prevent paths in *_scripts entry point names.
        z[\\/]z+Path separators not allowed in script namesN)�re�search�
ValueError)rd�has_path_seprrrrg�s�zScriptWriter._ensure_safe_namecCs*tjdkstjdkrtjdkrt��S|S)zD
        Select the best ScriptWriter for this environment.
        �win32�java�nt)r!�platformrrd�_name�WindowsScriptWriterrrrrrr�szScriptWriter.bestccs�|||fVdSr1r)rrnrdrlr7rrrrj�s�zScriptWriter._get_script_argsr@r7r+r"�(str | CommandSpec | Iterable[str] | Noner)cCs"|j���|�}|�|�|��S)z;Create a #! line, getting options (if any) from script_text)�command_spec_classrr0r>rJ)rr7r"�cmdrrrrc�s
zScriptWriter.get_headerr1)r@N)r7r+r"r|r)r+)rrrrT�textwrap�dedent�lstriprhrr}rUrqrVrgrrjrcrrrrrXws(�#�%

	
�rXc@s@eZdZeZedd��Zedd��Zedd��Ze	dd��Z
d	S)
r{cCs"tt|d�}tj�dd�}||S)zC
        Select the best ScriptWriter suitable for Windows
        )r"�natural�SETUPTOOLS_LAUNCHERr")�dict�WindowsExecutableLauncherWriterrr#r$)r�
writer_lookup�launcherrrrr�s�zWindowsScriptWriter.bestc	#s��tddd�|}|tjd���d�vr#djdit���}t�|�gd�}|�	|�|�
||�}�fdd	�|D�}�|||d
|fVdS)
z For Windows, add a .py extension�.pya�.pywrZ�PATHEXT�;zK{ext} not listed in PATHEXT; scripts will not be recognized as executables.)r��.py�
-script.py�.pyc�.pyor��.exec�g|]}�|�qSrr�rR�x�rdrr�
<listcomp>��z8WindowsScriptWriter._get_script_args.<locals>.<listcomp>�tNr)r�rr#�lowerr4�formatrir
r_�remove�_adjust_header)	rrnrdrlr7�ext�msg�old�blockersrr�rrj�s���

z$WindowsScriptWriter._get_script_argscCsNd}d}|dkr
||}}t�t�|�tj�}|j||d�}|�|�r%|S|S)z�
        Make sure 'pythonw' is used for gui and 'python' is used for
        console (regardless of what sys.executable is).
        zpythonw.exez
python.exer\)r2�repl)rr�compile�escape�
IGNORECASE�sub�_use_header)rrn�orig_header�patternr��
pattern_ob�
new_headerrrrr�s
z"WindowsScriptWriter._adjust_headercCs&|dd��d�}tjdkpt�|�S)z�
        Should _adjust_header use the replaced header?

        On non-windows systems, always use. On
        Windows systems, only use the replaced header if it resolves
        to an executable on the system.
        �rK�"rv)rEr!ry�shutil�which)r��clean_headerrrrr�s	zWindowsScriptWriter._use_headerN)rrrrWr}rUrrjr�rVr�rrrrr{�s



r{c@seZdZedd��ZdS)r�c#s��|dkr
d}d}dg}nd}d}gd�}|�||�}�fdd�|D�}	�|||d	|	fV�d
t|�dfVt�sJ�d}
|
t��d	fVd
Sd
S)zG
        For Windows, add a .py extension and an .exe launcher
        r\z-script.pywr��clir�)r�r�r�cr�rrr�r�rrr�+r�zDWindowsExecutableLauncherWriter._get_script_args.<locals>.<listcomp>r�r��bz
.exe.manifestN)r��get_win_launcher�is_64bit�load_launcher_manifest)rrnrdrlr7�
launcher_typer�r��hdrr��m_namerr�rrjs&���z0WindowsExecutableLauncherWriter._get_script_argsN)rrrrUrjrrrrr�sr�cCsV|�d�}t�rt�dkr|�dd�}n
|�dd�}n|�dd�}t�d��|���S)z�
    Load the Windows launcher (executable) suitable for launching a script.

    `type` should be either 'cli' or 'gui'

    Returns the executable as a byte string.
    r�z	win-arm64�.z-arm64.z-64.z-32.�
setuptools)r�r�replacer�files�joinpath�
read_bytes)r/�launcher_fnrrrr�<s

r�cCs"t�t��d�}|jdd�t�S)Nzlauncher manifest.xmlzutf-8)�encoding)rr�rr��	read_text�vars)rd�resrrrr�Osr�cCs ttjt�rtSt�tj���S)z_
    Return a regular expression based on first_line_re suitable for matching
    strings.
    )r*rr�r+rrr��decoderrrrrBTsrBcCst�d�dkS)N�P�)�struct�calcsizerrrrr�`sr�cCs&z|�d�WdStyYdSw)N�asciiFT)�encode�UnicodeError)�srrrr;ds��r;)&�
__future__rrrrr3r�r�r9r!r�collections.abcr�typingrr�
_importlibrr�typing_extensionsr	�warningsr
�distutils.command.build_scriptsr�distutils.utilrr
rIrrWrXr{r�r�r�rBr�r;rrrr�<module>s8Uj;