3 \¡‰ã@sÀdZddlZddlZddlmZddlmZddlmZddl m Z ddl m Z ddl mZdd lmZddlZdd lmZmZmZdd lmZmZmZmZGd 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 „Zdd d „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}|jdd||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.6/distutils/command/bdist_msi.pyrs  zPyDialog.__init__c Cs|jddddddd|ƒdS) z,Set the title text of the dialog at the top.ÚTitleéé i@é<iz{\VerdanaBold10}%sN)r )rÚtitlerrrr #szPyDialog.titleÚBackéc Cs,|r d}nd}|j|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}|j|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)rr r)r*r+r,rrrÚcancel5szPyDialog.cancelÚNextc Cs,|r d}nd}|j|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)rr r)r*r+r,rrrr)@sz PyDialog.nextc Cs,|j|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")r.r")r0r") Ú__name__Ú __module__Ú __qualname__Ú__doc__rr r-r/r)r4rrrrrs  rc@s°eZdZdZdCdddeƒfdEdGdHdIdJdKdLdMg ZddddgZddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1gZd2Zd3d4„Z d5d6„Z d7d8„Z d9d:„Z d;d<„Z d=d>„Zd?d@„ZdAdB„ZdS)NÚ bdist_msiz7create a Microsoft Installer (.msi) binary distributionú bdist-dir=Nú1temporary directory for creating the distributionz plat-name=Úpz;platform name to embed in generated filenames (default: %s)ú keep-tempÚkz/keep the pseudo-installation tree around after z!creating the distribution archiveútarget-version=z!require a specific python versionz on the target systemúno-target-compileÚcú/do not compile .py to .pyc on the target systemúno-target-optimizeÚoú;do not compile .py to .pyo (optimized) on the target systemú dist-dir=Údú-directory to put final built distributions inú skip-buildú2skip rebuilding everything (for testing/debugging)úinstall-script=úUbasename of installation script to be run after installation or before deinstallationúpre-install-script=ú{Fully qualified filename of a script to be run before any files are installed. This script need not be in the distributionz2.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ø|jdd ƒ|jdkr2|jdƒj}tjj|dƒ|_tƒ}|j rP|j j ƒrP||_|jrŒ|jg|_ |j r˜|j j ƒr˜|j|kr˜t d|fƒ‚n t|jƒ|_ |jdd d ƒ|jr´t dƒ‚|jrîx2|j jD]}|jtjj|ƒkrÄPqÄWt d|jƒ‚d|_dS) NZbdistrUZmsizMtarget version can only be %s, or the '--skip-build' option must be specifiedrTrQz5the pre-install-script feature is not yet implementedz(install_script '%s' not found in scripts)rUrU)rTrT)rQrQ)Zset_undefined_optionsrPÚget_finalized_commandÚ bdist_baseÚosÚpathÚjoinrrSÚ distributionÚhas_ext_modulesrXrUrÚlistÚ all_versionsrWrVÚscriptsÚbasenameÚinstall_script_key)rr[Z short_versionZscriptrrrÚfinalize_optionsŠs:        zbdist_msi.finalize_optionscCsˆ|js|jdƒ|jddd�}|j|_|j|_d|_|jdƒ}d|_d|_|jj ƒr¬|j }|s~|jslt dƒ‚dt j dd …}d |j|f}|jdƒ}tjj|jd |ƒ|_tjd |jƒ|jƒt jjdtjj|jd ƒƒ|jƒt jd=|j|jƒ|jjƒ}|j|ƒ}tjj|ƒ}tjj|ƒ�r0tj |ƒ|jj!}|j"} | �sJ|j#} | �sTd} |j$ƒ} dt%| ƒj&} |jjƒ}|j �rŒd|j |f} nd|} t'j(|t)| t'j*ƒ| | ƒ|_+t'j,|j+t-ƒd| fg} |j.�pÒ|j/}|�rè| j0d|fƒ|j1�r| j0d|j1fƒ| �rt2|j+d| ƒ|j3ƒ|j4ƒ|j5ƒ|j6ƒ|j+j7ƒt8|jdƒ�rld|j �pXd|f}|jj9j0|ƒ|j:�s„t;|j|jƒ| jd?d9d@d;dAd=dBƒ| j d2d6d2dC�} | j dDdEƒt|dF||||||d2d2d2ƒ } | jdGƒ| jd4d2dd5�| jd6d7dd5�| jd8d9d:d;dz [TARGETDIR]z [SourceDir])Zorderingz [TARGETDIR%s]z FEATURE_SELECTED AND &Python%s=3ZSpawnWaitDialogrjZFeaturesZ SelectionTreerZFEATUREZPathEditz[FEATURE_SELECTED]Ú1z!FEATURE_SELECTED AND &Python%s<>3ZOtherz$Provide an alternate Python locationZEnableZShowZDisableZHideé×rŸr�Z DiskCostDlgZOKz&{\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à?Z AdminInstallzGSelect whether to install [ProductName] for all users of this computer.ézInstall for all usersZJUSTMEézInstall just for mez [ALLUSERS]zWhichUsers="ALL"z({\DlgFontBold8}[Progress1] [ProductName]é#éAzYPlease wait while the Installer [Progress2] [ProductName]. This may take several minutes.Z StatusLabelzStatus:Z ProgressBariz Progress doneZ SetProgressZProgressz)Welcome to the [ProductName] Setup WizardZBodyTexté?z:Select whether you want to repair or remove [ProductName].ZRepairRadioGroupélr¨z&Repair [ProductName]ZRemoverzRe&move [ProductName]z [REINSTALL]zMaintenanceForm_Action="Repair"z [Progress1]Z Repairingz [Progress2]ZrepairsZ Reinstallz[REMOVE]zMaintenanceForm_Action="Remove"é ZRemovingé Zremovesé éz MaintenanceForm_Action<>"Change")r¶r·)r¸r¹)rºr»)r¼r½)r¾r¿)rÀrÁ)r·rÂrÃNr)rÄrÂrÅNr")rÆrÇrNr")rÈrÇrÃrÉr)rÊrËrÌ)rÍrÎrÏ)rÐrÑrÒ)rÓrÔrÕ)rÖNr×)r‚rr rØrÙrr r-r/r)ZeventZcontrolrr(Úmappingr_ryrXr�Z conditionr4Z radiogroupÚadd)rr‚ÚxÚyrrr ZmodalZmodelessZtrack_disk_spaceZfatalrAZ user_exitZ exit_dialogZinuseÚerrorr/ZcostingZprepZseldlgÚorderr€rªZinstall_other_condZdont_install_other_condZcostZ whichusersÚgZprogressZmaintrrrr‡Ÿs®                                                                zbdist_msi.add_uicCs<|jrd||j|jf}nd||jf}tjj|j|ƒ}|S)Nz%s.%s-py%s.msiz %s.%s.msi)rSrQr\r]r^rT)rrŠZ base_namer‹rrrrzÝs  z bdist_msi.get_installer_filename)r:Nr;úPkeep the pseudo-installation tree around after creating the distribution archive)r=r>rú6require a specific python version on the target system)r?Nr)r@rArB)rCrDrE)rFrGrH)rINrJ)rKNrL)rMNrN)r5r6r7Z descriptionrZ user_optionsZboolean_optionsrbr�rYrfrxr…r„r†r‡rzrrrrr9SsR    ([66&@r9)r8rtr\Zdistutils.corerZdistutils.dir_utilrZdistutils.sysconfigrZdistutils.versionrZdistutils.errorsrZdistutils.utilrZ distutilsrr�r r r r r rrrr9rrrrÚs       >