��Qc@sdZddlZddlZddlmZddlmZddlmZddl m
Z
ddlmZddl
mZdd lmZddlZdd
lmZmZmZddlmZmZmZmZdefd
��YZdefd��YZdS(s#
Implements the bdist_msi command.
i�N(tget_python_version(tCommand(tremove_tree(t
StrictVersion(tDistutilsOptionError(tlog(tget_platform(tschematsequencettext(t DirectorytFeaturetDialogtadd_datatPyDialogcBsVeZdZd�Zd�Zddd�Zddd�Zddd �Zd
�ZRS(s�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||�|jd}|jdd||jd�dS(sbDialog(database, name, x, y, w, h, attributes, title, first,
default, cancel, bitmap=true)i$t
BottomLineiN(Rt__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(s�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 associatediii�ii8i(t
pushbuttonR(RRtnexttnametactivetflags((s1/sys/lib/python2.7/distutils/command/bdist_msi.pytback+s tCancelc Cs>|rd}nd}|j|d|jddd|||�S(s�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 associatediii0ii8i(RR(RRRRRR((s1/sys/lib/python2.7/distutils/command/bdist_msi.pytcancel6s tNextc Cs>|rd}nd}|j|d|jddd|||�S(s�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 associatediii�ii8i(RR(RRRRRR((s1/sys/lib/python2.7/distutils/command/bdist_msi.pyRAs c Cs:|j|t|j|d�|jdddd||�S(s�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 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=eZdZdedfddde�fdddd fd
eddfd
ddfdddfdddfdedfdedfdedfg
Zdd
ddgZddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/gZd0Zd1�Z d2�Z
d3�Zd4�Zd5�Z
d6�Zd7�Zd8�ZRS(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|jd�j}tjj|d�|_nt�}|j rz|j
j�rz||_ n|j r�|j g|_|j
r�j
j�r�j |kr�d|f�q�t|j�|_|jdd
d�|jr
td�n|jr\xF|j
jD]%}|jtjj|�kr Pq q Wtd|j�nd|_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_basetostpathtjoinRR7tdistributionthas_ext_modulesR<R9Rtlisttall_versionsR;R:tscriptstbasenametinstall_script_key(RRBt
short_versiontscript((s1/sys/lib/python2.7/distutils/command/bdist_msi.pytfinalize_options�s8
cCsz|js|jd�n|jddd�}|j|_|j|_d|_|jd�}d|_d|_|jj �r�j
}|s�tjdd!}nd|j
|f}|jd�}tjj|jd |�|_ntjd
|j�|j�tjjdtjj|jd��|j�tjd=|j|j�|jj�}|j|�}tjj|�}tjj|�r�tj|�n|jj }|j!} | s�|j"} n| s�d} 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|f�n|j/r�|
j.d|j/f�n|
r�t0|j)d|
�n|j1�|j2�|j3�|j4�|j)j5�t6|jd�rTd|j
p5d|f}|jj7j.|�n|j8svt9|jd|j:�ndS(Ntbuildtinstalltreinit_subcommandsiitinstall_libis.%s-%stlibsinstalling to %stPURELIBtUNKNOWNs%d.%d.%dsPython %s %ss Python %stDistVersiont
ARPCONTACTtARPURLINFOABOUTtPropertyt
dist_filesR*tanytdry_run(;R9trun_commandtreinitialize_commandR2tprefixtwarn_dirtcompiletoptimizeRFRGR7tsystversionR3RARCRDREt
build_baset build_libRtinfotensure_finalizedtinserttruntmkpathR8tget_fullnametget_installer_filenametabspathtexiststunlinktmetadatatauthort
maintainertget_versionRtmsilibt
init_databaseRtgen_uuidtdbt
add_tablesRtauthor_emailtmaintainer_emailtappendturlR
tadd_find_pythont add_filestadd_scriptstadd_uitCommitthasattrR[R4RR](RRQRSR7tplat_specifierRPtfullnametinstaller_nameRrRsRetsversiontproduct_nametpropstemailttup((s1/sys/lib/python2.7/distutils/command/bdist_msi.pyRk�s|
%
c
Cs�|j}tjd�}tjj|j�}t||d|dd�}t |ddddddd�}||d fg}x�|j
|jgD]�}d|}d|} }
d}||jkr�d
}d}
nd|}d}
t || ||d|
d|�}t||||||
�}|j|||f�q�W|j
�i}x�|D]�\}}}|g}xg|r�|j�}xNtj|j�D]:}tjj|j|�}tjj|�rd
|j|�|f}||}
t|||||
|�}|j|�q�|js.|j|j|d�n||kr�|j|�}||<||jkr�|jr|td|��nd||_q�q�||}t|jd|||j|d|jfg�q�WqiW|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
R1RR<t
other_versionR}R�tpoptlistdirtabsoluteREtisdirt
make_shortt componenttstart_componenttlogicaltadd_fileR:RLRR
tcommit(RRytcabtrootdirtroottftitemsRettargetRtdefaulttdescRtleveltdirtseentfeaturettodotfiletafiletshorttnewdirtkey((s1/sys/lib/python2.7/distutils/command/bdist_msi.pyR�s\
!
+cCs�d}x�jD]�d|}d|}d|}d|}d|}d|}d|} d |}
d
|}d|}tjr�d}
nd}
t|jd|d|d|
f|d|d|
fg�t|jd||f||fg�t|jd|d |d|df| d!|d|df|
d"|d|dfg�t|jd|||f| ||df|
d|dfg�t|jd|||f| ||df|
d|dfg�t|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.exei�s)SOFTWARE\Python\PythonCore\%s\InstallPathspython.machine.spython.user.sPYTHON.MACHINE.sPYTHON.USER.tPythonFromMachinetPythonFromUsert PythonExeR�tPYTHONiit
RegLocatorit AppSearchtCustomActioni3it[t]s]\python.exetInstallExecuteSequencetInstallUISequencet ConditionR�is
NOT TARGETDIRiNii3i3i3(R<RvtWin64R
RyR1(Rtstarttvertinstall_pathtmachine_regtuser_regtmachine_propt user_proptmachine_actiontuser_actiont
exe_actionttarget_dir_proptexe_proptType((s1/sys/lib/python2.7/distutils/command/bdist_msi.pyREsJ
cCsQ|jr�d}x�|j|jgD]l}d|}d|}t|jd|d||jfg�t|jd|d||fg�|d7}q#Wn|jrMtjj |j
d �}t|d
�}|jd�|jt|j�j
��|j�t|jdd
tj|�fg�t|jddg�t|jddg�ndS(Ni�sinstall_script.R�R�i2R�s&Python%s=3ispreinstall.batRsrem ="""
%1 %0
exit
"""
tBinaryt
PreInstallis
NOT Installedi�(R�iR�N(R�s
NOT Installedi�(R:R<R�R
RyRLR;RCRDRER2topentwritetreadtcloseRvR�R1(RR�R�tinstall_actionR�tscriptfnR�((s1/sys/lib/python2.7/distutils/command/bdist_msi.pyR�{s,
cCsA|j}d}}d}d}d}d}d}t|dd�d�d�g�t|dd�d�g�t|dd�d�d��t|d.tj�t|d/tj�t|d0||||||d1d1d1�} | jd2�| jd3d1d4d�| j d5d6d4d�| jd7d8d9d:d;d<d=�| jd>d8d?d:d@d<dA�| j
d1d5dBd1�}
|
jdCdD�t|dE||||||d1d1d1�}|jdF�|jd3d1d4d�|j d5d6d4d�|jd7d8d9d:d;d<dG�|jd>d8d?d:d@d<dA�|j
d1d5dBd1�}
|
jdCdD�t|dH||||||d1d1d1�}|jdI�|jd3d1d4d�|j d5d6d4d�|jdJd8dKd:d@d<dA�|j
d1d5dBd1�}
|
jdCdL�t|dM||||dN|dOdOdOdPt�}
|
jdQd8dRdSd8d<dT�|
jdJd@dUdVd@d<dW�|
jdXd@dYdZddd[�|
j
d\d]d@d^dZd_d`daddd�|
jdDdbdBdD�}
|
jdCdD�|
j
dbdOdBdb�}
|
jdCdb�|
j dOdDdBdO�}
|
jdCdO�t|ddddZdcdd|dedd�}|jdedddVdfddg�|jdhdidjdkdlddmd�jdCdn�|jdodpdjdkdlddqd�jdCdr�|jdsddjdkdlddtd�jdCdu�|jdvdwdjdkdldd5d�jdCdx�|jdydkdjdkdlddbd�jdCdz�|jd{d|djdkdldd}d�jdCd~�|jdd�djdkdlddOd�jdCd��t|d�ddd�d�d|dmdmdm�}|jdXdfd8d�d�dd��|jdqdjd�d�d�ddqdm�}
|
jdCdD�|jdmd�d�d�d�ddmdq�}
|
jdCdL�t|d�ddd�d�||dLdLdL�}|jdXdfd8d�d�dd��|jdLd�d�d�d�ddLd�}
|
jdCdD�t|d ||||||d5d5d5�}|jdJd8d9d:d�d<d��|jd��|jd.d8d�d:d@d<d��}
|
jd.dX�|jd�d8d�d:d�d<d�}
|
jd�dX�|jd6dd4d�|j
d�dd4d�|j d5d�}
|
jd�d��t|d&||||||d�d�d5�}|jd��|jd�d8d�dd@dd�|jj��|jd3dd4d�|j
d�d5�}
d}|
jd�d�d�|�xF|j|jgD]1}|d7}|
jd�d�|d�|d�|�q�W|
jd�d�d�|d�|
jdCdLd�|d��|j d5d��}
|
jd�d��|j
d�d�d8d�ddidd�dd�d�}
|
jd�d��|j}d�|}d�|}|jd�d8dSdd8dd��}
|
jd�|�|
jd�|�|
jd�|�|
jd�|�|j
d�d�d8d�dd�dd�|dd�d�}
|
jd�|�|
jd�|�|
jd�|�|
jd�|�t|d�||||||d�d�d�dPt�}|jdQd8dRdSd8d<d��|jdJd@d@dVd@d<d��|jdXd@d�dZd�dd��|j
d�d�d@d�dZd�d�dd�dd�|jd�d}dd��jdCdL�t|d#||||||d�d�d5�}|jd��|jd�d8d�d�ddddgd��}|jddd�d�d@d��|jd�dd�d�d@d��|jd6dd4d�|j
d�d5�}
|
jd�d�d�d�|
jdCdLd�d��|j d5d��}
|
jd�d��t|d,||||||d5d5d5dPt�}|jdQd@d8dSd8d<d��|jdXd�d�dd�dd��|jd�d�d�d�d@dd��|jd.d9d�|d9d@dd��}
|
jd.dX�|j
d�d�d�diddd�dd�dd�}
|
jd�d��|jd3d�d4t�|j
d�d5d4t�|j d5d6�jd�d��t|d)||||||d�d�d5�}|jd��|jd�d8d�dZdwdd��|jd�d8d�dZd�dddgd��}|jddd�dSd�d��|jd�dd�dSd�d��|jd3dd4t�|j
d1d5�}
|
jd�d���|
jd���R�|
jd���`�|
jd�d��|
jd�d��|
jd����|
jd����|
jd�dd��|
jdCdLd�@�|j d5d��jd�d��dS(�Ni2iri,s[ProductName] SetupiiRZt
DefaultUIFonttDlgFont8tErrorDialogtErrorDlgt Progress1tInstallt Progress2tinstallstMaintenanceForm_ActiontRepairt
WhichUserstALLt TextStyletTahomai itDlgFontBold8it
VerdanaBold10tVerdanai
tVerdanaRed9i�R�t
PrepareDlgs(Not Privileged or Windows9x or Installedi�t
WhichUsersDlgs.Privileged and not Windows9x and not Installedi�tSelectFeaturesDlgs
Not Installedi�tMaintenanceTypeDlgs,Installed AND NOT RESUME AND NOT Preselectedi�tProgressDlgit
ActionTexttUITextt
FatalErrortFinishs)[ProductName] Installer ended prematurelys< BackRR!RtDescription1iiFi@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.tDescription2i�is.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] InstallertDescriptioni�tReturnt
FilesInUseitRetrytbitmapRii�s{\DlgFontBold8}Files in Useiis8Some files that need to be updated are currently in use.tTexti7iJs�The 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.tListtListBoxiki�itFileInUseProcesstIgnoreieit ErrorTexti0R�tNixiHiQitNotErrorNotYi�tYestErrorYestAtAbortt
ErrorAborttCi*tErrorCanceltItErrorIgnoretOi�tOktErrorOktRi�t
ErrorRetryt CancelDlgiiUi�is;Are you sure you want to cancel [ProductName] installation?i9i8ii�tWaitForCostingDlgsRPlease 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] InstallerinsPondering...t
ActionDatai�R#tSpawnDialogsSelect 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 locationtEnabletShowtDisabletHidei�iR�tDiskCostDlgtOKs&{\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
VolumeListtVolumeCostListidi�is{120}{70}{70}{70}{70}g�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.tStatusLabelsStatus:tProgressBaris
Progress donetSetProgresstProgresss)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"itRemovingitremovesi
is MaintenanceForm_Action<>"Change"(R�R�(R�R�(R�R�(R�R�(R�R�(R�R�(R�R�i Ni(R�R�iNi(R�R�i
Ni(R�R�i i�i(R�s(Not Privileged or Windows9x or Installedi�(R�s.Privileged and not Windows9x and not Installedi�(R�s
Not Installedi�(R�s,Installed AND NOT RESUME AND NOT Preselectedi�(R�Ni(RyR
R1R R�R�RRR R"RteventtFalsetcontrolRRtmappingRFRmR<R�t conditionR&t
radiogrouptadd(RRytxtyRRRtmodaltmodelesstfatalR-t user_exittexit_dialogtinuseterrorR"tcostingtpreptseldlgtorderReR�tinstall_other_condtdont_install_other_condtcostt
whichuserstgtprogresstmaint((s1/sys/lib/python2.7/distutils/command/bdist_msi.pyR��s�
.......$$$
!!
"
%
cCsT|jr%d||j|jf}nd||jf}tjj|j|�}|S(Ns%s.%s-py%s.msis %s.%s.msi(R7R3RCRDRER8(RR�t base_nameR�((s1/sys/lib/python2.7/distutils/command/bdist_msi.pyRn�s (R'R(tdescriptionR1Rtuser_optionstboolean_optionsRIR�R=RORkR�RR�R�Rn(((s1/sys/lib/python2.7/distutils/command/bdist_msi.pyR*TsP
) [ 6 6 & �R)RdRCt sysconfigRtdistutils.coreRtdistutils.dir_utilRtdistutils.versionRtdistutils.errorsRt distutilsRtdistutils.utilRRvRRR R
RRR
RR*(((s1/sys/lib/python2.7/distutils/command/bdist_msi.pyt<module>s"=
|