HEX
Server: LiteSpeed
System: Linux s787.bom1.mysecurecloudhost.com 4.18.0-477.13.1.lve.el8.x86_64 #1 SMP Thu Jun 1 16:40:47 EDT 2023 x86_64
User: mobilech (5348)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/distlib/__pycache__/scripts.cpython-310.pyc
o

;j�H�@sddlmZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZmZm
Z
ddlmZddlmZmZmZmZmZmZe�e�Zd��Ze�d	�Zd
Zejdkscejdkrwej dkrwe�!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�C/opt/saltstack/salt/lib/python3.10/site-packages/distlib/scripts.py�
<dictcomp>@s
��r�cCsZd|vr+|�d�r"|�dd�\}}d|vr |�d�s d||f}|S|�d�s+d|}|S)N� z
/usr/bin/env r�"z%s "%s"z"%s")�
startswith�split)�
executable�envZ_executablerrr�enquote_executableGs

�r!c@s�eZdZdZeZdZd*dd�Zdd�Ze	j
�d	�r!d
d�Zdd
�Z
dd�Zd+dd�Zdd�ZeZdd�Zdd�ZdZdd�Zd,dd�Zdd�Zed d!��Zejd"d!��Zejd#kscejd	krgejd#krgd$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|_tjdkptjdkotjdk|_t	d�|_
|p)t|�|_tjdkp9tjdko9tjdk|_
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_runZfileoprrr�__init__ds 
 zScriptMaker.__init__cCs@|�dd�r|jrtj�|�\}}|�dd�}tj�||�}|S)N�guiF�pythonZpythonw)�getr0r*�pathr�replace�join)r3r�options�dn�fnrrr�_get_alternate_executablers
z%ScriptMaker._get_alternate_executablerc	Csdzt|��}|�d�dkWd�WS1swYWdSttfy1t�d|�YdSw)zl
            Determine if the specified executable is a script
            (contains a #! line)
            �z#!NzFailed to open %sF)�open�read�OSError�IOError�logger�warning)r3r�fprrr�	_is_shell{s
(��zScriptMaker._is_shellcCsJ|�|�rddl}|jj�d�dkr|Sd|S|���d�r!|Sd|S)Nrzos.name�Linuxz
jython.exez/usr/bin/env %s)rHr�lang�System�getProperty�lowerr)r3rrrrr�_fix_jython_executable�s
�z"ScriptMaker._fix_jython_executablecCs�tjdkrd}n%ttdd�rd}nt|�t|�d}tjdkr#d}nd}d	|vo,||k}|r9d
||d}|Sd}|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�getattrr1�len�platform)r3r�post_interpZsimple_shebangZshebang_lengthZmax_shebang_length�resultrrr�_build_shebang�s 

�zScriptMaker._build_shebang�cCsnd}|jr|j}d}nDt��st�}n<t�r&tj�t�d�dt�	d��}n)tj
dkr;tj�t�	d�dt�	d��}ntj�t�	d�dt�	d	�t�	d�f�}|rW|�||�}tj
�d
�rb|�|�}|rht|�}|�d�}tj
dkr~d
|vr~d|vr~|d7}|�||�}z|�d�Wn
ty�td|��w|dkr�z|�|�W|Sty�td||f��w|S)NTF�scriptszpython%sZEXEr�BINDIRz
python%s%s�VERSIONr�utf-8Zcliz	-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))rrZis_python_buildrrr*r9r;Zget_path�get_config_varrr?r1rVrrNr!�encoderY�decode�UnicodeDecodeError�
ValueError)r3�encodingrWr<Zenquoter�shebangrrr�_get_shebang�sT 
��


