<!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>
B
    ‘–Rež>  ã               @   st   d Z ddlZddlZddlZddlmZ ddlmZ ddl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)Úremove_tree)Ú*)Úget_python_version)Úlogc                   sš   e Zd ZdZddddeƒ  fdddd	d
ddddddgZddddgZejdkZ	‡ fdd„Z
dd„ Zdd„ Zdd„ Zdd„ Zd'd!d"„Zd#d$„ Zd%d&„ Z‡  ZS )(Úbdist_wininstz-create an executable installer for MS Windows)z
bdist-dir=Nz1temporary directory for creating the distributionz
plat-name=Úpz;platform name to embed in generated filenames (default: %s))z	keep-tempÚkzPkeep the pseudo-installation tree around after creating the distribution archive)ztarget-version=Nz6require a specific python version on the target system)zno-target-compileÚcz/do not compile .py to .pyc on the target system)zno-target-optimizeÚoz;do not compile .py to .pyo (optimized) on the target system)z	dist-dir=Údz-directory to put final built distributions in)zbitmap=Úbz>bitmap to use for the installer instead of python-powered logo)ztitle=Útz?title to display on the installer background instead of default)z
skip-buildNz2skip rebuilding everything (for testing/debugging))zinstall-script=NzUbasename of installation script to be run after installation or before deinstallation)zpre-install-script=Nz{Fully qualified filename of a script to be run before any files are installed.  This script need not be in the distribution)zuser-access-control=NzŠspecify Vista's UAC handling - 'none'/default=no handling, 'auto'=use UAC if target Python installed for all users, 'force'=always use UACz	keep-tempzno-target-compilezno-target-optimizez
skip-buildÚwin32c                s    t ƒ j||Ž t dtd¡ d S )Nz^bdist_wininst command is deprecated since Python 3.8, use bdist_wheel (wheel packages) insteadé   )ÚsuperÚ__init__ÚwarningsÚwarnÚDeprecationWarning)ÚselfÚargsÚkw)Ú	__class__© ú¡/builddir/build/BUILDROOT/alt-python37-setuptools-58.3.0-4.el8.x86_64/opt/alt/python37/lib/python3.7/site-packages/setuptools/_distutils/command/bdist_wininst.pyr   ?   s    zbdist_wininst.__init__c             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)r   r   r   r   Úinitialize_optionsE   s    z bdist_wininst.initialize_optionsc             C   sä   |   dd¡ | jd krR| jr6| jr6| j d¡}| j|_|  d¡j}tj	 
|d¡| _| js^d| _| js˜| j ¡ r˜tƒ }| jr’| j|kr’td|f ƒ‚|| _|   ddd¡ | jràx2| jjD ]}| jtj	 |¡kr¶P q¶W td| j ƒ‚d S )	NÚbdist)r&   r&   ZwininstÚ zMtarget version can only be %s, or the '--skip-build' option must be specified)r#   r#   )r   r   z(install_script '%s' not found in scripts)Úset_undefined_optionsr   r&   r   ÚdistributionÚget_command_objÚget_finalized_commandÚ
bdist_baseÚosÚpathÚjoinr"   Úhas_ext_modulesr   ÚDistutilsOptionErrorr'   ÚscriptsÚbasename)r   r+   r1   Zshort_versionÚscriptr   r   r   Úfinalize_optionsU   s4    

zbdist_wininst.finalize_optionsc             C   sò  t jdkr&| j ¡ s| j ¡ r&tdƒ‚| js6|  d¡ | jddd}| j	|_
| j|_d|_| j|_|  d¡}d|_d|_| j ¡ rÚ| j}|s¬| jsštd	ƒ‚d
t jd d…  }d| j|f }|  d¡}tj |jd| ¡|_x4dD ],}| ¡ }|dkrü|d }t|d| |ƒ qàW t d| j	¡ | ¡  t j dtj | j	d¡¡ | ¡  t jd= ddlm } |ƒ }	| j !¡ }
| j"|	d| j	d}|  #||
| j$¡ | j ¡ r¢t%ƒ }nd}| jj& 'd||  (|
¡f¡ t )d|¡ t *|¡ | j+sît,| j	| j-d d S )Nr   z^distribution contains extensions and/or C libraries; must be compiled on a Windows 32 platformÚbuildÚinstallé   )Úreinit_subcommandsr   Úinstall_libz Should have already checked thisz%d.%dr   z.%s-%sÚlib)ÚpurelibÚplatlibÚheadersr7   ÚdatarC   z/Include/$dist_nameÚinstall_zinstalling to %sZPURELIB)ÚmktempÚzip)Úroot_dirÚanyr   zremoving temporary file '%s')Údry_run).ÚsysÚplatformr.   r5   Úhas_c_librariesÚDistutilsPlatformErrorr&   Úrun_commandÚreinitialize_commandr   ÚrootÚwarn_dirr   ÚcompileÚoptimizer"   ÚAssertionErrorÚversion_infor0   r2   r3   r4   Ú
build_baseÚ	build_libÚupperÚsetattrr   ÚinfoÚensure_finalizedÚinsertÚrunÚtempfilerF   Úget_fullnameÚmake_archiveÚ
create_exer$   r   Ú
dist_filesÚappendÚget_installer_filenameÚdebugÚremover   r   rJ   )r   r<   r?   r"   Úplat_specifierr;   ÚkeyÚvaluerF   Zarchive_basenameÚfullnameÚarcnameZ	pyversionr   r   r   r^   {   sf    












