|yMac@sdZddlZddlZddlmZddlmZddlmZddl m Z ddl m Z ddl mZdd lmZddlZdd lmZmZmZdd lmZmZmZmZGd d d eZGdddeZdS(u# Implements the bdist_msi command. iN(uCommand(u remove_tree(uget_python_version(u StrictVersion(uDistutilsOptionError(u get_platform(ulog(uschemausequenceutext(u DirectoryuFeatureuDialoguadd_datacBst|EeZdZdZddZddZdddd Zd dd d Zd dddZddZ dS(uPyDialoguDialog 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.cOsKtj|||jd}d|d}|jdd||jddS(ubDialog(database, name, x, y, w, h, attributes, title, first, default, cancel, bitmap=true)i$iiHu BottomLineiN(uDialogu__init__uhulineuw(uselfuargsukwurulerubmwidth((u@/opt/alt/python33/lib64/python3.3/distutils/command/bdist_msi.pyu__init__s uPyDialog.__init__c Cs'|jddddddd|dS( u,Set the title text of the dialog at the top.uTitleii i@i<iu{\VerdanaBold10}%sN(utext(uselfutitle((u@/opt/alt/python33/lib64/python3.3/distutils/command/bdist_msi.pyutitle#suPyDialog.titleuBackic Cs>|rd}nd}|j|d|jddd|||S(uAdd 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(u pushbuttonuh(uselfutitleunextunameuactiveuflags((u@/opt/alt/python33/lib64/python3.3/distutils/command/bdist_msi.pyuback*s u PyDialog.backuCancelc Cs>|rd}nd}|j|d|jddd|||S(uAdd 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(u pushbuttonuh(uselfutitleunextunameuactiveuflags((u@/opt/alt/python33/lib64/python3.3/distutils/command/bdist_msi.pyucancel5s uPyDialog.canceluNextc Cs>|rd}nd}|j|d|jddd|||S(uAdd 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(u pushbuttonuh(uselfutitleunextunameuactiveuflags((u@/opt/alt/python33/lib64/python3.3/distutils/command/bdist_msi.pyunext@s u PyDialog.nextc Cs:|j|t|j|d|jdddd||S(uAdd 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(u pushbuttonuintuwuh(uselfunameutitleunextuxpos((u@/opt/alt/python33/lib64/python3.3/distutils/command/bdist_msi.pyuxbuttonKsuPyDialog.xbuttonN( u__name__u __module__u __qualname__u__doc__u__init__utitleubackucancelunextuxbutton(u __locals__((u@/opt/alt/python33/lib64/python3.3/distutils/command/bdist_msi.pyuPyDialogs    uPyDialogcBsa|EeZdZdZdedfdddefddd d fd ed d fdddfdddfdddfdedfdedfdedfg ZddddgZdddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0gZd1Z d2d3Z d4d5Z d6d7Z d8d9Z d:d;Zd<d=Zd>d?Zd@dAZdBS(Cu bdist_msiu7create a Microsoft Installer (.msi) binary distributionu bdist-dir=u1temporary directory for creating the distributionu plat-name=upu;platform name to embed in generated filenames (default: %s)u keep-tempuku/keep the pseudo-installation tree around after u!creating the distribution archiveutarget-version=u!require a specific python versionu on the target systemuno-target-compileucu/do not compile .py to .pyc on the target systemuno-target-optimizeuou:do not compile .py to .pyo (optimized)on the target systemu dist-dir=udu-directory to put final built distributions inu skip-buildu2skip rebuilding everything (for testing/debugging)uinstall-script=uTbasename of installation script to be run afterinstallation or before deinstallationupre-install-script=u{Fully qualified filename of a script to be run before any files are installed. This script need not be in the distributionu2.0u2.1u2.2u2.3u2.4u2.5u2.6u2.7u2.8u2.9u3.0u3.1u3.2u3.3u3.4u3.5u3.6u3.7u3.8u3.9uXcCsgd|_d|_d|_d|_d|_d|_d|_d|_d|_ d|_ d|_ dS(Ni( uNoneu bdist_diru plat_nameu keep_tempuno_target_compileuno_target_optimizeutarget_versionudist_diru skip_builduinstall_scriptupre_install_scriptuversions(uself((u@/opt/alt/python33/lib64/python3.3/distutils/command/bdist_msi.pyuinitialize_options}s          ubdist_msi.initialize_optionscCsr|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 |jrtdn|jrexI|j jD]%}|jtjj|kr&Pq&q&Wtd|jnd|_dS( Nubdistu skip_buildumsiuMtarget version can only be %s, or the '--skip-build' option must be specifiedudist_diru plat_nameu5the pre-install-script feature is not yet implementedu(install_script '%s' not found in scripts(u skip_buildu skip_build(udist_dirudist_dir(u plat_nameu plat_name(uset_undefined_optionsu bdist_diruNoneuget_finalized_commandu bdist_baseuosupathujoinuget_python_versionutarget_versionu distributionuhas_ext_modulesuversionsu skip_builduDistutilsOptionErrorulistu all_versionsupre_install_scriptuinstall_scriptuscriptsubasenameuinstall_script_key(uselfu bdist_baseu short_versionuscript((u@/opt/alt/python33/lib64/python3.3/distutils/command/bdist_msi.pyufinalize_optionss:       ubdist_msi.finalize_optionscCs}|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|jdrWd|j p8d|f}|jj7j.|n|j8syt9|jd|j:ndS(Nubuilduinstallureinit_subcommandsiiu install_libiu.%s-%sulibuinstalling to %suPURELIBuUNKNOWNu%d.%d.%du Python %s %su Python %su DistVersionu ARPCONTACTuARPURLINFOABOUTuPropertyu dist_filesu bdist_msiuanyudry_run(;u skip_buildu run_commandureinitialize_commandu bdist_diruprefixuwarn_dirucompileuoptimizeu distributionuhas_ext_modulesutarget_versionusysuversionu plat_nameuget_finalized_commanduosupathujoinu build_baseu build_libuloguinfouensure_finalizeduinserturunumkpathudist_diru get_fullnameuget_installer_filenameuabspathuexistsuunlinkumetadatauauthoru maintaineru get_versionu StrictVersionumsilibu init_databaseuschemaugen_uuidudbu add_tablesusequenceu author_emailumaintainer_emailuappenduurluadd_datauadd_find_pythonu add_filesu add_scriptsuadd_uiuCommituhasattru dist_filesu keep_tempu remove_treeudry_run(uselfuinstallu install_libutarget_versionuplat_specifierubuildufullnameuinstaller_nameumetadatauauthoruversionusversionu product_nameupropsuemailutup((u@/opt/alt/python33/lib64/python3.3/distutils/command/bdist_msi.pyuruns|        %                  u bdist_msi.runc 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(Nu distfilesu TARGETDIRu SourceDiruPythonu Everythingiiu directoryuuPython from another locationiuPython %s from registryu%s|%suMultiple files with name %su[#%s]u DuplicateFile(udbumsilibuCABuosupathuabspathu bdist_diru DirectoryuNoneuFeatureuversionsu other_versionuappenduCommitupopulistdiruabsoluteujoinuisdiru make_shortu componentustart_componentulogicaluadd_fileuinstall_scriptuinstall_script_keyuDistutilsOptionErroruadd_dataucommit(uselfudbucaburootdirurootufuitemsuversionutargetunameudefaultudescutitleuleveludiruseenufeatureutodoufileuafileushortunewdirukey((u@/opt/alt/python33/lib64/python3.3/distutils/command/bdist_msi.pyu add_files s\    !          +ubdist_msi.add_filesc 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(#usAdds 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.exeiu)SOFTWARE\Python\PythonCore\%s\InstallPathupython.machine.u python.user.uPYTHON.MACHINE.u PYTHON.USER.uPythonFromMachineuPythonFromUseru PythonExeu TARGETDIRuPYTHONiiu RegLocatoriu AppSearchu CustomActioni3iu[u]u ]\python.exeuInstallExecuteSequenceuInstallUISequenceu ConditionuPythoniu NOT TARGETDIRiNii3i3i3(uversionsumsilibuWin64uadd_dataudbuNone(uselfustartuveru install_pathu machine_reguuser_regu machine_propu user_propumachine_actionu user_actionu exe_actionutarget_dir_propuexe_propuType((u@/opt/alt/python33/lib64/python3.3/distutils/command/bdist_msi.pyuadd_find_pythonCsJ                       ubdist_msi.add_find_pythoncCsQ|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(Niuinstall_script.uPYTHONu CustomActioni2uInstallExecuteSequenceu &Python%s=3iupreinstall.batuwurem =""" %1 %0 exit """ uBinaryu PreInstalliu NOT Installedi(u PreInstalliu PreInstallN(u PreInstallu NOT Installedi(uinstall_scriptuversionsu other_versionuadd_dataudbuinstall_script_keyupre_install_scriptuosupathujoinu bdist_diruopenuwriteureaducloseumsilibuBinaryuNone(uselfustartuveruinstall_actionuexe_propuscriptfnuf((u@/opt/alt/python33/lib64/python3.3/distutils/command/bdist_msi.pyu add_scriptsys,            ubdist_msi.add_scriptscCsG|j}d}}d}d}d}d}d}d} t|dddddddgt|dddddgt|d dddddgt|d/tjt|d0tjt|d1||||||d2d2d2 } | jd3| jd4d2d5d| j d6d7d5d| jd8d9d:d;d<d=d>| jd?d9d@d;dAd=dB| j d2d6dCd2} | j dDdEt|dF||||||d2d2d2 } | jdG| jd4d2d5d| j d6d7d5d| jd8d9d:d;d<d=dH| jd?d9d@d;dAd=dB| j d2d6dCd2} | j dDdEt|dI||||||d2d2d2 } | jdJ| jd4d2d5d| j d6d7d5d| jdKd9dLd;dAd=dB| j d2d6dCd2} | j dDdMt|dN||||dO|dPdPdPdQd }|jdRd9dSdTd9d=dU|jdKdAdVdWdAd=dX|jdYdAdZd[ddd\|j d]d^dAd_d[d`dadbddd |jdEdcdCdE} | j dDdE|j dcdPdCdc} | j dDdc|j dPdEdCdP} | j dDdPt|d ddd[ddde|dfdd }|jdfdddWdgddh|jdidjdkdldmddndj dDdo|jdpdqdkdldmddrdj dDds|jdtddkdldmddudj dDdv|jdwdxdkdldmdd6dj dDdy|jdzdldkdldmddcdj dDd{|jd|d}dkdldmdd~dj dDd|jdddkdldmddPdj dDdt|dddddd|dndndn }|jdYdgd9dddd|jdrdkdddddrdn} | j dDdE|jdnddddddndr} | j dDdMt|ddddd||dMdMdM }|jdYdgd9dddd|jdMddddddMd} | j dDdEt|d!||||||d6d6d6 }|jdKd9d:d;dd=d|jd|jd/d9dd;dAd=d} | jd/dY|jdd9dd;dd=d} | jddY|jd7dd5d|j ddd5d|j d6d} | j ddt|d'||||||ddd6 }|jd|jdd9dddAdd|jj|jd4dd5d|j dd6} d}| j ddd|xF|j|jgD]1}|d7}| j dd|d|d|qW| j ddd|d| j dDdMd|d|j d6d} | j dd|j ddd9dddjddddd } | j dd|j}d|}d|}|jdd9dTdd9dd} | jd|| jd|| jd|| jd||j ddd9ddddd|ddd } | jd|| jd|| jd|| jd|t|d||||||ddddQd }|jdRd9dSdTd9d=d|jdKdAdAdWdAd=d|jdYdAdd[ddd|j dddAdd[dddddd |jdd~ddj dDdMt|d$||||||ddd6 }|jd|jdd9ddddddhd }|jdddddAd|jdddddAd|jd7dd5d|j dd6} | j dddd| j dDdMdd|j d6d} | j ddt|d-||||||d6d6d6dQd }|jdRdAd9dTd9d=d|jdYdddddd|jdddddAdd|jd/d:d|d:dAdd} | jd/dY|j ddddjddddddd } | jdd|jd4dd5d|j dd6d5d|j d6d7j ddt|d*||||||ddd6 }|jd|jdd9dd[dxdd|jdd9dd[ddddhd }|jddddTdd|jddddTdd|jd4dd5d|j d2d6} | j dddd| j ddddS| j dddda| j dddd| j dddd| j dddd| j dddd| j dddd| j dDdMddA|j d6dj dddS(Ni2iri,u[ProductName] Setupiii uPropertyu DefaultUIFontuDlgFont8u ErrorDialoguErrorDlgu Progress1uInstallu Progress2uinstallsuMaintenanceForm_ActionuRepairu WhichUsersuALLu TextStyleuTahomai iu DlgFontBold8iu VerdanaBold10uVerdanai u VerdanaRed9iuInstallUISequenceu PrepareDlgu(Not Privileged or Windows9x or Installediu WhichUsersDlgu.Privileged and not Windows9x and not InstallediuSelectFeaturesDlgu Not InstallediuMaintenanceTypeDlgu,Installed AND NOT RESUME AND NOT Preselectediu ProgressDlgiu ActionTextuUITextu FatalErroruFinishu)[ProductName] Installer ended prematurelyu< BackuactiveuCanceluBacku Description1iiFi@iPiu[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.u Description2iiu.Click the Finish button to exit the Installer.unameu EndDialoguExituUserExitu'[ProductName] Installer was interruptedu[ProductName] setup was interrupted. Your system has not been modified. To install this program at a later time, please run the installation again.u ExitDialogu&Completing the [ProductName] Installeru DescriptioniuReturnu FilesInUseiuRetryubitmapuTitleiiu{\DlgFontBold8}Files in Useiiu8Some files that need to be updated are currently in use.uTexti7iJuThe 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.uListuListBoxikiiuFileInUseProcessuIgnoreieiu ErrorTexti0uuNixiHiQiuNouErrorNouYiuYesuErrorYesuAuAbortu ErrorAbortuCi*u ErrorCanceluIu ErrorIgnoreuOiuOkuErrorOkuRiu ErrorRetryu CancelDlgiiUiiu;Are you sure you want to cancel [ProductName] installation?i9i8iiuWaitForCostingDlguRPlease wait while the installer finishes determining your disk space requirements.ifi(uOPlease wait while the Installer prepares to guide you through the installation.u&Welcome to the [ProductName] Installerinu Pondering...u ActionDataiuNextu SpawnDialoguSelect Python InstallationsuHintu9Select the Python locations where %s should be installed.uNext >u [TARGETDIR]u [SourceDir]uorderingu [TARGETDIR%s]u FEATURE_SELECTED AND &Python%s=3uSpawnWaitDialogiuFeaturesu SelectionTreei<uFEATUREuPathEditu[FEATURE_SELECTED]u1u!FEATURE_SELECTED AND &Python%s<>3uOtheru$Provide an alternate Python locationuEnableuShowuDisableuHideiiu TARGETDIRu DiskCostDlguOKu&{\DlgFontBold8}Disk Space RequirementsuFThe disk space required for the installation of the selected features.i5uThe 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).u VolumeListuVolumeCostListidiiu{120}{70}{70}{70}{70}g?u AdminInstalluGSelect whether to install [ProductName] for all users of this computer.iuInstall for all usersuJUSTMEiuInstall just for meu [ALLUSERS]uWhichUsers="ALL"u({\DlgFontBold8}[Progress1] [ProductName]i#iAuYPlease wait while the Installer [Progress2] [ProductName]. This may take several minutes.u StatusLabeluStatus:u ProgressBariu Progress doneu SetProgressuProgressu)Welcome to the [ProductName] Setup WizarduBodyTexti?u:Select whether you want to repair or remove [ProductName].uRepairRadioGroupiliu&Repair [ProductName]uRemovei$uRe&move [ProductName]u [REINSTALL]uMaintenanceForm_Action="Repair"u [Progress1]u Repairingu [Progress2]urepairsu Reinstallu[REMOVE]uMaintenanceForm_Action="Remove"i uRemovingi uremovesi iu MaintenanceForm_Action<>"Change"(u DefaultUIFontuDlgFont8(u ErrorDialoguErrorDlg(u Progress1uInstall(u Progress2uinstalls(uMaintenanceForm_ActionuRepair(u WhichUsersuALL(uDlgFont8uTahomai Ni(u DlgFontBold8uTahomaiNi(u VerdanaBold10uVerdanai Ni(u VerdanaRed9uVerdanai ii(u PrepareDlgu(Not Privileged or Windows9x or Installedi(u WhichUsersDlgu.Privileged and not Windows9x and not Installedi(uSelectFeaturesDlgu Not Installedi(uMaintenanceTypeDlgu,Installed AND NOT RESUME AND NOT Preselectedi(u ProgressDlgNiF(udbuadd_datauNoneutextu ActionTextuUITextuPyDialogutitleubackucancelunextueventuFalseucontroluDialogu pushbuttonumappingu distributionu get_fullnameuversionsu other_versionu conditionuxbuttonu radiogroupuadd(uselfudbuxuyuwuhutitleumodalumodelessutrack_disk_spaceufatalucu user_exitu exit_dialoguinuseuerrorucancelucostinguprepuseldlguorderuversionuveruinstall_other_condudont_install_other_conducostu whichusersuguprogressumaint((u@/opt/alt/python33/lib64/python3.3/distutils/command/bdist_msi.pyuadd_uis                .......$$$ !!        "  % ubdist_msi.add_uicCsT|jr%d||j|jf}nd||jf}tjj|j|}|S(Nu%s.%s-py%s.msiu %s.%s.msi(utarget_versionu plat_nameuosupathujoinudist_dir(uselfufullnameu base_nameuinstaller_name((u@/opt/alt/python33/lib64/python3.3/distutils/command/bdist_msi.pyuget_installer_filenames   u bdist_msi.get_installer_filenameN(u__name__u __module__u __qualname__u descriptionuNoneu get_platformu user_optionsuboolean_optionsu all_versionsu other_versionuinitialize_optionsufinalize_optionsurunu add_filesuadd_find_pythonu add_scriptsuadd_uiuget_installer_filename(u __locals__((u@/opt/alt/python33/lib64/python3.3/distutils/command/bdist_msi.pyu bdist_msiSsP     ( [ 6 6 & ?u bdist_msi(u__doc__usysuosudistutils.coreuCommandudistutils.dir_utilu remove_treeudistutils.sysconfiguget_python_versionudistutils.versionu StrictVersionudistutils.errorsuDistutilsOptionErrorudistutils.utilu get_platformu distutilsulogumsilibuschemausequenceutextu DirectoryuFeatureuDialoguadd_datauPyDialogu bdist_msi(((u@/opt/alt/python33/lib64/python3.3/distutils/command/bdist_msi.pyus ">