3  f@sdZddlZddlZddlmZddlmZddlmZddl m Z ddl m Z ddl mZdd 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|f||jd}d|d}|jdd||jddS)zbDialog(database, name, x, y, w, h, attributes, title, first, default, cancel, bitmap=true)$iHZ BottomLinerN)r__init__hlinew)selfargskwZrulerZbmwidthr@/opt/alt/python36/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 )rtitlerrrr #szPyDialog.titleBackc Cs,|r d}nd}|j|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) pushbuttonr)rr nextnameactiveflagsrrrback*sz PyDialog.backCancelc Cs,|r d}nd}|j|d|jddd|||S)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(r)rr r)r*r+r,rrrcancel5szPyDialog.cancelNextc Cs,|r d}nd}|j|d|jddd|||S)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(r)rr r)r*r+r,rrrr)@sz PyDialog.nextc Cs,|j|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)rr*r r)ZxposrrrxbuttonKszPyDialog.xbuttonN)r!r")r.r")r0r") __name__ __module__ __qualname____doc__rr r-r/r)r4rrrrrs  rc@seZdZdZdCdddefdEdGdHdIdJdKdLdMg ZddddgZddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1gZd2Zd3d4Z d5d6Z d7d8Z d9d:Z d;d<Z d=d>Zd?d@ZdAdBZdS)N bdist_msiz7create a Microsoft Installer (.msi) binary distribution bdist-dir=N1temporary directory for creating the distributionz plat-name=pz;platform name to embed in generated filenames (default: %s) keep-tempkz/keep the pseudo-installation tree around after z!creating the distribution archivetarget-version=z!require a specific python versionz on the target systemno-target-compilec/do not compile .py to .pyc on the target systemno-target-optimizeo;do not compile .py to .pyo (optimized) on the target system dist-dir=d-directory to put final built distributions in skip-build2skip rebuilding everything (for testing/debugging)install-script=Ubasename of installation script to be run after installation or before deinstallationpre-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.9XcCsFd|_d|_d|_d|_d|_d|_d|_d|_d|_d|_ d|_ dS)Nr) bdist_dir plat_name keep_tempZno_target_compileZno_target_optimizetarget_versiondist_dir skip_buildinstall_scriptpre_install_scriptversions)rrrrinitialize_options}szbdist_msi.initialize_optionscCs|jdd |jdkr2|jdj}tjj|d|_t}|j rP|j j rP||_|jr|jg|_ |j r|j j r|j|krt d|fn t|j|_ |jdd d |jrt d|jrx2|j jD]}|jtjj|krPqWt d|jd|_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_optionsrPget_finalized_command bdist_baseospathjoinrrS distributionhas_ext_modulesrXrUrlist all_versionsrWrVscriptsbasenameinstall_script_key)rr[Z short_versionZscriptrrrfinalize_optionss:        zbdist_msi.finalize_optionscCs|js|jd|jddd}|j|_|j|_d|_|jd}d|_d|_|jj r|j }|s~|jslt ddt j dd }d |j|f}|jd}tjj|jd ||_tjd |j|jt jjdtjj|jd |jt jd=|j|j|jj}|j|}tjj|}tjj|r0tj ||jj!}|j"} | sJ|j#} | sTd} |j$} dt%| j&} |jj}|j rd|j |f} nd|} t'j(|t)| t'j*| | |_+t'j,|j+t-d| fg} |j.p|j/}|r| j0d|f|j1r| j0d|j1f| rt2|j+d| |j3|j4|j5|j6|j+j7t8|jdrld|j pXd|f}|jj9j0||j:st;|j|j| jd?d9d@d;dAd=dB| j d2d6d2dC} | j dDdEt|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 locationZEnableZShowZDisableZHiderrZ 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 VolumeListZVolumeCostListdiz{120}{70}{70}{70}{70}g?Z AdminInstallzGSelect whether to install [ProductName] for all users of this computer.zInstall for all usersZJUSTMEzInstall 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].ZRepairRadioGrouplrz&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")rr)rr)rr)rr)rr)rr)rrrNr)rrrNr")rrrNr")rrrrr)rrr)rrr)rrr)rrr)rNr)rrr rrrr r-r/r)ZeventZcontrolrr(mappingr_ryrXrZ conditionr4Z radiogroupadd)rrxyrrr ZmodalZmodelessZtrack_disk_spaceZfatalrAZ user_exitZ exit_dialogZinuseerrorr/ZcostingZprepZseldlgorderrrZinstall_other_condZdont_install_other_condZcostZ whichusersgZprogressZmaintrrrrs                                                                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)rrZ base_namerrrrrzs  z bdist_msi.get_installer_filename)r:Nr;Pkeep the pseudo-installation tree around after creating the distribution archive)r=r>r6require a specific python version on the target system)r?Nr)r@rArB)rCrDrE)rFrGrH)rINrJ)rKNrL)rMNrN)r5r6r7Z descriptionrZ user_optionsZboolean_optionsrbrrYrfrxrrrrrzrrrrr9SsR    ([66&@r9)r8rtr\Zdistutils.corerZdistutils.dir_utilrZdistutils.sysconfigrZdistutils.versionrZdistutils.errorsrZdistutils.utilrZ distutilsrrr r r r r rrrr9rrrrs       >