a
XC?h�> � @ sp d dl Z d dlZd dlZd dlmZ d dlmZ d dlmZ d dl T d dl
mZ d dlm
Z
G dd � d e�ZdS )
� N)�Command)�get_platform)�remove_tree)�*)�get_python_version)�logc
s� e Zd ZdZdddde� fdddd d
ddd
dddg
Zg d�ZejdkZ � fdd�Z
dd� Zdd� Zdd� Z
dd� Zd$dd�Zd d!� Zd"d#� Z� ZS )%�
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))� keep-temp�kzPkeep the pseudo-installation tree around after creating the distribution archive)ztarget-version=Nz6require a specific python version on the target system)�no-target-compile�cz/do not compile .py to .pyc on the target system)�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)zbitmap=�bz>bitmap to use for the installer instead of python-powered logo)ztitle=�tz?title to display on the installer background instead of default)�
skip-buildNz2skip rebuilding everything (for testing/debugging))zinstall-script=NzUbasename of installation script to be run after installation or before deinstallation)zpre-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)zuser-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 UAC)r
r r r �win32c s$ t � j|i |�� t�dtd� 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__� �D/opt/alt/python39/lib64/python3.9/distutils/command/bdist_wininst.pyr ? s �zbdist_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� | � dd� | jd u rR| jr6| jr6| j�d�}| j|_| �d�j}tj �
|d�| _| js^d| _| js�| j�� r�t
� }| jr�| j|kr�td|f ��|| _| � ddd� | jr�| jjD ]}| jtj �|�kr� q�q�td| j ��d S ) N�bdist)r+ r+ Zwininst� 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)Zset_undefined_optionsr" r+ r# �distributionZget_command_obj�get_finalized_command�
bdist_base�os�path�joinr' �has_ext_modulesr ZDistutilsOptionErrorr, �scripts�basename)r r0 r4 Z
short_version�scriptr r r! �finalize_optionsU s>
�����zbdist_wininst.finalize_optionsc
C s� t jdkr&| j�� s| j�� r&td��| js6| �d� | jddd�}| j |_
| j|_d|_| j|_| �d�}d|_
d|_| j�� r�| j}|s�d t jd d
� }d| j|f }| �d�}tj�|jd| �|_d
D ],}|�� }|dkr�|d }t|d| |� q�t�d| j � |�� t j�dtj�| j d�� |�� t jd= ddlm} |� } | j� � }
| j!| d| j d�}| �"||
| j#� | j�� �r�t$� }nd}| jj%�&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� )Zreinit_subcommandsr �install_libz%d.%dr z.%s-%s�lib)ZpurelibZplatlib�headersr9 �datarB z/Include/$dist_nameZinstall_zinstalling to %sZPURELIB)�mktemp�zip)Zroot_dir�anyr zremoving temporary file '%s')�dry_run)-�sys�platformr2 r8 Zhas_c_librariesZDistutilsPlatformErrorr+ Zrun_commandZreinitialize_commandr" �rootZwarn_dirr# �compile�optimizer' �version_infor3 r5 r6 r7 Z
build_baseZ build_lib�upper�setattrr �infoZensure_finalized�insert�runZtempfilerD �get_fullnameZmake_archive�
create_exer) r Z
dist_files�append�get_installer_filename�debug�remover$ r rG )
r r> r@ r' Zplat_specifierr= �key�valuerD Zarchive_basename�fullname�arcnameZ pyversionr r r! rR { sr
���
��
��
zbdist_wininst.runc C sZ g }| j j}|�d� |jpdd }dd� }dD ]B}t||d�}|r0|d|�� ||�f }|�d|||�f � q0|�d � | jr�|�d
| j � |�d||� � |�d| j � |�d
| j � | j r�|�d| j � | j
r�|�d| j
� | j�p| j �� }|�d||� � dd l
}dd l} d|�|�
� �| jf }
|�d|
� d�|�S )Nz
[metadata]r1 �
c S s | � dd�S )Nr] z\n)�replace)�sr r r! �escape� s z)bdist_wininst.get_inidata.