o _a@sdZddlZddlZddlZddlmZddlmZddlm Z ddl m Z ddl m Z ddlmZdd lmZddlZdd lmZmZmZdd lmZmZmZmZGd d d eZGdddeZdS)z# Implements the bdist_msi command. N)Command) remove_tree)get_python_version) StrictVersion)DistutilsOptionError) get_platform)log)schemasequencetext) DirectoryFeatureDialogadd_datac@sFeZdZdZddZddZddd Zdd d ZdddZddZ dS)PyDialogzDialog 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|g|R|jd}d|d}|dd||jddS)zbDialog(database, name, x, y, w, h, attributes, title, first, default, cancel, bitmap=true)$iH BottomLinerN)r__init__hlinew)selfargskwrulerbmwidthrI/usr/lib/python3/dist-packages/setuptools/_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 )rtitlerrrr%%szPyDialog.titleBackc C,|rd}nd}||d|jddd|||S)zAdd 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 associatedr'8 pushbuttonrrr%nextnameactiveflagsrrrback,z PyDialog.backCancelc Cr()zAdd 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.r0rrrcancel7r6zPyDialog.cancelNextc Cr()zAdd 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.r0rrrr1Br6z PyDialog.nextc Cs,||t|j|d|jdddd||S)zAdd 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 associatedr+r,r-r))r/intrr)rr2r%r1xposrrrxbuttonMs,zPyDialog.xbuttonN)r&r')r7r')r9r') __name__ __module__ __qualname____doc__rr%r5r8r1r>rrrrrs  rc seZdZdZddddefdddd d d d d g ZgdZgdZdZfddZ ddZ ddZ ddZ ddZ ddZddZdd Zd!d"ZZS)# 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-tempkzPkeep the pseudo-installation tree around after creating the distribution archive)ztarget-version=Nz6require a specific python version on the target system)no-target-compilecz/do not compile .py to .pyc on the target system)no-target-optimizeoz;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 distribution)rErGrIrL)z2.0z2.1z2.2z2.3z2.4z2.5z2.6z2.7z2.8z2.9z3.0z3.1z3.2z3.3z3.4z3.5z3.6z3.7z3.8z3.9Xcs$tj|i|tdtddS)NzZbdist_msi command is deprecated since Python 3.9, use bdist_wheel (wheel packages) instead)superrwarningswarnDeprecationWarning)rrr __class__rrrszbdist_msi.__init__cCsFd|_d|_d|_d|_d|_d|_d|_d|_d|_d|_ d|_ dS)Nr) bdist_dir plat_name keep_tempno_target_compileno_target_optimizetarget_versiondist_dir skip_buildinstall_scriptpre_install_scriptversions)rrrrinitialize_optionss zbdist_msi.initialize_optionscCs|dd|jdur|dj}tj|d|_t}|js'|j r'||_|jrD|jg|_ |j sC|j rC|j|krCt d|fnt|j|_ |ddd|jrXt d|jrt|j jD] }|jtj|krlnq_t d|jd|_dS) Nbdist)r\r\msizMtarget version can only be %s, or the '--skip-build' option must be specified)r[r[)rVrVz5the pre-install-script feature is not yet implementedz(install_script '%s' not found in scripts)set_undefined_optionsrUget_finalized_command bdist_baseospathjoinrrZ distributionhas_ext_modulesr_r\rlist all_versionsr^r]scriptsbasenameinstall_script_key)rre short_versionscriptrrrfinalize_optionssJ        zbdist_msi.finalize_optionscCs~|js|d|jddd}|j|_|j|_d|_|d}d|_d|_|j rV|j }|s?|js6Jddt j dd }d |j |f}|d}tj|jd ||_td |j|t jdtj|jd |t jd=||j|j}||}tj|}tj|rt||jj }|j!} | s|j"} | sd} |#} dt$| j%} |j}|j rd|j |f} nd|} t&'|t(| t&)| | |_*t&+|j*t,d| fg} |j-p|j.}|r| /d|f|j0r| /d|j0f| rt1|j*d| |2|3|4|5|j*6t7|jdr/d|j p%d|f}|jj8/||j9s=t:|j|j;ddSdS)Nbuildinstallr')reinit_subcommandsr install_libz Should have already checked thisz%d.%drNz.%s-%slibzinstalling to %sPURELIBUNKNOWNz%d.%d.%dz Python %s %sz Python %s DistVersion ARPCONTACTARPURLINFOABOUTProperty dist_filesrCany)dry_run)    zbdist_msi.add_scriptscCs |j}d}}d}d}d}d}d}d} t|dgd t|d gd t|d gd t|dtjt|dtjt|d||||||ddd } | d| jdddd| jdddd| ddddddd| ddd dd!dd"| j dddd#} | d$d%t|d&||||||ddd } | d'| jdddd| jdddd| ddddddd(| ddd dd!dd"| j dddd#} | d$d%t|d)||||||ddd } | d*| jdddd| jdddd| d+dd,dd!dd"| j dddd#} | d$d-t|d.||||d/|d0d0d0d1d2 }|d3dd4d5ddd6|d+d!d7d8d!dd9|d:d!d;dd?d!d@dz [TARGETDIR]z [SourceDir])orderingz [TARGETDIR%s]z FEATURE_SELECTED AND &Python%s=3SpawnWaitDialogrNFeatures SelectionTreer#FEATUREPathEditz[FEATURE_SELECTED]1z!FEATURE_SELECTED AND &Python%s<>3Otherz$Provide an alternate Python locationEnableShowDisableHider DiskCostDlgOKz&{\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). VolumeListVolumeCostListdiz{120}{70}{70}{70}{70}g?r AdminInstallzGSelect whether to install [ProductName] for all users of this computer.rrzInstall for all usersJUSTMEzInstall just for mez [ALLUSERS]zWhichUsers="ALL"rz({\DlgFontBold8}[Progress1] [ProductName]#AzYPlease wait while the Installer [Progress2] [ProductName]. This may take several minutes. StatusLabelzStatus: ProgressBariz Progress done SetProgressProgressrz)Welcome to the [ProductName] Setup WizardBodyText?z:Select whether you want to repair or remove [ProductName].RepairRadioGrouplrrrz&Repair [ProductName]RemoverzRe&move [ProductName]z [REINSTALL]zMaintenanceForm_Action="Repair"z [Progress1] Repairingz [Progress2]repairs Reinstallr z[REMOVE]zMaintenanceForm_Action="Remove" Removing removes z MaintenanceForm_Action<>"Change")rrr rrrr%r5r8r1eventcontrolrr/mappingrirr_r conditionr> radiogroupadd)rrxyrrr%modalmodelesstrack_disk_spacefatalrH user_exit exit_dialoginuseerrorr8costingprepseldlgorderrrinstall_other_conddont_install_other_condcost whichusersgprogressmaintrrrrs                                                    zbdist_msi.add_uicCs<|jr d||j|jf}nd||jf}tj|j|}|S)Nz%s.%s-py%s.msiz %s.%s.msi)rZrVrfrgrhr[)rr base_namerrrrrsz bdist_msi.get_installer_filename)r?r@rA descriptionr user_optionsboolean_optionsrlrrr`rrrrrrrr __classcell__rrrSrrCUs>  ([66&@rC)rBrfrrPdistutils.corerdistutils.dir_utilrdistutils.sysconfigrdistutils.versionrdistutils.errorsrdistutils.utilr distutilsrrr r r r r rrrrCrrrrs        >