zbdist_wininst.runc             C   s^  g }| j j}| d¡ |jpdd }dd„ }xJdD ]B}t||dƒ}|r2|d| ¡ ||ƒf  }| d|||ƒf ¡ q2W | d	¡ | jr˜| d
| j ¡ | d||ƒ ¡ | d| j  ¡ | d| j  ¡ | j	rä| d| j	 ¡ | j
rú| d| j
 ¡ | jp
| j  ¡ }| d||ƒ ¡ dd l}dd l}	d| | ¡ ¡|	jf }
| d|
 ¡ d |¡S )Nz
[metadata]r,   Ú
c             S   s   |   dd¡S )Nrm   z\n)Úreplace)Úsr   r   r   Ú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)r.   Úmetadatard   Úlong_descriptionÚgetattrÚ
capitalizer'   r    r!   r"   r)   r%   r`   ÚtimeÚ	distutilsÚctimeÚ__version__r4   )r   Úlinesry   r[   rp   rv   rD   r%   r}   r~   Z
build_infor   r   r   Úget_inidataÌ   s:    


zbdist_wininst.get_inidataNc          
   C   sH  dd l }|  | j¡ |  ¡ }|  |¡}|  d| ¡ |r`t|dƒ}| ¡ }W d Q R X t|ƒ}	nd}	t|dƒÐ}
|
 	|  
¡ ¡ |rŒ|
 	|¡ t|tƒr | d¡}|d }| jræt| jddd	}| ¡  d¡}W d Q R X || d
 }n|d }|
 	|¡ | ddt|ƒ|	¡}|
 	|¡ t|dƒ}|
 	| ¡ ¡ W d Q R X W d Q R X d S )Nr   zcreating %sÚrbÚwbÚmbcsó    Úrzlatin-1)Úencodings   
 z<iiii{V4)ÚstructÚmkpathr#   r‚   re   ÚannounceÚopenÚreadÚlenÚwriteÚget_exe_bytesÚ
isinstanceÚstrÚencoder(   Úpack)r   rl   rk   r$   r‰   ZcfgdataÚinstaller_nameÚfZ
bitmapdataZ	bitmaplenÚfiler9   Zscript_dataÚheaderr   r   r   rb   ú   s>    







zbdist_wininst.create_exec             C   sD   | j r&tj | jd|| j| j f ¡}ntj | jd|| jf ¡}|S )Nz%s.%s-py%s.exez	%s.%s.exe)r"   r2   r3   r4   r#   r   )r   rk   r•   r   r   r   re   1  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	}q¬d
}n@yddlm} W n tk
r”   d
}Y nX | d¡d }|d }tj t	¡}| j
dkrä| j
d d… dkrä| j
dd … }nd}tj |d||f ¡}t|dƒ}z| ¡ S | ¡  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"   Úmsvcrtr™   ÚImportErrorÚ	partitionr2   r3   ÚdirnameÚ__file__r   r4   rŒ   r   Úclose)	r   Zcur_versionZbvr™   ÚmajorÚ	directoryZsfixÚfilenamer–   r   r   r   r   >  s8    	






zbdist_wininst.get_exe_bytes)N)Ú__name__Ú
__module__Ú__qualname__rs   r   Úuser_optionsÚboolean_optionsrK   rL   Z_unsupportedr   r*   r:   r^   r‚   rb   re   r   Ú__classcell__r   r   )r   r   r      s6   
&Q.
7r   )Ú__doc__r2   rK   r   Údistutils.corer   Údistutils.utilr   Údistutils.dir_utilr   Údistutils.errorsÚdistutils.sysconfigr   r~   r   r   r   r   r   r   Ú<module>   s   