<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"
        integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
        crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
</html>
3
Pfx;                 @   s   d dl mZ d dlZd dlZd dlZd dlZd dlZddlmZm	Z	m
Z
 ddlmZ ddlmZmZmZmZmZ ejeZdj ZejdZd	Zd
d ZG dd deZdS )    )BytesION   )	sysconfigdetect_encodingZipFile)finder)FileOperatorget_export_entryconvert_pathget_executable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.]*([ 	].*)?$a|  # -*- coding: utf-8 -*-
if __name__ == '__main__':
    import sys, re

    def _resolve(module, func):
        __import__(module)
        mod = sys.modules[module]
        parts = func.split('.')
        result = getattr(mod, parts.pop(0))
        for p in parts:
            result = getattr(result, p)
        return result

    try:
        sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])

        func = _resolve('%(module)s', '%(func)s')
        rc = func() # None interpreted as 0
    except Exception as e:  # only supporting Python >= 2.6
        sys.stderr.write('%%s\n' %% e)
        rc = 1
    sys.exit(rc)
c             C   sZ   d| krV| j drD| jdd\}}d|krV|j d rVd||f } n| j dsVd|  } | S )N z/usr/bin/env r   "z%s "%s"z"%s")
startswithsplit)
executableenvZ_executable r   /usr/lib/python3.6/scripts.py_enquote_executableB   s    

r   c               @   s   e Zd ZdZeZdZd%ddZdd Ze	j
jd	rBd
d Zdd Zd&ddZdd ZeZdd Zdd Zd'ddZdd Zedd Zejdd Zejdksejd	krejdkrdd  Zd(d!d"Zd)d#d$ZdS )*ScriptMakerz_
    A class to copy or create scripts from source scripts or callable
    specifications.
    NTFc             C   sz   || _ || _|| _d| _d| _tjdkp:tjdko:tjdk| _t	d| _
|pRt|| _tjdkprtjdkortjdk| _d S )NFposixjava X.Ynt)r   r   )
source_dir
target_diradd_launchersforceclobberosname_nameset_modesetvariantsr   _fileop_is_nt)selfr   r   r   dry_runZfileopr   r   r   __init__[   s    

zScriptMaker.__init__c             C   s@   |j ddr<| jr<tjj|\}}|jdd}tjj||}|S )NguiFpythonZpythonw)getr(   r!   pathr   replacejoin)r)   r   optionsZdnfnr   r   r   _get_alternate_executablek   s
    z%ScriptMaker._get_alternate_executabler   c             C   sL   y"t |}|jddkS Q R X W n$ ttfk
rF   tjd| dS X dS )zl
            Determine if the specified executable is a script
            (contains a #! line)
               z#!NzFailed to open %sF)openreadOSErrorIOErrorloggerwarning)r)   r   fpr   r   r   	_is_shells   s    
zScriptMaker._is_shellc             C   sD   | j |r*dd l}|jjjddkr<|S n|j jdr<|S d| S )Nr   zos.nameZLinuxz
jython.exez/usr/bin/env %s)r=   r   ZlangZSystemZgetPropertylowerendswith)r)   r   r   r   r   r   _fix_jython_executable   s    
z"ScriptMaker._fix_jython_executable    c             C   sd  d}| j r| j }d}n^tj s&t }nNt rLtjjtjddtj	d }n(tjjtj	ddtj	dtj	df }|r| j
||}tjjd	r| j|}tjj|}|rt|}|jd
}tjdkrd|krd|kr|d7 }d| | d }y|jd
 W n" tk
