Your IP : 3.14.134.195


Current Path : /opt/alt/python39/lib64/python3.9/distutils/command/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/distutils/command/__pycache__/bdist_wininst.cpython-39.opt-1.pyc

a

R�f�>�@stdZddlZddlZddlZddlmZddlmZddlm	Z	ddl
TddlmZddl
mZGd	d
�d
e�ZdS)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�eZdZdZdddde�fdddd	d
ddd
dddg
Zgd�ZejdkZ	�fdd�Z
dd�Zdd�Zdd�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rr�win32cs$t�j|i|��t�dtd�dS)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__cCsRd|_d|_d|_d|_d|_d|_d|_d|_d|_d|_	d|_
d|_d|_dS)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)rr r r!�initialize_optionsEsz bdist_wininst.initialize_optionscCs�|�dd�|jdurR|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��dS)	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_modulesrZDistutilsOptionErrorr,�scripts�basename)rr0r4Z
short_version�scriptr r r!�finalize_optionsUs>
�����zbdist_wininst.finalize_optionsc
Cs�tjdkr&|j��s|j��r&td��|js6|�d�|jddd�}|j	|_
|j|_d|_|j|_|�d�}d|_
d|_|j��r�|j}|s�d	tjdd
�}d|j|f}|�d�}tj�|jd|�|_d
D],}|��}|dkr�|d}t|d||�q�t�d|j	�|��tj�dtj�|j	d��|��tjd=ddlm}|�}	|j� �}
|j!|	d|j	d�}|�"||
|j#�|j���r�t$�}nd}|jj%�&d||�'|
�f�t�(d|�t�)|�|j*�s�t+|j	|j,d�dS)Nrz^distribution contains extensions and/or C libraries; must be compiled on a Windows 32 platform�build�install�)Zreinit_subcommandsr�install_libz%d.%drz.%s-%s�lib)ZpurelibZplatlib�headersr9�datarBz/Include/$dist_nameZinstall_zinstalling to %sZPURELIB)�mktemp�zip)Zroot_dir�anyrzremoving temporary file '%s')�dry_run)-�sys�platformr2r8Zhas_c_librariesZDistutilsPlatformErrorr+Zrun_commandZreinitialize_commandr"�rootZwarn_dirr#�compile�optimizer'�version_infor3r5r6r7Z
build_baseZ	build_lib�upper�setattrr�infoZensure_finalized�insert�runZtempfilerD�get_fullnameZmake_archive�
create_exer)rZ
dist_files�append�get_installer_filename�debug�remover$rrG)
rr>r@r'Zplat_specifierr=�key�valuerDZarchive_basename�fullname�arcnameZ	pyversionr r r!rR{sr
���




��
��
zbdist_wininst.runcCsZg}|jj}|�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||��ddl
}ddl}	d|�|�
��|	jf}
|�d|
�d�|�S)Nz
[metadata]r1�
cSs|�dd�S)Nr]z\n)�replace)�sr r r!�escape�sz)bdist_wininst.get_inidata.<locals>.escape)ZauthorZauthor_email�descriptionZ
maintainerZmaintainer_email�nameZurl�versionz
    %s: %sz%s=%sz
[Setup]zinstall_script=%szinfo=%sztarget_compile=%dztarget_optimize=%dztarget_version=%szuser_access_control=%sztitle=%srzBuilt %s with distutils-%sz
build_info=%s)r2�metadatarUZlong_description�getattr�
capitalizer,r%r&r'r.r*rS�time�	distutils�ctime�__version__r7)r�linesrdrPr`rbrCr*rgrhZ
build_infor r r!�get_inidata�s>
�
�zbdist_wininst.get_inidataNc	Cs�ddl}|�|j�|��}|�|�}|�d|�|rtt|d��}|��}Wd�n1s`0Yt|�}	nd}	t|d���}
|
�	|�
��|r�|
�	|�t|t�r�|�
d�}|d}|j�rt|jddd	��}|���
d�}Wd�n1s�0Y||d
}n|d}|
�	|�|�ddt|�|	�}
|
�	|
�t|d��}|
�	|���Wd�n1�sr0YWd�n1�s�0YdS)
Nrzcreating %s�rb�wb�mbcs��rzlatin-1)�encodings
z<iiii{V4)�structZmkpathr(rlrVZannounce�open�read�len�write�
get_exe_bytes�
isinstance�str�encoder-Zpack)rr\r[r)rsZcfgdata�installer_name�fZ
bitmapdataZ	bitmaplen�filer;Zscript_data�headerr r r!rT�sD
&



�,
�
zbdist_wininst.create_execCsD|jr&tj�|jd||j|jf�}ntj�|jd||jf�}|S)Nz%s.%s-py%s.exez	%s.%s.exe)r'r5r6r7r(r#)rr[r|r r r!rV1s
��
�z$bdist_wininst.get_installer_filenamec	Cs(t�}|jrl|j|krl|jdkr&d}q�|jdkr6d}q�|jdkrFd}q�|jdkrVd}q�|jdkrfd	}q�d
}n>zddlm}Wnty�d
}Yn0|�d
�d}|d}tj�t	�}|j
dkr�|j
dd�dkr�|j
dd�}nd}tj�|d||f�}t|d�}z|�
�W|��S|��0dS)Nz2.4z6.0z7.1z2.5z8.0z3.2z9.0z3.4z10.0z14.0r)�CRT_ASSEMBLY_VERSION�.z.0r��winr1zwininst-%s%s.exerm)rr'Zmsvcrtr��ImportError�	partitionr5r6�dirname�__file__r#r7rtru�close)	rZcur_versionZbvr��majorZ	directoryZsfix�filenamer}r r r!rx>s<	






�zbdist_wininst.get_exe_bytes)N)�__name__�
__module__�__qualname__rarZuser_optionsZboolean_optionsrHrIZ_unsupportedrr/r<rRrlrTrVrx�
__classcell__r r rr!rs:���%
&Q.
7
r)�__doc__r5rHrZdistutils.corerZdistutils.utilrZdistutils.dir_utilrZdistutils.errorsZdistutils.sysconfigrrhrrr r r r!�<module>s

?>