����zScriptMaker._get_shebangcCs$|jt|j|j�d�d|jd�S)Nrr)�moduleZimport_name�func)�script_template�dict�prefix�suffixr)r3�entryrrr�_get_script_text�s�zScriptMaker._get_script_textcCstj�|�}|j|S�N)r*r9�basename�manifest)r3Zexename�baserrr�get_manifest�s
zScriptMaker.get_manifestcCs|jo|j}|s
||}nW|dkr|�d�}n|�d�}t�}t|d��.}	tj�d�}
|
rEt�	t
|
��dd�}td|d�}|	�||�n|	�d|�Wd�n1sUwY|�
�}
|||
}|D]�}tj�|j|�}|r�tj�|�\}}|�d�r�|}d	|}z	|j�||�Wnrty�t�d
�d|}tj�|�r�t�|�t�||�|j�||�t�d�zt�|�Wn	ty�YnwYn3w|jr�|�d
|�s�d||f}tj�|�r�|js�t�d|�qf|j�||�|j�r|j�|g�|� |�qfdS)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'r0�
_get_launcherrrr*�environr8�time�gmtime�intrZwritestr�getvaluer9r;r&�splitextrr/Zwrite_binary_file�	ExceptionrErF�exists�remove�rename�debugrr)r,�set_executable_mode�append)r3�namesreZscript_bytes�	filenames�extZuse_launcherZlauncher�stream�zfZsource_date_epochrzZzinfoZzip_datar�outname�n�eZdfnamerrr�
_write_scriptsh

��



����zScriptMaker._write_script�-cCsnt�}d|jvr
|�|�d|jvr|�d||jdf�d|jvr5|�d||j|jd|jdf�|S)Nr�Xz%s%srr$z	%s%s%s.%sr)r-r.�addr2�variant_separator)r3rrXrrr�get_script_filenames<s



$z ScriptMaker.get_script_filenamesc
Cs�d}|r|�dg�}|rdd�|�}|�d�}|jd||d�}|�|��d�}|�|j�}|r9|�dd�r9d	}	nd
}	|�|||||	�dS)NrZZinterpreter_argsz %srr^�r<r6F�pywrt)r8r;r`rfrnr�rr�)
r3rmr�r<rW�argsre�scriptZscriptnamesr�rrr�_make_scriptFs
zScriptMaker._make_scriptcCs�d}tj�|jt|��}tj�|jtj�|��}|js*|j�	||�s*t
�d|�dSzt|d�}Wnt
y@|js<�d}Yn#w|��}|sOt
�d|�dSt�|�dd��}|rcd}|�d�pbd	}|s�|rk|��|j�||�|jr||j�|g�|�|�dSt
�d
||j�|jjs�t|j�\}	}
|�d�|�|	|�}d|vr�d
}nd}tj�|�}
|�|
g||��||�|r�|��dSdS)NFznot copying %s (up-to-date)�rbz%s is an empty file (skipping)s
rSTrrZzcopying and adjusting %s -> %srspythonwr�rt) r*r9r;r%rr&rpr(r/ZnewerrEr�rArDr4�readlinerF�
FIRST_LINE_RE�matchr:�group�closeZ	copy_filer,r�r��infor�seekrfr�rB)r3r�r�Zadjustr��f�
first_liner�rWrd�linesrer�r�rrr�_copy_scriptVsR�
�zScriptMaker._copy_scriptcCs|jjSro�r/r4)r3rrrr4�szScriptMaker.dry_runcCs||j_dSror�)r3�valuerrrr4�srcCs\t�d�dkr
d}nd}t�dkrdnd}d|||f}|tvr*d	|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_PACKAGErc)r3�kind�bitsZplatform_suffixr�msgrrrr{�s�zScriptMaker._get_launchercCs8g}t|�}|dur|�||�|S|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�)r3�
specificationr<r�rmrrr�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�)r3Zspecificationsr<r�r�rrr�
make_multiple�szScriptMaker.make_multiple)TFN)rZNro)"�__name__�
__module__�__qualname__�__doc__�SCRIPT_TEMPLATErirr5r?r1rVrrHrNrYrfrn�_DEFAULT_MANIFESTrqrsr�r�r�r�r��propertyr4�setterr*rr+r{r�r�rrrrr"[s6

$B7

2


r"))�ior�loggingr*�rer�r1r}�zipfiler�compatrrrZ	resourcesr�utilr	r
rrr
r�	getLoggerr�rE�stripr��compiler�r�rr+�rsplitr��iteratorr�r!Z_enquote_executable�objectr"rrrr�<module>s2 
�
