HEX
Server: LiteSpeed
System: Linux vearitale.com 5.14.0-570.32.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Aug 6 11:30:41 EDT 2025 x86_64
User: yunab9059 (2007)
PHP: 8.3.21
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.9/site-packages/distlib/__pycache__/scripts.cpython-39.pyc
a

��h�H�@sddlmZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZmZm
Z
ddlmZddlmZmZmZmZmZmZe�e�Zd��Ze�d	�Zd
Zejdks�ejdkr�ej dkr�e�!d
d�dZ"dd�ee"��#d�D�Z$dd�Z%e%Z&Gdd�de'�Z(dS)�)�BytesION)�ZipInfo�)�	sysconfig�detect_encoding�ZipFile)�finder)�FileOperator�get_export_entry�convert_path�get_executable�get_platform�in_venva�
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
 <assemblyIdentity version="1.0.0.0"
 processorArchitecture="X86"
 name="%s"
 type="win32"/>

 <!-- Identify the application security requirements. -->
 <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
 <security>
 <requestedPrivileges>
 <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
 </requestedPrivileges>
 </security>
 </trustInfo>
</assembly>s^#!.*pythonw?[0-9.]*([ 	].*)?$z�# -*- coding: utf-8 -*-
import re
import sys
if __name__ == '__main__':
    from %(module)s import %(import_name)s
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    sys.exit(%(func)s())
�nt�java�.cCs"i|]}|j�d�r|j|j�qS)z.exe)�name�endswith�bytes)�.0�r�r�9/usr/local/lib/python3.9/site-packages/distlib/scripts.py�
<dictcomp>@s�r�cCsXd|vrT|�d�rB|�dd�\}}d|vrT|�d�sTd||f}n|�d�sTd|}|S)N� z
/usr/bin/env r�"z%s "%s"z"%s")�
startswith�split)�
executable�env�_executablerrr�enquote_executableGs

r"c@s�eZdZdZeZdZd*dd�Zdd�Ze	j
�d	�rBd
d�Zdd
�Z
dd�Zd+dd�Zdd�ZeZdd�Zdd�ZdZdd�Zd,dd�Zdd�Zed d!��Zejd"d!��Zejd#ks�ejd	kr�ejd#kr�d$d%�Zd-d&d'�Z d.d(d)�Z!dS)/�ScriptMakerz_
    A class to copy or create scripts from source scripts or callable
    specifications.
    NTFcCs�||_||_||_d|_d|_tjdkp:tjdko:tjdk|_t	d�|_
|pRt|�|_tjdkprtjdkortjdk|_
tj|_dS)NF�posixr)r�X.Yr)�
source_dir�
target_dir�
add_launchers�force�clobber�osr�_name�set_mode�set�variantsr	�_fileop�_is_nt�sys�version_info)�selfr&r'r(�dry_run�fileoprrr�__init__ds 
 zScriptMaker.__init__cCs@|�dd�r<|jr<tj�|�\}}|�dd�}tj�||�}|S)N�guiF�python�pythonw)�getr1r+�pathr�replace�join)r4r�options�dn�fnrrr�_get_alternate_executablers
