<!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
Ii<                 @   sp   d Z ddlZddlZddlmZ ddlmZ ddlmZm	Z	 ddl
T ddlmZ ddlmZ G d	d
 d
eZdS )zzdistutils.command.bdist_wininst

Implements the Distutils 'bdist_wininst' command: create a windows installer
exe-program.    N)Command)get_platform)create_treeremove_tree)*)get_python_version)logc               @   s   e Zd ZdZd5ddde  fd7d9d:d;d<d=d>d?d@dAdBgZddddgZejd&kZ	d'd( Z
d)d* Zd+d, Zd-d. ZdCd/d0Zd1d2 Zd3d4 ZdS )Dbdist_wininstz-create an executable installer for MS Windows
bdist-dir=N1temporary directory for creating the distributionz
plat-name=pz;platform name to embed in generated filenames (default: %s)	keep-tempkz/keep the pseudo-installation tree around after z!creating the distribution archivetarget-version=z!require a specific python versionz on the target systemno-target-compilec/do not compile .py to .pyc on the target systemno-target-optimizeo;do not compile .py to .pyo (optimized) on the target system	dist-dir=d-directory to put final built distributions inbitmap=b>bitmap to use for the installer instead of python-powered logotitle=t?title to display on the installer background instead of default
skip-build2skip rebuilding everything (for testing/debugging)install-script=Ubasename of installation script to be run after installation or before deinstallationpre-install-script={Fully qualified filename of a script to be run before any files are installed.  This script need not be in the distributionuser-access-control=specify Vista's UAC handling - 'none'/default=no handling, 'auto'=use UAC if target Python installed for all users, 'force'=always use UACwin32c             C   sR   d | _ d | _d| _d| _d| _d | _d | _d | _d | _d | _	d | _
d | _d | _d S )Nr   )	bdist_dir	plat_name	keep_tempno_target_compileno_target_optimizetarget_versiondist_dirbitmaptitle
skip_buildinstall_scriptpre_install_scriptuser_access_control)self r6   7/usr/lib64/python3.6/distutils/command/bdist_wininst.pyinitialize_options=   s    z bdist_wininst.initialize_optionsc             C   s   | j dd	 | jd krR| jr6| jr6| jjd}| j|_| jdj}tj	j
|d| _| js^d| _| j r| jj rt }| jr| j|krtd|f || _| j dd
d | jrx2| jjD ]}| jtj	j|krP qW td| j d S )Nbdistr1   Zwininst zMtarget version can only be %s, or the '--skip-build' option must be specifiedr.   r)   z(install_script '%s' not found in scripts)r1   r1   )r.   r.   )r)   r)   )Zset_undefined_optionsr(   r1   r)   distributionZget_command_objget_finalized_command
bdist_baseospathjoinr-   has_ext_modulesr   ZDistutilsOptionErrorr2   scriptsbasename)r5   r9   r=   Zshort_versionscriptr6   r6   r7   finalize_optionsM   s4    

zbdist_wininst.finalize_optionsc             C   s  t jdkr&| jj s| jj r&td| js6| jd | jddd}| j	|_
| j|_d|_| j|_| jd}d|_d|_| jj r| j}|sd	t jd d
  }d| j|f }| jd}tjj|jd| |_x4dD ],}|j }|dkr|d }t|d| | qW tjd| j	 |j  t jjdtjj| j	d |j  t jd= ddlm} | }	| jj  }
| j!|	d| j	d}| j"||
| j# | jj rt$ }nd}| jj%j&d|| j'|
f tj(d| tj)| | j*st+| j	| j,d d S )Nr'   z^distribution contains extensions and/or C libraries; must be compiled on a Windows 32 platformbuildinstall   )Zreinit_subcommandsr   install_libz%d.%d   z.%s-%slibpurelibplatlibheadersrB   dataz/Include/$dist_nameZinstall_zinstalling to %sZPURELIB)mktempzip)Zroot_diranyr	   zremoving temporary file '%s')dry_run)rL   rM   rN   rB   rO   )-sysplatformr;   rA   Zhas_c_librariesZDistutilsPlatformErrorr1   Zrun_commandZreinitialize_commandr(   rootZwarn_dirr)   compileoptimizer-   version_infor<   r>   r?   r@   Z
build_baseZ	build_libuppersetattrr   infoZensure_finalizedinsertrunZtempfilerP   get_fullnameZmake_archive
create_exer/   r   Z
dist_filesappendget_installer_filenamedebugremover*   r   rS   )r5   rG   rI   r-   Zplat_specifierrF   keyvaluerP   Zarchive_basenamefullnamearcnameZ	pyversionr6   r6   r7   r^   s   sd    












