³ò ”,9Mc @sdZdZddkZddkZddklZddklZddkTddk l Z ddk l Z d „Z d „Zd „Zd „Zd „Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„ZedeeeƒddƒZd„ZdS(s,SCons.Tool.packaging.msi The msi packager. sEsrc/engine/SCons/Tool/packaging/msi.py 4629 2010/01/17 22:23:21 sconsiÿÿÿÿN(tAction(tBuilder(t*(tescape(tstripinstallbuildercsÀd‰|ddjo|d|7}nt‡fd†|ƒ}y|||SWnhtj o\|i|ƒph||<||DsN(tfiltertKeyErrorthas_keytstrtlen(tstid_settid((Rs=install/lib/scons-1.2.0.d20100117/SCons/Tool/packaging/msi.pyt convert_to_id,s"cCsxtii|ƒ\}}t|ƒdjp!dt|ƒjo djn}|iƒot|ƒdj}|o|S(s3 examine if the given file is in the 8.3 form. iiii(tostpathtsplitextR tisupper(tfiletfnametextt proper_extt proper_fname((s=install/lib/scons-1.2.0.d20100117/SCons/Tool/packaging/msi.pytis_dos_short_file_nameRs6cs3t|ƒo|Sntii|ƒ\}}|iƒ}t|ƒo|Snd‰t‡fd†|ƒ}d d}}x„|o|d|dtt|ƒƒ iƒt|ƒf}t|ƒdjod||d iƒf}n||j|d}}q}Wt|ƒpt d||f‚|i |ƒ|S( s: see http://support.microsoft.com/default.aspx?scid=kb;en-us;Q142982 These are no complete 8.3 dos short names. The ~ char is missing and replaced with one character from the filename. WiX warns about such filenames, since a collision might occur. Google for "CNDL1014" for more information. s ."/[]:;=, cs |ˆjS(((R(t forbidden(s=install/lib/scons-1.2.0.d20100117/SCons/Tool/packaging/msi.pyRpsis%s%siiisshortname is %s, longname is %sN( RRRRtupperR tNoneR R tAssertionErrortappend(Rt filename_setRRt duplicatetnumt shortname((Rs=install/lib/scons-1.2.0.d20100117/SCons/Tool/packaging/msi.pytgen_dos_short_file_name[s&    ! cs|h‰‡fd†}x`|D]X}t|dƒo||i|ƒqt|dƒo|d|ƒq|d|ƒqWˆS(s X_MSI_FEATURE and doc FileTag's can be used to collect files in a hierarchy. This function collects the files into this hierarchy. csgtii|ƒp |g}nx@|D]8}ˆi|ƒp|gˆ|Wd S(sŠ generates globally unique identifiers for parts of the xml which need them. Component tags have a special requirement. Their UUID is only allowed to change if the list of their contained resources has changed. This allows for clean removal and proper updates. To handle this requirement, the uuid is generated with an md5 hashing the whole subtree of a xml node. iÿÿÿÿ(tmd5tIdtProducttPackagetGuidt Components%s-%s-%s-%s-%sii iiN(thashlibR3titemstgetElementsByTagNamettoxmlt hexdigestt attributes( trootR3tneeds_idtkeytvaluet node_listt attributetnodethashthash_str((s=install/lib/scons-1.2.0.d20100117/SCons/Tool/packaging/msi.pytgenerate_guids›s     6cCsd|diS(Nsbuilding WiX file %si(R(ttargettsourcetenv((s=install/lib/scons-1.2.0.d20100117/SCons/Tool/packaging/msi.pytstring_wxsfileºsc CsNt|didƒ}yÿtƒ}|idƒ}d|id<|i|ƒg}h}t||ƒt|||d|d|d||ƒt|ƒt |||d|d|d |ƒt |ƒt |di ƒ|ƒ|i |iƒƒ|id ƒo|d ||ƒnWn2tj o&}tiid |idƒ‚nXd S( s‡ compiles a .wxs file from the keywords given in env['msi_spec'] and by analyzing the tree of source nodes and their tags. itwtWixs+http://schemas.microsoft.com/wix/2003/01/witxmlnstNAMEtVERSIONtVENDORtSUMMARYtCHANGE_SPECFILEs&"%s" package field for MSI is missing.N(topentabspathtDocumentt createElementR>t appendChildtbuild_wxsfile_header_sectiontbuild_wxsfile_file_sectionRHtbuild_wxsfile_features_sectiontbuild_wxsfile_default_guitbuild_license_filetget_dirtwritet toprettyxmlR R R&tErrorst UserErrortargs( RIRJRKRtdocR?R!Rte((s=install/lib/scons-1.2.0.d20100117/SCons/Tool/packaging/msi.pyt build_wxsfile½s&    ( % c CsRtƒ}|idƒ}d|id\\ Example: C:\Programme\Company\Product-1.2 t Directoryt TARGETDIRR4t SourceDirtNametProgramFilesFoldertPFilest VENDOR_foldertLongNames%s-%stMY_DEFAULT_FOLDERR5i(RWRXR>RR%t childNodesR R;( R?RPRQRRR!Retd1td2td3td4tproject_folder((s=install/lib/scons-1.2.0.d20100117/SCons/Tool/packaging/msi.pytcreate_default_directory_layoutâs*       c s't||||ˆƒ}t|ƒ}tƒ‰‡‡‡fd†}xÞ|D]Ö} tii| iƒ\} } tii| ƒ} tii| ƒ} hdd<t | ˆƒd<| d<t | ˆƒd<| i ƒd<}xeg}|i ƒD]-\}}t | |ƒp|||fqíqí~D]\}}t| ||ƒq!Wˆidƒ}t| iƒ|id RBR(R(Ry(s=install/lib/scons-1.2.0.d20100117/SCons/Tool/packaging/msi.pyR-siRhRoRkR4( tsplitRRtsepR RqtremoveRXRR>R%RR (REtdirRht dir_partst upper_dirtalready_createdt nDirectory(RtfactoryR!(Rys=install/lib/scons-1.2.0.d20100117/SCons/Tool/packaging/msi.pyt get_directorys0     tyestPACKAGING_X_MSI_VITALtPACKAGING_X_MSI_FILEIDtPACKAGING_X_MSI_LONGNAMEtPACKAGING_X_MSI_SHORTNAMEtPACKAGING_X_MSI_SOURCEtFileRoRktSourceR4tVitalR8t1tDiskIdN(RwR2RWRRt splitdrivetPACKAGING_INSTALL_LOCATIONtbasenametdirnameRR%tget_pathR:R0tsetattrRXRRˆR>R‰RŠR‡R†RqR (R?R1RPRQRRR!Rt componentsR„RtdriveRtfilenameR“tht_[1]tktvR‹R8Rh((RƒR!Rs=install/lib/scons-1.2.0.d20100117/SCons/Tool/packaging/msi.pyR[s<  '  H  c Cs5tƒ}|idƒ}d|id tag based on the supplied xml tree. This is achieved by finding all s and adding them to a default target. It should be called after the tree has been built completly. We assume that a MY_DEFAULT_FOLDER Property is defined in the wxs file tree. Furthermore a top-level with the name and VERSION of the software will be created. An PACKAGING_X_MSI_FEATURE can either be a string, where the feature DESCRIPTION will be the same as its title or a Tuple, where the first part will be its title and the second its DESCRIPTION. tFeaturetcompleteR4RptConfigurableDirectoryRŽtLevels%s %stTitlet DescriptiontexpandtDisplayiiR/s Main PartR.t Documentationt ComponentRefR5N(RWRXR>RR2R:R&R'tis_TupleRRRR’R”RqR R;( R?R1RPRQRSRRƒRR)t SubFeatureR*R¦((s=install/lib/scons-1.2.0.d20100117/SCons/Tool/packaging/msi.pyR\is@           (cCsxtƒ}|idƒd}|idƒ}d|id<|ii|ƒ|idƒ}d|id<|ii|ƒdS(s6 this function adds a default GUI to the wxs file R5itUIReft WixUI_MondoR4tWixUI_ErrorProgressTextN(RWR;RXR>RqR (R?RƒR5R©((s=install/lib/scons-1.2.0.d20100117/SCons/Tool/packaging/msi.pyR] s   cCsßd \}}y|d}|d}Wntj onX|djp |djo‡ttii|iƒdƒdƒ}|idƒ|djo|i|iddƒƒn|i|d ƒ|id ƒ|iƒnd S( sd creates a License.rtf file with the content of "X_MSI_LICENSE_TEXT" in the given directory RxtLICENSEtX_MSI_LICENSE_TEXTs License.rtfRMs{\rtfs s\par s\par\part}N(RxRx( R RURRtjoinR”R`treplacetclose(t directorytspectnamettextR((s=install/lib/scons-1.2.0.d20100117/SCons/Tool/packaging/msi.pyR^®s  $   cCs…tƒ}|idƒ}|idƒ}|ii|ƒ|ii|ƒ|idƒpd|dR;(R?R³RƒR5R6R¾((s=install/lib/scons-1.2.0.d20100117/SCons/Tool/packaging/msi.pyRZÇs*    tactiont ensure_suffixs.wxsc Ks«tiidƒi|ƒtƒ} | d=| i| ƒ| d=| d=| d=t|||ƒ\}}| |ds2    & &    % - Z 7   %