Your IP : 18.117.156.26


Current Path : /lib64/python3.8/distutils/command/__pycache__/
Upload File :
Current File : //lib64/python3.8/distutils/command/__pycache__/bdist_msi.cpython-38.opt-1.pyc

U

e5d߉�@s�dZddlZddlZddlmZddlmZddlmZddl	m
Z
ddlmZddl
mZdd	lmZddlZdd
lmZmZmZddlmZmZmZmZGdd
�d
e�ZGdd�de�ZdS)z#
Implements the bdist_msi command.
�N)�Command)�remove_tree)�get_python_version)�
StrictVersion)�DistutilsOptionError)�get_platform)�log)�schema�sequence�text)�	Directory�Feature�Dialog�add_datac@sFeZdZdZdd�Zdd�Zddd	�Zddd�Zddd�Zdd�Z	dS)�PyDialogz�Dialog class with a fixed layout: controls at the top, then a ruler,
    then a list of buttons: back, next, cancel. Optionally a bitmap at the
    left.cOs>tj|f|��|jd}d|d}|�dd||jd�dS)zbDialog(database, name, x, y, w, h, attributes, title, first,
        default, cancel, bitmap=true)�$�iHZ
BottomLinerN)r�__init__�h�line�w)�self�args�kwZrulerZbmwidth�r�3/usr/lib64/python3.8/distutils/command/bdist_msi.pyrs
zPyDialog.__init__c
Cs|�ddddddd|�dS)	z,Set the title text of the dialog at the top.�Title��
�@�<�z{\VerdanaBold10}%sN)r)r�titlerrrr"#s�zPyDialog.title�Back�c
Cs,|r
d}nd}|�|d|jddd|||�S)z�Add a back button with a given title, the tab-next button,
        its name in the Control table, possibly initially disabled.

        Return the button, so that events can be associated�r$���8���
pushbuttonr�rr"�next�name�active�flagsrrr�back*sz
PyDialog.back�Cancelc
Cs,|r
d}nd}|�|d|jddd|||�S)z�Add a cancel button with a given title, the tab-next button,
        its name in the Control table, possibly initially disabled.

        Return the button, so that events can be associatedr%r$i0r'r(r)r*r,rrr�cancel5szPyDialog.cancel�Nextc
Cs,|r
d}nd}|�|d|jddd|||�S)z�Add a Next button with a given title, the tab-next button,
        its name in the Control table, possibly initially disabled.

        Return the button, so that events can be associatedr%r$��r'r(r)r*r,rrrr-@sz
PyDialog.nextc
Cs,|�|t|j|d�|jdddd||�S)z�Add a button with a given title, the tab-next button,
        its name in the Control table, giving its x position; the
        y-position is aligned with the other buttons.

        Return the button, so that events can be associated�r'r(r)r%)r+�intrr)rr.r"r-Zxposrrr�xbuttonKszPyDialog.xbuttonN)r#r$)r2r$)r4r$)
�__name__�
__module__�__qualname__�__doc__rr"r1r3r-r8rrrrrs



rc@s�eZdZdZdddde�fdddd	d
ddd
g
ZddddgZddddddddddddddd d!d"d#d$d%gZd&Zd'd(�Z	d)d*�Z
d+d,�Zd-d.�Zd/d0�Z
d1d2�Zd3d4�Zd5d6�Zd7S)8�	bdist_msiz7create a Microsoft Installer (.msi) binary distribution)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)�
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 distributionr?rArCrFz2.0z2.1z2.2z2.3z2.4z2.5z2.6z2.7z2.8z2.9z3.0z3.1z3.2z3.3z3.4z3.5z3.6z3.7z3.8z3.9�XcCsFd|_d|_d|_d|_d|_d|_d|_d|_d|_d|_	d|_
dS)Nr)�	bdist_dir�	plat_name�	keep_tempZno_target_compileZno_target_optimize�target_version�dist_dir�
skip_build�install_script�pre_install_script�versions)rrrr�initialize_options}szbdist_msi.initialize_optionscCs�|�dd�|jdkr2|�d�j}tj�|d�|_t�}|jsN|j	�
�rN||_|jr�|jg|_|js�|j	�
�r�|j|kr�t
d|f��nt|j�|_|�ddd�|jr�t
d��|jr�|j	jD]}|jtj�|�kr�q�q�t
d|j��d|_dS)	NZbdist)rMrMZmsizMtarget version can only be %s, or the '--skip-build' option must be specified)rLrL)rIrIz5the pre-install-script feature is not yet implementedz(install_script '%s' not found in scripts)Zset_undefined_optionsrH�get_finalized_command�
bdist_base�os�path�joinrrK�distribution�has_ext_modulesrPrMr�list�all_versionsrOrNZscripts�basename�install_script_key)rrSZ
short_versionZscriptrrr�finalize_options�sH

