pQc@sdZddlZddlZddlmZddlmZddlmZddl m Z ddl m Z ddl mZdd lmZddlZdd lmZmZmZdd lmZmZmZmZd efd YZdefdYZdS(s# Implements the bdist_msi command. iN(tget_python_version(tCommand(t remove_tree(t StrictVersion(tDistutilsOptionError(tlog(t get_platform(tschematsequencettext(t DirectorytFeaturetDialogtadd_datatPyDialogcBsVeZdZdZdZdddZdddZddd Zd ZRS( sDialog 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|||jd}|jdd||jddS(sbDialog(database, name, x, y, w, h, attributes, title, first, default, cancel, bitmap=true)i$t BottomLineiN(R t__init__thtlinetw(tselftargstkwtruler((s1/sys/lib/python2.7/distutils/command/bdist_msi.pyRs c Cs'|jddddddd|dS( s,Set the title text of the dialog at the top.tTitleii i@i<is{\VerdanaBold10}%sN(R (Rttitle((s1/sys/lib/python2.7/distutils/command/bdist_msi.pyR$stBackic Cs>|rd}nd}|j|d|jddd|||S(sAdd 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 associatediiiii8i(t pushbuttonR(RRtnexttnametactivetflags((s1/sys/lib/python2.7/distutils/command/bdist_msi.pytback+s tCancelc Cs>|rd}nd}|j|d|jddd|||S(sAdd 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 associatediii0ii8i(RR(RRRRRR((s1/sys/lib/python2.7/distutils/command/bdist_msi.pytcancel6s tNextc Cs>|rd}nd}|j|d|jddd|||S(sAdd 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 associatediiiii8i(RR(RRRRRR((s1/sys/lib/python2.7/distutils/command/bdist_msi.pyRAs c Cs:|j|t|j|d|jdddd||S(sAdd 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 associatediii8ii(RtintRR(RRRRtxpos((s1/sys/lib/python2.7/distutils/command/bdist_msi.pytxbuttonLs( t__name__t __module__t__doc__RRR R"RR&(((s1/sys/lib/python2.7/distutils/command/bdist_msi.pyRs    t bdist_msicBs=eZdZdedfdddefdddd fd ed d fd ddfdddfdddfdedfdedfdedfg Zdd ddgZddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/gZd0Zd1Z d2Z d3Z d4Z d5Z d6Zd7Zd8ZRS(9s7create a Microsoft Installer (.msi) binary distributions bdist-dir=s1temporary directory for creating the distributions plat-name=tps;platform name to embed in generated filenames (default: %s)s keep-temptks/keep the pseudo-installation tree around after s!creating the distribution archivestarget-version=s!require a specific python versions on the target systemsno-target-compiletcs/do not compile .py to .pyc on the target systemsno-target-optimizetos:do not compile .py to .pyo (optimized)on the target systems dist-dir=tds-directory to put final built distributions ins skip-builds2skip rebuilding everything (for testing/debugging)sinstall-script=sTbasename of installation script to be run afterinstallation or before deinstallationspre-install-script=s{Fully qualified filename of a script to be run before any files are installed. This script need not be in the distributions2.0s2.1s2.2s2.3s2.4s2.5s2.6s2.7s2.8s2.9s3.0s3.1s3.2s3.3s3.4s3.5s3.6s3.7s3.8s3.9tXcCsgd|_d|_d|_d|_d|_d|_d|_d|_d|_ d|_ d|_ dS(Ni( tNonet bdist_dirt plat_namet keep_temptno_target_compiletno_target_optimizettarget_versiontdist_dirt skip_buildtinstall_scripttpre_install_scripttversions(R((s1/sys/lib/python2.7/distutils/command/bdist_msi.pytinitialize_options~s          cCsi|jdd |jdkrL|jdj}tjj|d|_nt}|j rz|j j rz||_ n|j r|j g|_ |j r|j j r|j |krtd|fqnt|j|_ |jdd d |jr tdn|jr\xF|j jD]%}|jtjj|kr Pq q Wtd|jnd|_dS( NtbdistR9tmsisMtarget version can only be %s, or the '--skip-build' option must be specifiedR8R3s5the pre-install-script feature is not yet implementeds(install_script '%s' not found in scripts(s skip_builds skip_build(sdist_dirsdist_dir(s plat_names plat_name(tset_undefined_optionsR2R1tget_finalized_commandt bdist_basetostpathtjoinRR7t distributionthas_ext_modulesR<R9Rtlistt all_versionsR;R:tscriptstbasenametinstall_script_key(RRBt short_versiontscript((s1/sys/lib/python2.7/distutils/command/bdist_msi.pytfinalize_optionss8        cCsz|js|jdn|jddd}|j|_|j|_d|_|jd}d|_d|_|jj r|j }|st j dd!}nd|j |f}|jd}tjj|jd ||_ntjd |j|jt jjdtjj|jd |jt jd=|j|j|jj}|j|}tjj|}tjj|rtj|n|jj }|j!} | s|j"} n| sd } n|j#} d t$| j } |jj}|j r d|j |f} n d|} t%j&|t'| t%j(| | |_)t%j*|j)t+d| fg} |j,p|j-}|r| j.d|fn|j/r| j.d|j/fn| rt0|j)d| n|j1|j2|j3|j4|j)j5t6|jdrTd|j p5d|f}|jj7j.|n|j8svt9|jd|j:ndS(Ntbuildtinstalltreinit_subcommandsiit install_libis.%s-%stlibsinstalling to %stPURELIBtUNKNOWNs%d.%d.%ds Python %s %ss Python %st DistVersiont ARPCONTACTtARPURLINFOABOUTtPropertyt dist_filesR*tanytdry_run(;R9t run_commandtreinitialize_commandR2tprefixtwarn_dirtcompiletoptimizeRFRGR7tsystversionR3RARCRDREt build_baset build_libRtinfotensure_finalizedtinserttruntmkpathR8t get_fullnametget_installer_filenametabspathtexiststunlinktmetadatatauthort maintainert get_versionRtmsilibt init_databaseRtgen_uuidtdbt add_tablesRt author_emailtmaintainer_emailtappendturlR tadd_find_pythont add_filest add_scriptstadd_uitCommitthasattrR[R4RR](RRQRSR7tplat_specifierRPtfullnametinstaller_nameRrRsRetsversiont product_nametpropstemailttup((s1/sys/lib/python2.7/distutils/command/bdist_msi.pyRks|        %                  c Cs|j}tjd}tjj|j}t||d|dd}t |ddddddd}||d fg}x|j |j gD]}d|}d|} } d} ||j krd } d } nd |} d} t || | | d| d|}t|||||| }|j |||fqW|j i}x|D]\}}}|g}xg|r|j}xNtj|jD]:}tjj|j|}tjj|r d |j||f}||} t||||| |}|j |q|js.|j|j|dn||kr|j|}||<||jkr|jr|td|nd||_qq||}t|jd|||j|d|jfgqWqiW|j qNW|j|dS(Nt distfilest TARGETDIRt SourceDirtPythont Everythingiit directorytsPython from another locationisPython %s from registrys%s|%ssMultiple files with name %ss[#%s]t DuplicateFile(RyRvtCABRCRDRoR2R R1R R<t other_versionR}RtpoptlistdirtabsoluteREtisdirt make_shortt componenttstart_componenttlogicaltadd_fileR:RLRR tcommit(RRytcabtrootdirtroottftitemsRettargetRtdefaulttdescRtleveltdirtseentfeaturettodotfiletafiletshorttnewdirtkey((s1/sys/lib/python2.7/distutils/command/bdist_msi.pyRs\    !          +c Csd}x|jD]}d|}d|}d|}d|}d|}d|}d|} d |} d |} d |} tjrd} nd } t|jd|d |d| f|d|d| fgt|jd||f||fgt|jd|d | d|df| d!| d|df| d"| d| dfgt|jd|||f| ||df| d|d fgt|jd|||f| ||df| d|d fgt|jdd|dd|fg|d7}qWdS(#ssAdds 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.exeis)SOFTWARE\Python\PythonCore\%s\InstallPathspython.machine.s python.user.sPYTHON.MACHINE.s PYTHON.USER.tPythonFromMachinetPythonFromUsert PythonExeRtPYTHONiit RegLocatorit AppSearcht CustomActioni3it[t]s ]\python.exetInstallExecuteSequencetInstallUISequencet ConditionRis NOT TARGETDIRiNii3i3i3(R<RvtWin64R RyR1(Rtstarttvert install_patht machine_regtuser_regt machine_propt user_proptmachine_actiont user_actiont exe_actionttarget_dir_proptexe_proptType((s1/sys/lib/python2.7/distutils/command/bdist_msi.pyREsJ                       cCsQ|jrd}x|j|jgD]l}d|}d|}t|jd|d||jfgt|jd|d||fg|d7}q#Wn|jrMtjj |j d }t |d }|j d |j t |jj |jt|jd d tj|fgt|jddgt|jddgndS(Nisinstall_script.RRi2Rs &Python%s=3ispreinstall.batRsrem =""" %1 %0 exit """ tBinaryt PreInstallis NOT Installedi(RiRN(Rs NOT Installedi(R:R<RR RyRLR;RCRDRER2topentwritetreadtcloseRvRR1(RRRtinstall_actionRtscriptfnR((s1/sys/lib/python2.7/distutils/command/bdist_msi.pyR{s,            cCsA|j}d}}d}d}d}d}d}t|dddddddgt|dddddgt|ddddddgt|d.tjt|d/tjt|d0||||||d1d1d1 } | jd2| jd3d1d4d| j d5d6d4d| jd7d8d9d:d;d<d=| jd>d8d?d:d@d<dA| j d1d5dBd1} | j dCdDt|dE||||||d1d1d1 } | jdF| jd3d1d4d| j d5d6d4d| jd7d8d9d:d;d<dG| jd>d8d?d:d@d<dA| j d1d5dBd1} | j dCdDt|dH||||||d1d1d1 } | jdI| jd3d1d4d| j d5d6d4d| jdJd8dKd:d@d<dA| j d1d5dBd1} | j dCdLt|dM||||dN|dOdOdOdPt } | jdQd8dRdSd8d<dT| jdJd@dUdVd@d<dW| jdXd@dYdZddd[| j d\d]d@d^dZd_d`daddd | jdDdbdBdD} | j dCdD| j dbdOdBdb} | j dCdb| j dOdDdBdO} | j dCdOt|d dddZdcdd|dedd }|jdedddVdfddg|jdhdidjdkdlddmdj dCdn|jdodpdjdkdlddqdj dCdr|jdsddjdkdlddtdj dCdu|jdvdwdjdkdldd5dj dCdx|jdydkdjdkdlddbdj dCdz|jd{d|djdkdldd}dj dCd~|jdddjdkdlddOdj dCdt|dddddd|dmdmdm }|jdXdfd8dddd|jdqdjdddddqdm} | j dCdD|jdmddddddmdq} | j dCdLt|ddddd||dLdLdL }|jdXdfd8dddd|jdLddddddLd} | j dCdDt|d ||||||d5d5d5 }|jdJd8d9d:dd<d|jd|jd.d8dd:d@d<d} | jd.dX|jdd8dd:dd<d} | jddX|jd6dd4d|j ddd4d|j d5d} | j ddt|d&||||||ddd5 }|jd|jdd8ddd@dd|jj|jd3dd4d|j dd5} d}| j ddd|xF|j|jgD]1}|d7}| j dd|d|d|qW| j ddd|d| j dCdLd|d|j d5d} | j dd|j ddd8dddiddddd } | j dd|j}d|}d|}|jdd8dSdd8dd} | jd|| jd|| jd|| jd||j ddd8ddddd|ddd } | jd|| jd|| jd|| jd|t|d||||||ddddPt }|jdQd8dRdSd8d<d|jdJd@d@dVd@d<d|jdXd@ddZddd|j ddd@ddZdddddd |jdd}ddj dCdLt|d#||||||ddd5 }|jd|jdd8ddddddgd }|jddddd@d|jddddd@d|jd6dd4d|j dd5} | j dddd| j dCdLdd|j d5d} | j ddt|d,||||||d5d5d5dPt }|jdQd@d8dSd8d<d|jdXdddddd|jddddd@dd|jd.d9d|d9d@dd} | jd.dX|j ddddiddddddd } | jdd|jd3dd4t |j dd5d4t |j d5d6j ddt|d)||||||ddd5 }|jd|jdd8ddZdwdd|jdd8ddZddddgd }|jddddSdd|jddddSdd|jd3dd4t |j d1d5} | j dddd| j ddddR| j dddd`| j dddd| j dddd| j dddd| j dddd| j dddd| j dCdLdd@|j d5dj dddS(Ni2iri,s[ProductName] SetupiiRZt DefaultUIFonttDlgFont8t ErrorDialogtErrorDlgt Progress1tInstallt Progress2tinstallstMaintenanceForm_ActiontRepairt WhichUserstALLt TextStyletTahomai it DlgFontBold8it VerdanaBold10tVerdanai t VerdanaRed9iRt PrepareDlgs(Not Privileged or Windows9x or Installedit WhichUsersDlgs.Privileged and not Windows9x and not InstalleditSelectFeaturesDlgs Not InstalleditMaintenanceTypeDlgs,Installed AND NOT RESUME AND NOT Preselectedit ProgressDlgit ActionTexttUITextt FatalErrortFinishs)[ProductName] Installer ended prematurelys< BackRR!Rt Description1iiFi@iPis[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.t Description2iis.Click the Finish button to exit the Installer.Rt EndDialogtExittUserExits'[ProductName] Installer was interrupteds[ProductName] setup was interrupted. Your system has not been modified. To install this program at a later time, please run the installation again.t ExitDialogs&Completing the [ProductName] Installert DescriptionitReturnt FilesInUseitRetrytbitmapRiis{\DlgFontBold8}Files in Useiis8Some files that need to be updated are currently in use.tTexti7iJsThe 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.tListtListBoxikiitFileInUseProcesstIgnoreieit ErrorTexti0RtNixiHiQitNotErrorNotYitYestErrorYestAtAbortt ErrorAborttCi*t ErrorCanceltIt ErrorIgnoretOitOktErrorOktRit ErrorRetryt CancelDlgiiUiis;Are you sure you want to cancel [ProductName] installation?i9i8iitWaitForCostingDlgsRPlease wait while the installer finishes determining your disk space requirements.ifi(sOPlease wait while the Installer prepares to guide you through the installation.s&Welcome to the [ProductName] Installerins Pondering...t ActionDataiR#t SpawnDialogsSelect Python InstallationstHints9Select the Python locations where %s should be installed.sNext >s [TARGETDIR]s [SourceDir]torderings [TARGETDIR%s]s FEATURE_SELECTED AND &Python%s=3tSpawnWaitDialogitFeaturest SelectionTreei<tFEATUREtPathEdits[FEATURE_SELECTED]t1s!FEATURE_SELECTED AND &Python%s<>3tOthers$Provide an alternate Python locationtEnabletShowtDisabletHideiiRt DiskCostDlgtOKs&{\DlgFontBold8}Disk Space RequirementssFThe disk space required for the installation of the selected features.i5sThe 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).t VolumeListtVolumeCostListidiis{120}{70}{70}{70}{70}g?t AdminInstallsGSelect whether to install [ProductName] for all users of this computer.isInstall for all userstJUSTMEisInstall just for mes [ALLUSERS]sWhichUsers="ALL"s({\DlgFontBold8}[Progress1] [ProductName]i#iAsYPlease wait while the Installer [Progress2] [ProductName]. This may take several minutes.t StatusLabelsStatus:t ProgressBaris Progress donet SetProgresstProgresss)Welcome to the [ProductName] Setup WizardtBodyTexti?s:Select whether you want to repair or remove [ProductName].tRepairRadioGroupilis&Repair [ProductName]tRemovei$sRe&move [ProductName]s [REINSTALL]sMaintenanceForm_Action="Repair"s [Progress1]t Repairings [Progress2]trepairst Reinstalls[REMOVE]sMaintenanceForm_Action="Remove"i tRemovingi tremovesi is MaintenanceForm_Action<>"Change"(RR(RR(RR(RR(RR(RR(RRi Ni(RRiNi(RRi Ni(RRi ii(Rs(Not Privileged or Windows9x or Installedi(Rs.Privileged and not Windows9x and not Installedi(Rs Not Installedi(Rs,Installed AND NOT RESUME AND NOT Preselectedi(RNi(RyR R1R RRRRR R"RteventtFalsetcontrolR RtmappingRFRmR<Rt conditionR&t radiogrouptadd(RRytxtyRRRtmodaltmodelesstfatalR-t user_exitt exit_dialogtinuseterrorR"tcostingtpreptseldlgtorderReRtinstall_other_condtdont_install_other_condtcostt whichuserstgtprogresstmaint((s1/sys/lib/python2.7/distutils/command/bdist_msi.pyRs                .......$$$ !!        "  % cCsT|jr%d||j|jf}nd||jf}tjj|j|}|S(Ns%s.%s-py%s.msis %s.%s.msi(R7R3RCRDRER8(RRt base_nameR((s1/sys/lib/python2.7/distutils/command/bdist_msi.pyRns   (R'R(t descriptionR1Rt user_optionstboolean_optionsRIRR=RORkRRRRRn(((s1/sys/lib/python2.7/distutils/command/bdist_msi.pyR*TsP     ) [ 6 6 & >(R)RdRCt sysconfigRtdistutils.coreRtdistutils.dir_utilRtdistutils.versionRtdistutils.errorsRt distutilsRtdistutils.utilRRvRRR R R R R RR*(((s1/sys/lib/python2.7/distutils/command/bdist_msi.pyts "=