r   td| Y nX |d
kr`y|j| W n& tk
r^   td||f Y nX |S )NTFscriptszpython%sEXEBINDIRz
python%s%sVERSIONr   zutf-8Zcliz	-X:Framesz-X:FullFramess
    -X:Framess   #!   
z,The shebang (%r) is not decodable from utf-8z?The shebang (%r) is not decodable from the script encoding (%r))r   r   is_python_buildr   r   r!   r/   r1   get_pathget_config_varr4   sysplatformr   r@   normcaser   encodedecodeUnicodeDecodeError
ValueError)r)   encodingpost_interpr2   Zenquoter   shebangr   r   r   _get_shebang   sL    



zScriptMaker._get_shebangc             C   s   | j t|j|jd S )N)modulefunc)script_templatedictprefixsuffix)r)   entryr   r   r   _get_script_text   s    
zScriptMaker._get_script_textc             C   s   t jj|}| j| S )N)r!   r/   basenamemanifest)r)   Zexenamebaser   r   r   get_manifest   s    zScriptMaker.get_manifestc             C   s  | j o
| j}tjjd}|s*|| | }n^|dkr>| jd}n
| jd}t }	t|	d}
|
jd| W d Q R X |	j	 }|| | | }xd|D ]Z}tj
j| j|}|rrtj
j|\}}|jdr|}d| }y| jj|| W n tk
rn   tjd d	| }tj
j|r tj| tj|| | jj|| tjd
 ytj| W n tk
rh   Y nX Y nX np| jr|jd|  rd||f }tj
j|r| j rtjd| q| jj|| | jr| jj|g |j| qW d S )Nzutf-8pytwz__main__.pyz.pyz%s.exez:Failed to write executable - trying to use .deleteme logicz%s.deletemez0Able to replace executable using .deleteme logic.z%s.%szSkipping existing file %s)r   r(   r!   lineseprM   _get_launcherr   r   Zwritestrgetvaluer/   r1   r   splitextr   r'   Zwrite_binary_file	Exceptionr:   r;   existsremoverenamedebugr?   r    r$   set_executable_modeappend)r)   namesrS   Zscript_bytes	filenamesextZuse_launcherre   ZlauncherstreamZzfZzip_datar"   outnameneZdfnamer   r   r   _write_script   sT    




zScriptMaker._write_scriptc             C   s   d}|r0|j dg }|r0ddj| }|jd}| jd||d}| j|jd}|j}t }	d| jkrp|	j| d| jkr|	jd	|t	j
d
 f  d| jkr|	jd|t	j
d d f  |r|j ddrd}
nd}
| j|	||||
 d S )NrA   Zinterpreter_argsz %sr   zutf-8)r2   r   Xz%s%sr   zX.Yz%s-%s   r,   Fpywra   )r.   r1   rM   rT   r\   r"   r%   r&   addrJ   versionrw   )r)   r[   rq   r2   rR   argsrS   scriptr"   Zscriptnamesrr   r   r   r   _make_script   s(    




zScriptMaker._make_scriptc             C   s  d}t jj| jt|}t jj| jt jj|}| j rX| jj	|| rXt
jd| d S yt|d}W n  tk
r   | js~ d }Y nLX |j }|st
jd| j | d S tj|jdd}|rd}|jdpd	}|s|r|j  | jj|| | jr| jj|g |j| nt
jd
|| j | jjst|j\}	}
|jd | j|	|}d|krbd}nd}t jj|}| j|g||j  || |r|j  d S )NFznot copying %s (up-to-date)rbz"%s: %s is an empty file (skipping)s   
rF   Tr   rA   zcopying and adjusting %s -> %sr   s   pythonwrz   ra   )!r!   r/   r1   r   r
   r   r]   r   r'   Znewerr:   rm   r6   r9   r*   readliner;   Zget_command_nameFIRST_LINE_REmatchr0   groupcloseZ	copy_filer$   rn   ro   infor   seekrT   rw   r7   )r)   r~   rq   Zadjustrt   fZ
first_liner   rR   rQ   linesrS   rr   ru   r   r   r   _copy_script  sR    



zScriptMaker._copy_scriptc             C   s   | j jS )N)r'   r*   )r)   r   r   r   r*   J  s    zScriptMaker.dry_runc             C   s   || j _d S )N)r'   r*   )r)   valuer   r   r   r*   N  s    r   c             C   sH   t jddkrd}nd}d||f }tjddd }t|j|j}|S )	NP   Z64Z32z%s%s.exerd   r   r   )structcalcsize__name__rsplitr   findbytes)r)   Zkindbitsr"   Zdistlib_packageresultr   r   r   rf   V  s    zScriptMaker._get_launcherc             C   s6   g }t |}|dkr"| j|| 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.
        N)r2   )r	   r   r   )r)   specificationr2   rq   r[   r   r   r   maked  s    zScriptMaker.makec             C   s(   g }x|D ]}|j | j|| q
W |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   )r)   Zspecificationsr2   rq   r   r   r   r   make_multiplew  s    
zScriptMaker.make_multiple)TFN)rA   N)N)N)N)r   
__module____qualname____doc__SCRIPT_TEMPLATErW   r   r+   r4   rJ   rK   r   r=   r@   rT   r\   _DEFAULT_MANIFESTr^   r`   rw   r   r   propertyr*   setterr!   r"   r#   rf   r   r   r   r   r   r   r   R   s,    

82
4
r   )ior   Zloggingr!   rer   rJ   compatr   r   r   Z	resourcesr   utilr   r	   r
   r   r   Z	getLoggerr   r:   stripr   compiler   r   r   objectr   r   r   r   r   <module>   s   