�������zbdist_msi.finalize_optionscCsz|js|�d�|jddd�}|j|_|j|_d|_|�d�}d|_d|_|j�	�r�|j
}|spdtjdd�}d	|j
|f}|�d�}tj�|jd
|�|_t�d|j�|��tj�dtj�|jd��|��tjd=|�|j�|j��}|�|�}tj�|�}tj�|��r"t�|�|jj }|j!}	|	�s<|j"}	|	�sFd
}	|�#�}
dt$|
�j%}|j��}|j
�r~d|j
|f}nd|}t&�'|t(|t&�)�||	�|_*t&�+|j*t,�d|
fg}
|j-�p�|j.}|�r�|
�/d|f�|j0�r�|
�/d|j0f�|
�rt1|j*d|
�|�2�|�3�|�4�|�5�|j*�6�t7|jd��r^d|j
�pJd|f}|jj8�/|�|j9�svt:|j|j;d�dS)N�build�installr$)Zreinit_subcommandsr�install_libz%d.%d�z.%s-%s�libzinstalling to %sZPURELIBZUNKNOWNz%d.%d.%dzPython %s %sz	Python %sZDistVersionZ
ARPCONTACTZARPURLINFOABOUT�Property�
dist_filesr=�any)�dry_run)<rMZrun_commandZreinitialize_commandrH�prefixZwarn_dir�compile�optimizerWrXrK�sys�version_inforIrRrTrUrVZ
build_baseZ	build_libr�infoZensure_finalized�insert�runZmkpathrL�get_fullname�get_installer_filename�abspath�exists�unlink�metadata�authorZ
maintainerZget_versionr�version�msilibZ
init_databaser	Zgen_uuid�dbZ
add_tablesr
Zauthor_emailZmaintainer_email�appendZurlr�add_find_python�	add_files�add_scripts�add_ui�Commit�hasattrrdrJrrf)rr_r`rKZplat_specifierr^�fullname�installer_namertrurvZsversionZproduct_nameZpropsZemail�tuprrrrn�s�




�



�

z
bdist_msi.runc
Cs|j}t�d�}tj�|j�}t||d|dd�}t|ddddddd�}||d	fg}|j	|j
gD]t}d|}d|}	}
d}||j
kr�d
}d}
nd|}d}
t||	||d|
|d�}t||||||
�}|�|||f�q`|��i}|D�]\}}}|g}|�r�|�
�}t�|j�D]�}tj�|j|�}tj�|��rld
|�|�|f}||}
t|||||
|�}|�|�n�|j�s�|�|j|d�||k�r�|�|�}||<||jk�r�|j�r�td|��d||_n*||}t|jd|||j|d|jfg��qq�|��q�|�|�dS)NZ	distfiles�	TARGETDIRZ	SourceDir�PythonZ
Everythingrr$)Z	directory�zPython from another locationrazPython %s from registryz%s|%szMultiple files with name %sz[#%s]Z
DuplicateFile)rxrwZCABrTrUrqrHrr
rP�
other_versionryr~�pop�listdirZabsoluterV�isdirZ
make_shortZ	componentZstart_componentZlogicalZadd_filerNr\rrZcommit)rrxZcabZrootdir�root�f�itemsrv�targetr.�defaultZdescr"�level�dir�seenZfeatureZtodo�fileZafileZshortZnewdir�keyrrrr{
sf

�

��

zbdist_msi.add_filescCs|d}|jD�]j}d|}d|}d|}d|}d|}d|}d|}	d	|}
d
|}d|}tjrld}
nd
}
t|jd|d
|d|
f|d|d|
fg�t|jd||f||fg�t|jd|d|d|df|	d|d|df|
d|d|dfg�t|jd|||f|	||df|
d|d
fg�t|jd|||f|	||df|
d|d
fg�t|jdd|dd|fg�|d7}q
dS)asAdds code to the installer to compute the location of Python.

        Properties PYTHON.MACHINE.X.Y and PYTHON.USER.X.Y will be set from the
        registry for each version of Python.

        Properties TARGETDIRX.Y will be set from PYTHON.USER.X.Y if defined,
        else from PYTHON.MACHINE.X.Y.

        Properties PYTHONX.Y will be set to TARGETDIRX.Y\python.exei�z)SOFTWARE\Python\PythonCore\%s\InstallPathzpython.machine.zpython.user.zPYTHON.MACHINE.zPYTHON.USER.ZPythonFromMachineZPythonFromUserZ	PythonExer��PYTHON�raZ
RegLocatorNr$Z	AppSearch�CustomActioni3�[�]z]\python.exe�InstallExecuteSequence�InstallUISequenceZ	Conditionr�rz
NOT TARGETDIR�)rPrwZWin64rrx)r�start�verZinstall_pathZmachine_regZuser_regZmachine_propZ	user_propZmachine_actionZuser_actionZ
exe_actionZtarget_dir_prop�exe_propZTyperrrrzCs`�����������zbdist_msi.add_find_pythonc
Cs|jrjd}|j|jgD]P}d|}d|}t|jd|d||jfg�t|jd|d||fg�|d7}q|jr�tj�	|j
d	�}t|d
��4}|�d�t|j��}|�|�
��W5QRXW5QRXt|jdd
t�|�fg�t|jddg�t|jddg�dS)Ni�zinstall_script.r�r��2r�z&Python%s=3r$zpreinstall.batrzrem ="""
%1 %0
exit
"""
�Binary�
PreInstall)r�rar�N)r�z
NOT Installedi�)rNrPr�rrxr\rOrTrUrVrH�open�write�readrwr�)rr�r�Zinstall_actionr�Zscriptfnr�Zfinrrrr|ys6��
	
"���zbdist_msi.add_scriptscCs�
|j}d}}d}d}d}d}d}d}	t|dd	d
ddd
dg�t|dddddg�t|ddddddg�t|dtj�t|dtj�t|d||||||ddd�}
|
�d�|
jddd d!�|
jd"d#d d!�|
�d$d%d&d'd(d)d*�|
�d+d%d,d'd-d)d.�|
j	dd"dd/�}|�
d0d1�t|d2||||||ddd�}|�d3�|jddd d!�|jd"d#d d!�|�d$d%d&d'd(d)d4�|�d+d%d,d'd-d)d.�|j	dd"dd/�}|�
d0d1�t|d5||||||ddd�}
|
�d6�|
jddd d!�|
jd"d#d d!�|
�d7d%d8d'd-d)d.�|
j	dd"dd/�}|�
d0d9�t|d:||||d;|d<d<d<d=d>�}|�d?d%d@dAd%d)dB�|�d7d-dCdDd-d)dE�|�dFd-dGdHdddI�|�dJdKd-dLdHdMdNdOddd�|jd1dPd1d/�}|�
d0d1�|j	dPd<dPd/�}|�
d0dP�|jd<d1d<d/�}|�
d0d<�t|dQddRdHdSdT|dUdd�}|�dUddVdDdWddX�|�
dYdZd[d\d]dd^d��
d0d_�|�
d`dad[d\d]ddbd��
d0dc�|�
ddd d[d\d]dded��
d0df�|�
dgdhd[d\d]dd"d��
d0di�|�
djd\d[d\d]ddPd��
d0dk�|�
dldmd[d\d]ddnd��
d0do�|�
dpdqd[d\d]dd<d��
d0dr�t|dsddRdtdud|d^d^d^�}|�dFdWd%dvdwddx�|�
dbd[dydzd{ddbd^�}|�
d0d1�|�
d^d|dydzd{dd^db�}|�
d0d9�t|d}ddRdtdu||d9d9d9�}|�dFdWd%dvdwdd~�|�
d9ddydzd{dd9d�}|�
d0d1�t|d�||||||d"d"d"�}|�d7d%d&d'd�d)d��|�d��|�dd%d�d'd-d)d��}|�ddF�|�d�d%d�d'dwd)d�}|�d�dF�|jd#dd d!�|j	d�dd d!�|�d"d�}|�
d�ds�t|d�||||||d�d�d"�}|�d��|�d�d%dwdd-dd�|j���|jddd d!�|�	d�d"�}d}|j
d�d�|d��|j|jgD](}|d7}|j
d�d�|d�||d���q
|j
d�d}|dd��|j
d0d9|d�d��|�d"d��}|�
d�ds�|�d�d�d%d�ddZdd�dd�d�}|�
d�d��|j}d�|}d�|}|�d�d%dAdd%dd��}|�d�|�|�d�|�|�d�|�|�d�|�|�d�d�d%d�dd�dd�|dd�d�}|�d�|�|�d�|�|�d�|�|�d�|�t|d�||||||d�d�d�d=d>�}|�d?d%d@dAd%d)d��|�d7d-d-dDd-d)d��|�dFd-d�dHd�dd��|�d�d�d-d�dHd�d�dd�dd�|�d�dndd���
d0d9�t|d�||||||d�d�d"�}|�d��|�d�d%d�dtddd�dXd��	}|�d�d d�d�d-d��|�d�d d�d�d-d��|jd#dd d!�|�	d�d"�}|�
d�d�d�d�|j
d0d9d�d��|�d"d��}|�
d�ds�t|d�||||||d"d"d"d=d>�}|�d?d-d%dAd%d)d��|�dFd�d�ddwddġ|�d�d�d�d�d-ddơ|�dd&d�|d&d-dd��}|�ddF�|�d�d�d�dZddRd�dd�dd�}|�d�dˡ|jdd�d=d!�|j	d�d"d=d!�|�d"d#��
d�ds�t|d�||||||d�d�d"�}|�d͡|�d�d%d�dHdhddС|�d�d%d�dHd�dd�dXd��	}|�d�d d�dAd{d֡|�d�d d�dAd{d١|jddd=d!�|�	dd"�}|�
d�d�d�d��|�
d�d�d�d@�|�
d�d�d�dN�|�
d�d�d�d�|�
d�d�d�d�|�
d�d�d�d�|�
d�d�d�d�|�
d�d�d�d�|�
d0d9d�d-�|�d"dѡ�
d�ds�dS)�Nr�iri,z[ProductName] Setupr%r$� rc)Z
DefaultUIFont�DlgFont8)ZErrorDialog�ErrorDlg)Z	Progress1ZInstall)Z	Progress2Zinstalls)�MaintenanceForm_Action�Repair)�
WhichUsers�ALLZ	TextStyle)r��Tahoma�	Nr)ZDlgFontBold8r��Nr$)Z
VerdanaBold10�VerdanarNr$)ZVerdanaRed9r�r��rr�)�
PrepareDlgz(Not Privileged or Windows9x or Installed�)�
WhichUsersDlgz.Privileged and not Windows9x and not Installed�)�SelectFeaturesDlgz
Not Installedi�)�MaintenanceTypeDlgz,Installed AND NOT RESUME AND NOT Preselectedi�)�ProgressDlgNi�
ActionText�UITextZ
FatalErrorZFinishz)[ProductName] Installer ended prematurelyz< Backr)r/r2r#ZDescription1r�Fr�Pr!z�[ProductName] setup ended prematurely because of an error.  Your system has not been modified.  To install this program at a later time, please run the installation again.ZDescription2��z.Click the Finish button to exit the Installer.)r.Z	EndDialogZExitZUserExitz'[ProductName] Installer was interruptedz�[ProductName] setup was interrupted.  Your system has not been modified.  To install this program at a later time, please run the installation again.Z
ExitDialogz&Completing the [ProductName] InstallerZDescription��ZReturnZ
FilesInUse�ZRetryF)Zbitmapr���z{\DlgFontBold8}Files in Use�iz8Some files that need to be updated are currently in use.ZText�7iJz�The following applications are using files that need to be updated by this setup. Close these applications and then click Retry to continue the installation or Cancel to exit it.ZListZListBox�k��ZFileInUseProcess�Ignorer�r�eiZ	ErrorTextr��0r��N�x�H�Q�ZNoZErrorNo�Y��ZYesZErrorYes�AZAbortZ
ErrorAbort�C�*ZErrorCancel�IZErrorIgnore�O�ZOkZErrorOk�R��Z
ErrorRetryZ	CancelDlgi�U���z;Are you sure you want to cancel [ProductName] installation?�9r(r)�ZWaitForCostingDlgzRPlease wait while the installer finishes determining your disk space requirements.�fr��(zOPlease wait while the Installer prepares to guide you through the installation.z&Welcome to the [ProductName] Installer�nzPondering...Z
ActionData�r4ZSpawnDialogr�zSelect Python InstallationsZHintz9Select the Python locations where %s should be installed.zNext >z[TARGETDIR]z[SourceDir])Zorderingz
[TARGETDIR%s]z FEATURE_SELECTED AND &Python%s=3ZSpawnWaitDialograZFeaturesZ
SelectionTreer ZFEATUREZPathEditz[FEATURE_SELECTED]�1z!FEATURE_SELECTED AND &Python%s<>3ZOtherz$Provide an alternate Python locationZEnableZShowZDisableZHide���r�ZDiskCostDlgZOKz&{\DlgFontBold8}Disk Space RequirementszFThe disk space required for the installation of the selected features.�5aThe highlighted volumes (if any) do not have enough disk space available for the currently selected features.  You can either remove some files from the highlighted volumes, or choose to install less features onto local drive(s), or select different destination drive(s).Z
VolumeListZVolumeCostList�d�iz{120}{70}{70}{70}{70}g�?r�ZAdminInstallzGSelect whether to install [ProductName] for all users of this computer.r�r��zInstall for all usersZJUSTME�zInstall just for mez
[ALLUSERS]zWhichUsers="ALL"r�z({\DlgFontBold8}[Progress1] [ProductName]�#�AzYPlease wait while the Installer [Progress2] [ProductName]. This may take several minutes.ZStatusLabelzStatus:ZProgressBariz
Progress doneZSetProgressZProgressr�z)Welcome to the [ProductName] Setup WizardZBodyText�?z:Select whether you want to repair or remove [ProductName].ZRepairRadioGroup�lr�r�r�z&Repair [ProductName]ZRemoverzRe&move [ProductName]z[REINSTALL]zMaintenanceForm_Action="Repair"z[Progress1]Z	Repairingz[Progress2]ZrepairsZ	Reinstallr�z[REMOVE]zMaintenanceForm_Action="Remove"�ZRemoving�Zremoves�
�z MaintenanceForm_Action<>"Change")rxrrr�r�rr"r1r3r-ZeventZcontrolrr+�mappingrWrorPr�Z	conditionr8Z
radiogroup�add)rrx�x�yrrr"ZmodalZmodelessZtrack_disk_spaceZfatalrBZ	user_exitZexit_dialogZinuse�errorr3ZcostingZprepZseldlg�orderrvr�Zinstall_other_condZdont_install_other_condZcostZ
whichusers�gZprogressZmaintrrrr}�sv��
��	��
�
���
���
�������       ������
�
���
��������
�
������
��zbdist_msi.add_uicCs<|jrd||j|jf}nd||jf}tj�|j|�}|S)Nz%s.%s-py%s.msiz	%s.%s.msi)rKrIrTrUrVrL)rr�Z	base_namer�rrrrp�s�z bdist_msi.get_installer_filenameN)r9r:r;ZdescriptionrZuser_optionsZboolean_optionsrZr�rQr]rnr{rzr|r}rprrrrr=Ss^����
�
([66&@r=)r<rjrTZdistutils.corerZdistutils.dir_utilrZdistutils.sysconfigrZdistutils.versionrZdistutils.errorsrZdistutils.utilrZ	distutilsrrwr	r
rrr
rrrr=rrrr�<module>s>

?>