z%ScriptMaker._get_alternate_executablerc	Csfz<t|�� }|�d�dkWd�WS1s00YWn$ttfy`t�d|�YdS0dS)zl
            Determine if the specified executable is a script
            (contains a #! line)
            �z#!NzFailed to open %sF)�open�read�OSError�IOError�logger�warning)r4r�fprrr�	_is_shell{s
2zScriptMaker._is_shellcCsD|�|�r*ddl}|jj�d�dkr<|Sn|���d�r<|Sd|S)Nrzos.name�Linuxz
jython.exez/usr/bin/env %s)rKr�lang�System�getProperty�lowerr)r4rrrrr�_fix_jython_executable�s
z"ScriptMaker._fix_jython_executablecCs�tjdkrd}nJttdd�r"d}n8t|�t|�d}tjdkrFd}nd}d	|voX||k}|rpd
||d}n d}|d
||d7}|d7}|S)a
        Build a shebang line. In the simple case (on Windows, or a shebang line
        which is not too long or contains spaces) use a simple formulation for
        the shebang. Otherwise, use /bin/sh as the executable, with a contrived
        shebang which allows the script to run either under Python or sh, using
        suitable quoting. Thanks to Harald Nordgren for his input.

        See also: http://www.in-ulm.de/~mascheck/various/shebang/#length
                  https://hg.mozilla.org/mozilla-central/file/tip/mach
        r$TZcross_compilingF��darwini�� s#!�
s
#!/bin/sh
s	'''exec' s "$0" "$@"
s' '''
)r+r�getattrr2�len�platform)r4r�post_interp�simple_shebang�shebang_length�max_shebang_length�resultrrr�_build_shebang�s

zScriptMaker._build_shebang�cCszd}|jr|j}d}n�t��s&t�}nxt�rLtj�t�d�dt�	d��}nRtj
dkrvtj�t�	d�dt�	d��}n(tj�t�	d�dt�	d	�t�	d�f�}|r�|�||�}tj
�d
�r�|�|�}|r�t|�}|�d�}tj
dkr�d
|vr�d|vr�|d7}|�||�}z|�d�Wn t�y6td|��Yn0|dk�rvz|�|�Wn$t�yttd||f��Yn0|S)NTF�scriptszpython%s�EXEr�BINDIRz
python%s%s�VERSIONr�utf-8�cliz	-X:Framesz
-X:FullFramess
 -X:Framesz,The shebang (%r) is not decodable from utf-8z?The shebang (%r) is not decodable from the script encoding (%r))rr�is_python_buildrrr+r<r>�get_path�get_config_varrrBr2rYrrQr"�encoder_�decode�UnicodeDecodeError�
ValueError)r4�encodingrZr?�enquoter�shebangrrr�_get_shebang�sP 
��


�
�zScriptMaker._get_shebangcCs$|jt|j|j�d�d|jd�S)Nrr)�module�import_name�func)�script_template�dict�prefix�suffixr)r4�entryrrr�_get_script_text�s�zScriptMaker._get_script_textcCstj�|�}|j|S�N)r+r<�basename�manifest)r4�exename�baserrr�get_manifest�szScriptMaker.get_manifestcCs(|jo
|j}|s||}n�|dkr.|�d�}n
|�d�}t�}t|d��\}	tj�d�}
|
r�t�	t
|
��dd�}td|d�}|	�||�n|	�d|�Wd�n1s�0Y|�
�}
|||
}|D�]T}tj�|j|�}|�r�tj�|�\}}|�d��r|}d	|}z|j�||�Wn�t�y�t�d
�d|}tj�|��r\t�|�t�||�|j�||�t�d�zt�|�Wnt�y�Yn0Yn0nl|j�r�|�d
|��s�d||f}tj�|��r�|j�s�t�d|�q�|j�||�|j�r|j�|g�|� |�q�dS)N�py�t�w�SOURCE_DATE_EPOCH�z__main__.py)�filename�	date_timez.pyz%s.exez:Failed to write executable - trying to use .deleteme logicz%s.deletemez0Able to replace executable using .deleteme logicrz%s.%szSkipping existing file %s)!r(r1�
_get_launcherrrr+�environr;�time�gmtime�intr�writestr�getvaluer<r>r'�splitextrr0�write_binary_file�	ExceptionrHrI�exists�remove�rename�debugrr*r-�set_executable_mode�append)r4�namesrp�script_bytes�	filenames�ext�use_launcher�launcher�stream�zfZsource_date_epochr��zinfo�zip_datar�outname�n�e�dfnamerrr�
_write_scripts\

*



zScriptMaker._write_script�-cCsnt�}d|jvr|�|�d|jvr<|�d||jdf�d|jvrj|�d||j|jd|jdf�|S)Nr�Xz%s%srr%z	%s%s%s.%sr)r.r/�addr3�variant_separator)r4rr^rrr�get_script_filenames<s



$z ScriptMaker.get_script_filenamesc
Cs�d}|r0|�dg�}|r0dd�|�}|�d�}|jd||d�}|�|��d�}|�|j�}|rr|�dd�rrd	}	nd
}	|�|||||	�dS)Nr`�interpreter_argsz %srre�r?r8F�pywr�)r;r>rjrqrzr�rr�)
r4ryr�r?rZ�argsrp�script�scriptnamesr�rrr�_make_scriptFs
zScriptMaker._make_scriptcCs�d}tj�|jt|��}tj�|jtj�|��}|jsT|j�	||�sTt
�d|�dSzt|d�}Wnt
y�|jsx�d}YnF0|��}|s�t
�d|�dSt�|�dd��}|r�d}|�d�p�d	}|�s|r�|��|j�||�|jr�|j�|g�|�|�n�t
�d
||j�|jj�s|t|j�\}	}
|�d�|�|	|�}d|v�rTd
}nd}tj�|�}
|�|
g||��||�|�r�|��dS)NFznot copying %s (up-to-date)�rbz%s is an empty file (skipping)s
rVTrr`zcopying and adjusting %s -> %srspythonwr�r�) r+r<r>r&rr'r|r)r0�newerrHr�rDrGr5�readlinerI�
FIRST_LINE_RE�matchr=�group�close�	copy_filer-r�r��infor�seekrqr�rE)r4r�r��adjustr��f�
first_liner�rZrn�linesrpr�r�rrr�_copy_scriptVsN



zScriptMaker._copy_scriptcCs|jjSr{�r0r5)r4rrrr5�szScriptMaker.dry_runcCs||j_dSr{r�)r4�valuerrrr5�srcCs\t�d�dkrd}nd}t�dkr&dnd}d|||f}|tvrTd	|tf}t|��t|S)
N�P�Z64Z32z	win-arm64z-armrz
%s%s%s.exez(Unable to find resource %s in package %s)�struct�calcsizer
�WRAPPERS�DISTLIB_PACKAGErm)r4�kind�bitsZplatform_suffixr�msgrrrr��s�zScriptMaker._get_launchercCs6g}t|�}|dur"|�||�n|j|||d�|S)a�
        Make a script.

        :param specification: The specification, which is either a valid export
                              entry specification (to make a script from a
                              callable) or a filename (to make a script by
                              copying from a source location).
        :param options: A dictionary of options controlling script generation.
        :return: A list of all absolute pathnames written to.
        Nr�)r
r�r�)r4�
specificationr?r�ryrrr�make�szScriptMaker.makecCs$g}|D]}|�|�||��q|S)z�
        Take a list of specifications and make scripts from them,
        :param specifications: A list of specifications.
        :return: A list of all absolute pathnames written to,
        )�extendr�)r4�specificationsr?r�r�rrr�
make_multiple�szScriptMaker.make_multiple)TFN)r`N)N)N)N)"�__name__�
__module__�__qualname__�__doc__�SCRIPT_TEMPLATErurr7rBr2rYrrKrQr_rqrz�_DEFAULT_MANIFESTr}r�r�r�r�r�r��propertyr5�setterr+rr,r�r�r�rrrrr#[s4
$
B7

2


r#))�ior�loggingr+�rer�r2r��zipfiler�compatrrr�	resourcesr�utilr	r
rrr
r�	getLoggerr�rH�stripr��compiler�r�rr,�rsplitr��iteratorr�r"�_enquote_executable�objectr#rrrr�<module>s, 

