{fc@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((s3/usr/lib64/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((s3/usr/lib64/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((s3/usr/lib64/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((s3/usr/lib64/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((s3/usr/lib64/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((s3/usr/lib64/python2.7/distutils/command/bdist_msi.pytxbuttonLs( t__name__t __module__t__doc__RRR R"RR&(((s3/usr/lib64/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=sUbasename of installation script to be run after installation 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((s3/usr/lib64/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(R9R9(R8R8(R3R3(tset_undefined_optionsR2R1tget_finalized_commandt bdist_basetostpathtjoinRR7t distributionthas_ext_modulesR<R9Rtlistt all_versionsR;R:tscriptstbasenametinstall_script_key(RRBt short_versiontscript((s3/usr/lib64/python2.7/distutils/command/bdist_msi.pytfinalize_optionss8        cCs|js|jdn|jddd}|j|_|j|_d|_|jd}d|_d|_|jj r|j }|s|jst dt 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$} dt%| j } |jj}|j r5d|j |f} n d|} t&j'|t(| t&j)| | |_*t&j+|j*t,d| fg} |j-p|j.}|r| j/d|fn|j0r| j/d|j0fn| rt1|j*d| n|j2|j3|j4|j5|j*j6t7|jdrid|j pJd|f}|jj8j/|n|j9st:|jd|j;ndS(Ntbuildtinstalltreinit_subcommandsiit install_libs Should have already checked thisis.%s-%stlibsinstalling to %stPURELIBtUNKNOWNs%d.%d.%ds Python %s %ss Python %st DistVersiont ARPCONTACTtARPURLINFOABOUTtPropertyt dist_filesR*tanytdry_run(<R9t run_commandtreinitialize_commandR2tprefixtwarn_dirtcompiletoptimizeRFRGR7tAssertionErrortsystversionR3RARCRDREt 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_nameRsRtRftsversiont product_nametpropstemailttup((s3/usr/lib64/python2.7/distutils/command/bdist_msi.pyRls~        %                  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(RzRwtCABRCRDRpR2R R1R R<t other_versionR~RtpoptlistdirtabsoluteREtisdirt make_shortt componenttstart_componenttlogicaltadd_fileR:RLRR tcommit(RRztcabtrootdirtroottftitemsRfttargetRtdefaulttdescRtleveltdirtseentfeaturettodotfiletafiletshorttnewdirtkey((s3/usr/lib64/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}|dkstqWdS($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 TARGETDIRiiNii3i3i3(R<RwtWin64R RzR1Rd(Rtstarttvert install_patht machine_regtuser_regt machine_propt user_proptmachine_actiont user_actiont exe_actionttarget_dir_proptexe_proptType((s3/usr/lib64/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 RzRLR;RCRDRER2topentwritetreadtcloseRwRR1(RRRtinstall_actionRtscriptfnR((s3/usr/lib64/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(RzR R1R RRRRR R"RteventtFalsetcontrolR RtmappingRFRnR<Rt conditionR&t radiogrouptadd(RRztxtyRRRtmodaltmodelesstfatalR-t user_exitt exit_dialogtinuseterrorR"tcostingtpreptseldlgtorderRfRtinstall_other_condtdont_install_other_condtcostt whichuserstgtprogresstmaint((s3/usr/lib64/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((s3/usr/lib64/python2.7/distutils/command/bdist_msi.pyRos   (R'R(t descriptionR1Rt user_optionstboolean_optionsRIRR=RORlRRRRRo(((s3/usr/lib64/python2.7/distutils/command/bdist_msi.pyR*TsP     ) [ 6 6 & >(R)ReRCt sysconfigRtdistutils.coreRtdistutils.dir_utilRtdistutils.versionRtdistutils.errorsRt distutilsRtdistutils.utilRRwRRR R R R R RR*(((s3/usr/lib64/python2.7/distutils/command/bdist_msi.pyts "=