zbdist_wininst.runc             C   s`  g }| j j}|jd |jpdd }dd }xJdD ]B}t||d}|r2|d|j ||f  }|jd|||f  q2W |jd | jr|jd| j  |jd||  |jd| j   |jd| j   | j	r|jd| j	  | j
 r|jd| j
  | jp| j j }|jd||  dd l}dd l}	d|j|j |	jf }
|jd|
  dj|S )Nz
[metadata]r:   
c             S   s   | j ddS )Nri   z\n)replace)sr6   r6   r7   escape   s    z)bdist_wininst.get_inidata.<locals>.escapeauthorauthor_emaildescription
maintainermaintainer_emailnameurlversionz
    %s: %sz%s=%sz
[Setup]zinstall_script=%szinfo=%sztarget_compile=%dztarget_optimize=%dztarget_version=%szuser_access_control=%sztitle=%sr   zBuilt %s with distutils-%szbuild_info=%s)rm   rn   ro   rp   rq   rr   rs   rt   )r;   metadatara   Zlong_descriptiongetattr
capitalizer2   r+   r,   r-   r4   r0   r_   time	distutilsZctime__version__r@   )r5   linesru   r\   rl   rr   rO   r0   rx   ry   Z
build_infor6   r6   r7   get_inidata   s<    

zbdist_wininst.get_inidatac             C   s  dd l }| j| j | j }| j|}| jd|  |rPt|dj }t|}nd}t|d}	|	j	| j
  |rz|	j	| t|tr|jd}|d }| jrt| jddd	}
|
j jd}W d Q R X || d
 }n|d }|	j	| |jddt||}|	j	| |	j	t|dj  d S )Nr   zcreating %srbwbmbcs    rzlatin-1)encodings   
 z<iiii{V4)structZmkpathr.   r|   rb   Zannounceopenreadlenwriteget_exe_bytes
isinstancestrencoder3   Zpack)r5   rh   rg   r/   r   Zcfgdatainstaller_nameZ
bitmapdataZ	bitmaplenfilerD   Zscript_dataheaderr6   r6   r7   r`      s:    








zbdist_wininst.create_exec             C   sD   | j r&tjj| jd|| j| j f }ntjj| jd|| jf }|S )Nz%s.%s-py%s.exez	%s.%s.exe)r-   r>   r?   r@   r.   r)   )r5   rg   r   r6   r6   r7   rb   '  s    

z$bdist_wininst.get_installer_filenamec       	      C   s   t  }| jrl| j|k rl| jdk r&d}q| jdkr6d}q| jdkrFd}q| jdkrVd}q| jdkrfd	}qd
}n@yddlm} W n tk
r   d
}Y nX |jdd }|d }tjjt	}| j
dkr| j
d d dkr| j
dd  }nd}tjj|d||f }t|d}z|j S |j  X d S )Nz2.4z6.0z7.1z2.5z8.0z3.2z9.0z3.4z10.0z14.0r   )CRT_ASSEMBLY_VERSION.z.0r'      winr:   zwininst-%s%s.exer}   )r   r-   Zmsvcrtr   ImportError	partitionr>   r?   dirname__file__r)   r@   r   r   close)	r5   Zcur_versionZbvr   majorZ	directoryZsfixfilenamefr6   r6   r7   r   4  s8    	






zbdist_wininst.get_exe_bytes)r
   Nr   Pkeep the pseudo-installation tree around after creating the distribution archive)r   r   r   6require a specific python version on the target system)r   Nr   )r   r   r   )r   r   r   )r   r   r   )r   r   r   )r   r   r   )r   Nr    )r!   Nr"   )r#   Nr$   )r%   Nr&   )N)__name__
__module____qualname__ro   r   Zuser_optionsZboolean_optionsrT   rU   Z_unsupportedr8   rE   r^   r|   r`   rb   r   r6   r6   r6   r7   r	      sP                 
&Q.
5r	   )__doc__rT   r>   Zdistutils.corer   Zdistutils.utilr   Zdistutils.dir_utilr   r   Zdistutils.errorsZdistutils.sysconfigr   ry   r   r	   r6   r6   r6   r7   <module>   s   