Rac@sNdZddlZddlZddlZddlZddlmZddlZddl Zej dZ dZ dZ dZdZd Zd Zd Zd Zd ZdefdYZdZdefdYZeadZdZdZdZdZdZ dZ!dZ"dZ#dS(sg This module helps emulate Visual Studio 2008 behavior on top of other build systems, primarily ninja. iN(t OrderedSets(\\*)"cCs3tjd|}|jdd}d|dS(sQuote a command line argument so that it appears as one argument when processed via cmd.exe and parsed by CommandLineToArgvW (as is typical for Windows programs).cSsd|jddS(Niis\"(tgroup(tmo((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyt$tt%s%%t"(twindows_quoter_regextsubtreplace(targ((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pytQuoteForRspFiles cCs|s dS|djdrV|djdd\}}|dtjj|}ntjj|d}|ddjd|dDS(s6Process a list of arguments using QuoteCmdExeArgument.Riscall t icss|]}t|VqdS(N(R (t.0R ((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pys Bs(t startswithtsplittostpathtnormpathtjoin(targstcalltprogram((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pytEncodeRspFileList5scCs5|s |S|s|St|j|d||dS(sGiven a list of dictionary keys |path| and a tree of dicts |root|, find value at path, or return |default| if any of the path doesn't exist.ii(t_GenericRetrievetget(troottdefaultR((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyREs cCsU|dkr|St|ts.t|trIg|D]}||^q5S||SdS(sDAdd |prefix| to |element| or each subelement if element is iterable.N(tNonet isinstancetlistttuple(telementtprefixte((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyt _AddPrefixOs  cCs|dk r|dk rt|s0|j}nt|tsNt|trytdg|D]}||^q[}q||}n|S(sIf |element| then remap it through |map|. If |element| is iterable then each item will be remapped. Any elements not found will be removed.N(RtcallableRRRRtfilter(R tmaptelem((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyt _DoRemappingZs  +cCs^|dk rV|dk rVt|ts6t|trF|j|qZ|j|n|SdS(sIf |append| is None, simply return |element|. If |append| is not None, then add |element| to it, adding each item in |element| if it's a list or tuple.N(RRRRtextendtappend(R*R ((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyt_AppendOrReturngs cCsttdrtjStjjd}|sddddg}tj|dtjdtj}xG|j d j D],}d |krx|j d d d }qxqxWn|t_|S(sTry to find an installation location for the DirectX SDK. Check for the standard environment variable, and if that doesn't exist, try to find via the registry. May return None if not found in either location.t dxsdk_dirt DXSDK_DIRsreg.exetquerysHKLM\Software\Microsoft\DirectXs/ststdouttstderrit InstallPaths is\( thasattrt_FindDirectXInstallationR,RtenvironRt subprocesstPopentPIPEt communicatet splitlinesR(R,tcmdtptline((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyR3ts! ! cCsi}|jrH|j|d|j D]0}||kr| d||dfg7} qqWqW| rpt dj | ndS(Ntmsvs_configuration_attributest msvs_settingsRCtmsvs_disabled_warningstmsvs_precompiled_headertmsvs_precompiled_sourcetmsvs_configuration_platformtmsvs_target_platformtconfigurationstmsvs_cygwin_dirst.t msvs_prebuildtmsvs_postbuilds%s not supported (target %s).t target_names (tspecRER@tdictRtstrtsetattrtitemsRtgetattrR\tvaluest ExceptionR( tselfRaRItsupported_fieldsRHtfieldRt confignameRKtunsupported_fieldst unsupported((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyt__init__s4         *    cCs<|jjdd}|r|Stjjj|jddS(sReturns the extension for the target, with no leading dot. Uses 'product_extension' if specified, otherwise uses MSVS defaults based on the target type. tproduct_extensionttypeRN(RaRRtgyptMSVSUtiltTARGET_TYPE_EXT(Ritext((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyt GetExtensionsc Cs|j|}|dkr$d}n|}|jjdd|jjd|jd}|ri|dnd}d|j}||}i d d 6d d 6d d6|d6|d6dd6|jdd6|d6|d6|d6|d6tjj||d6} | jt|j | S(sUGet a dict of variables mapping internal VS macro names to their gyp equivalents.tx86tWin32tproduct_prefixRt product_nameR`s\R]s${root}s $(InputName)s ${source}s $(InputPath)s$!INTERMEDIATE_DIRs $(IntDir)s $(OutDir)\s$(PlatformName)s$(ProjectDir)\s$(ProjectName)s $(TargetDir)\s $(TargetExt)s$(TargetFileName)s $(TargetName)s $(TargetPath)( tGetArchRaRRvRRRtupdateRBR@( Rit base_to_buildRKt target_archttarget_platformR`t target_dirt target_extttarget_file_namet replacements((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyt GetVSMacroEnvs0   cCs"|j|d|}t||S(s4Convert from VS macro names to something equivalent.RK(RRF(RitsR}RKRA((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pytConvertVSMacros scCsbg|D]%}|jdr&|dn|^q}g|D]%}|jdsX|dn|^q9S(s2Strip -l from library if it's specified with that.s-lis.lib(Rtendswith(Rit librariestlibtlibs((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pytAdjustLibrariess2cCs=t|||}t||}t||}t||S(sRetrieve a value from |field| at |path| or return |default|. If |append| is specified, and the item is found, it will be appended to that object instead of returned. If |map| is specified, results will be remapped through |map| before being returned or appended.(RR(R#R+(RiRkRRR!R*R&tresult((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyt _GetAndMungest _GetWrappercBs&eZddZddddZRS(cCs+||_||_|g|_||_dS(N(tparentRkt base_pathR*(RiRRkRR*((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyRo!s   Rc Cs;|jj|j|j|gd|d|d|jd|S(NRR!R*R&(RRRkRR*(RitnameR&R!R((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyt__call__&sN(t__name__t __module__RRoR(((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyR s cCs^|jj|d}|jj|d}|s9|}nidd6dd6dd6j|dS(srGet architecture based on msvs_configuration_platform and msvs_target_platform. Returns either 'x86' or 'x64'.RRwRxtx64tarm64tARM64(RYRRZ(RiRKtconfiguration_platformtplatform((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyR{*s  cCsp|j|}|dkr8|jd r8|d7}n|dkrl|jdrl|jddd}n|S(s*Returns the target-specific configuration.Rt_x64Rwt_ii(R{Rtrsplit(RiRKtarch((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyt _TargetConfig4s  RcCs#|j|j||||||S(s_GetAndMunge for msvs_settings.(RRU(RiRRKRR!R*R&((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyt_SettingCscCs#|j|j||||||S(s/_GetAndMunge for msvs_configuration_attributes.(RRT(RiRRKRR!R*R&((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyt _ConfigAttribIs cCse|j|}||j|}|j|jd|dgg|D]}|j|d|^qFS(syUpdates include_dirs to expand VS specific paths, and adds the system include dirs used for platform SDK and similar.tVCCLCompilerTooltAdditionalIncludeDirectoriesRRK(RR(RRCR)RR(Rit include_dirsRKROR;((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pytAdjustIncludeDirsPs  cCse|j|}||j|}|j|jd|dgg|D]}|j|d|^qFS(s~Updates midl_include_dirs to expand VS specific paths, and adds the system include dirs used for platform SDK and similar.t VCMIDLToolRRRK(RR(RRCR)RR(Ritmidl_include_dirsRKROR;((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pytAdjustMidlIncludeDirsYs  cCs|j|}g}|jdg|dkr@|jd n|jdg|dkrk|jdn|j|jd |d g|S( s`Returns the set of defines that are injected to the defines list based on other VS settings.t CharacterSett1t_UNICODEtUNICODEt2t_MBCSRtPreprocessorDefinitionsR(RR(RR(RRR)R*R(RiRKtdefines((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pytGetComputedDefinesbs cCsC|j|}|jd|}|r?||j|}n|S(svGet the pdb file name that should be used for compiler invocations, or None if there's no explicit name specified.RtProgramDataBaseFileName(RR(RRR(RiRKtexpand_specialtpdbname((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pytGetCompilerPdbNameos  cCsI|j|}|jd|}|rE||j|d|}n|S(s^Gets the explicitly overridden map file name for a target or returns None if it's not set.t VCLinkerToolt MapFileNameRK(RR(RRR(RiRKRtmap_file((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pytGetMapFileNameys cCst|j|}|jd}|dkr.dnd}|j|df|}|rp||j|d|}n|S(scGets the explicitly overridden output name for a target or returns None if it's not overridden.Rqtstatic_librarytVCLibrarianToolRt OutputFileRK(RRaRR(RiRKRRqRt output_file((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyt GetOutputNames  cCsm|j|}|jd|}|jd|}|dkre|r^||j|d|S|SndSdS( sGets the explicitly overridden pdb name for a target or returns default if it's not overridden, or if no pdb will be generated.RtProgramDatabaseFiletGenerateDebugInformationttrueRKN(RR(RR(RRRR(RiRKRRRtgenerate_debug_info((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyt GetPDBNames  cCs+|j|}|jd|}|dkS(s\If NoImportLibrary: true, ninja will not expect the output to include an import library.tNoImportLibraryR(R(RR(RiRKtnoimplib((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pytGetNoImportLibraryscCsG|j|}g}|jd|}|dkrC|jdn|S(s:Returns the flags that need to be added to ml invocations.tMASMtUseSafeExceptionHandlersRs/safeseh(RR(RRR*(RiRKtasmflagstsafeseh((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyt GetAsmflagss  cCs9|j|}g}|jg|j|D]}d|^q)|j||j|dd|}|ddidd6dd6d d 6d d 6d d dd |dd d|dd d|ddidd6|ddidd6|ddidd6dd6d d|ddidd6dd6d d|ddidd6d d 6d d |d!did"d6d#d6d$d 6d d%dd|d&didd6d'd6|d(did)d6|d*d d+|d,did-d6|d.didd6d/d6d0d 6d1d 6d d2|d3did4d6d5d 6d6d76d d8|d9did:d6d;d6|d<did=d6d>d6|d?did@d6|dAdidBd6dCd6|dDdid d6dEd 6dd 6d dF|dGdidHd6dId6dJd 6dKd 6d dL|dMdidNd6dOd 6d dP|dQdidRd6|dSdidd6dd6d dT|dUdidVd6|dWd d|dXdidYd6dZd 6d[d 6d\d76d]d^6d d_|jg|jdg|dgD]}da|^q|jjdhkr#|jdent df|}|S(isCReturns the flags that need to be added to .c and .cc compilations.s/wdRR*t OptimizationR&tdt0RRtxt3R!s/ORtInlineFunctionExpansions/ObtDisableSpecificWarningst StringPoolings/GFRtEnableFiberSafeOptimizationss/GTtOmitFramePointerst-tfalseRs/OytEnableIntrinsicFunctionss/OitFavorSizeOrSpeedttRtFloatingPointModeltprecisetstricttfasts/fp:tCompileAsManageds/clrtWholeProgramOptimizations/GLt WarningLevels/Wt WarnAsErrors/WXtCallingConventiontrtztvs/GtDebugInformationFormatt7RPtIt4s/ZtRuntimeTypeInfos/GRs/GR-tEnableFunctionLevelLinkings/Gys/Gy-tMinimalRebuilds/GmtBufferSecurityChecks/GSs/GS-tBasicRuntimeCheckstus/RTCtRuntimeLibrarytTtTdtDtDds/MtExceptionHandlingtsctas/EHtDefaultCharIsUnsigneds/JtTreatWChar_tAsBuiltInTypes /Zc:wchar_tt EnablePREfasts/analyzetAdditionalOptionstEnableEnhancedInstructionSettSSEtSSE2tAVXtIA32tAVX2t5s/arch:tForcedIncludeFiless/FIt2013t2013et2015s/FScSs|jd S(Ns/MP(R(R((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyRR(RR(RRR( RR)RVRRURR@t short_nameR*R%(RiRKtcflagstwtcltf((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyt GetCflagss^+ /$$$ ! ) "+ )$  )'cCs|j|}|j|rtjj|j|d}t||rtjj|j|d}d|d|d|dgSngS(sLGet the flags to be added to the cflags for precompiled header support. is/Yus/FIs/Fp${pchprefix}.s.pch(RRWRRtsplitextRXt_LanguageMatchesForPchR(RiRKt extensiont source_exttpch((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyt _GetPchFlagss  cCs|j|}|j|dS(s;Returns the flags that need to be added to .c compilations.s.c(RR(RiRK((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyt GetCflagsCscCs&|j|}dg|j|dS(s<Returns the flags that need to be added to .cc compilations.s/TPs.cc(RR(RiRK((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyt GetCflagsCCscCs|j|}|j|df|dg}g|D]-}tjj||j|d|^q4}g|D]}d|d^qnS(sPGet and normalize the list of paths in AdditionalLibraryDirectories setting.tAdditionalLibraryDirectoriesRRKs /LIBPATH:"R(RRRRRR(RiRRKtgyp_to_build_pathtlibpathsR;((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyt _GetAdditionalLibraryDirectoriess 7cCs|j|}g}|j||j|dd|}|j|jd|||ddidd6|ddidd 6d d 6d d 6dd|d|S(s8Returns the flags that need to be added to lib commands.RR*tLinkTimeCodeGenerationR&s/LTCGRt TargetMachinetX86RtX64t17tARMRR!s /MACHINE:R(RRRUR)R(RiRKRtlibflagsR((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyt GetLibFlagss $ cCs|j}|dd krg|jdgD]}|jdr,|^q,}t|dkrm||dSt|dkrtd qnd S( sDReturns the .def file from sources, if any. Otherwise returns None.Rqtshared_librarytloadable_modulet executabletsourcess.defiisMultiple .def files(R!R"R#N(RaRRtlenRhR(RiRRaRt def_files((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyt GetDefFiles 4cCs-|j|}|r)|jd|ndS(s.def files get implicitly converted to a ModuleDefinitionFile for the linker in the VS generator. Emulate that behaviour here.s /DEF:"%s"N(R'R*(RitldflagsRtdef_file((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyt_GetDefFileAsLdflagsscCsI|j|}|jd|}|rE||j|d|}n|S(s`Gets the explicitly overridden pgd name for a target or returns None if it's not overridden.RtProfileGuidedDatabaseRK(RR+(RRR(RiRKRR((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyt GetPGDName%s  cCsD|j|}g}|j||j|dd|} |j||| ddidd6| ddidd 6d d 6d d 6dd6dd|j|jd||| ddd| ddddidd6dd6|j||} | r |jd| n|j|||d} | r?|jd| n|j ||} | rk|jd| n|j ||} | ddi| rd| ndd6| d did!d6| d"dd|j dZ|d$d}|rd%|}n| d&did'|d 6d(|d)6dd*|j d[|d$d}|r|j d\|d$d}|rkd%|}n|jd-||fn| d.didd 6dd)6dd/| d0didd 6dd)6dd1| d2dd3| d4didd 6dd)6dd5| d6didd 6dd)6dd7| d8didd 6dd)6dd9| d:did;d 6d<d)6dd=| d>dd?| d@didAd 6dBd)6dd=| dCdidd 6dDd)6dEd 6dFdG6ddH| dIddJ| dKdidLd6| dMddN| dOdidPd6| dQdidd 6dd)6ddR| dSdd|j |dTkrsd}nd]}| dUdidd6dd6ddVd$|tdW|}|s|jd7ntdX|s|jd9ntdY|}|j||||o| |\}}}|j||||fS(^sUReturns the flags that need to be added to link commands, and the manifest files.RR*RR&s/DEBUGRRRRRRRRRt18R!s /MACHINE:t DelayLoadDLLss /DELAYLOAD:tTreatLinkerWarningAsErrorss/WXRs:NORs/OUT:s.pdbs/PDB:s/PGD:tGenerateMapFiles/MAP:s/MAPt MapExportss/MAPINFO:EXPORTSRtMinimumRequiredVersionRt,t SubSystems CONSOLE%ss WINDOWS%sRs /SUBSYSTEM:tStackReserveSizetStackCommitSizes /STACK:%s%stTerminalServerAwares/TSAWAREtLinkIncrementals /INCREMENTALt BaseAddresss/BASE:tFixedBaseAddresss/FIXEDtRandomizedBaseAddresss /DYNAMICBASEtDataExecutionPreventions /NXCOMPATtOptimizeReferencestNOREFtREFs/OPT:tForceSymbolReferencess /INCLUDE:tEnableCOMDATFoldingtNOICFtICFRs :PGINSTRUMENTs :PGOPTIMIZEs :PGUPDATERs/LTCGtIgnoreDefaultLibraryNamess/NODEFAULTLIB:tResourceOnlyDLLs/NOENTRYtEntryPointSymbols/ENTRY:tProfiles/PROFILEtLargeAddressAwares/LARGEADDRESSAWAREtAdditionalDependenciesRwtImageHasSafeExceptionHandlerss/SAFESEHcSsd|kp|dkS(Nt DYNAMICBASEs/FIXED((R((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyRRcSs d|kS(NtNXCOMPAT((R((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyRRcSs |jdS(Ns/DEF:(R(R((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyRR(RR2(RR5(RR6N(RRRUR*R)RRR*RR,RRR{RR%t_GetLdManifestFlags(RiRKRRtmanifest_base_namet output_namet is_executablet build_dirR(tldtouttpdbtpgdRtminimum_required_versiontstack_reserve_sizetstack_commit_sizetsafeseh_defaultt base_flagst have_def_filetmanifest_flagstintermediate_manifesttmanifest_files((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyt GetLdflags0s+     $$$  $$        cCs|jd|dd}|dkr4dgggfS|d}dd|g}|jd |j|}|jd|dd} g} d } | dkr|jd|dd } idd 6dd6dd6} |jd|dd}d| | |f}nd}| |}|d}tjj||}tjj|tjj |}|j ||j |g} |r|jdn| |j ||7} ||| fS(sjReturns a 3-tuple: - the set of flags that need to be added to the link to generate a default manifest - the intermediate manifest that the linker will generate that should be used to assert it doesn't add anything to the merged one. - the list of all the manifest files to be merged by the manifest tool and included into the link.RtGenerateManifestRRs /MANIFEST:NOs.intermediate.manifests /MANIFESTs/ManifestFile:s/MANIFESTUAC:NOt EnableUACs%stUACExecutionLevelRt asInvokerthighestAvailableRtrequireAdministratorRt UACUIAccessRs Rs.generated.manifests/ALLOWISOLATION(RR`(RRa(RRb(RRf( RR*RRRRRrtcommontEnsureDirExistst WriteOnDifftwritetcloset_GetAdditionalManifestFiles(RiRKRRtallow_isolationRQtgenerate_manifestROtflagst enable_uacR^tgenerated_manifest_outertexecution_leveltexecution_level_mapt ui_accesstinnertgenerated_manifest_contentstgenerated_nametbuild_dir_generated_nameR ((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyRMsL                 cCsq|jd|dg}t|tr9|jd}ng|D]-}tjj||j|d|^q@S(s]Gets additional manifest files that are added to the default one generated by the linker.tVCManifestTooltAdditionalManifestFilesRt;RK(RyRz(RRRcRRRRR(RiRKRtfilesR ((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyRls  cCs+|j|}|jd|}|dkS(szReturns whether the target should be linked via Use Library Dependency Inputs (using component .objs of a given .lib).RtUseLibraryDependencyInputsR(RR}(RR(RiRKtuldi((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pytIsUseLibraryDependencyInputsscCs1|j|}|jd|dd}|dkS(s6Returns whether manifest should be linked into binary.Ryt EmbedManifestRR(RyR(RR(RiRKtembed((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pytIsEmbedManifests cCs+|j|}|jd|}|dkS(s:Returns whether the target should be linked incrementally.RR8R(RR8(RR(RiRKtlink_inc((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pytIsLinkIncremental scCs|j|}g}|j||j|dd|}|dd|dd|jd|d|ddd |d dd dd |S( sTReturns the flags that need to be added to invocations of the resource compiler.tVCResourceCompilerToolR*RR&R!s/IR]Rs/dtCultures/lcSstt|dS(Ni(thextint(R((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyRR(RRRUR*(RiRKtgyp_to_ninja_pathtrcflagstrc((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyt GetRcflagsscCstjjtjj||jd}d|jdd}g|D]$}|jddjdd^qE}g|D]}d|jdd ^qv}d j|}d |d ||f}|S( sOBuild a command line that runs args via cygwin bash. We assume that all incoming paths are in Windows normpath'd form, so they need to be converted to posix style for the part of the command line that's passed to bash. We also have to do some Visual Studio macro emulation here because various rules use magic VS names for things. Also note that rules that contain ninja variables cannot be fixed here (for example ${source}), so the outer generator needs to make sure that the paths that are written out are in posix style, if the command line will be used here.iscd %ss\t/Rs\"s'%s't's'\''R s1call "%s\setup_env.bat" && set CYGWIN=nontsec && sbash -c "%s ; %s"(RRRRR\R (RiRt path_to_baset cygwin_dirtcdRtbash_cmdR:((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pytBuildCygwinBashCommandLines 1)cCs+t|jd|jjdddkS(skDetermine if an action should be run under cygwin. If the variable is unset, or set to 1 we use cygwin.tmsvs_cygwin_shellii(RRRa(Ritrule((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pytIsRuleRunUnderCygwin2s cCs5x.|jdgD]}|d|krtSqWtS(sADetermine if there's an explicit rule for a particular extension.trulesR(RtTruetFalse(RiRaRR((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyt_HasExplicitRuleForExtension8scCs5tg|jdgD]}|jdd^qS(s:Determine if an action should not run midl for .idl files.tactionstexplicit_idl_actioni(RGR(RiRataction((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyt_HasExplicitIdlActions?scCs|j|dp|j|S(sDetermine if there's an explicit rule or action for idl files. When there isn't we need to generate implicit rules to build MIDL .idl files.tidl(RR(RiRa((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pytHasExplicitIdlRulesOrActionsDscCs|j|dS(sDetermine if there's an explicit rule for asm files. When there isn't we need to generate implicit rules to assemble .asm files.tasm(R(RiRa((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pytHasExplicitAsmRulesJscs=jjjddfd}|ddd}|ddd}|ddd }|d dd }|d dd }|ddd} ||||g} d|fd|fd|fd|fd|fg} j} | dkrd} nddd| dg} | | | | fS(sDetermine the implicit outputs for an idl file. Returns output directory, outputs, and variables and flags that are required.Rcsj|d|dS(NRRK(R(RR(RKtmidl_getRi(sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pytmidlTstTypeLibraryNameRs ${root}.tlbtHeaderFileNames ${root}.htDLLDataFileNames dlldata.ctInterfaceIdentifierFileNames ${root}_i.ct ProxyFileNames ${root}_p.ctOutputDirectoryRttlbthtdlldatatiidtproxyRwtwin32s/chartsigneds/envs/OicfN(RRRURR{(RitsourceRKRRtheaderRRRtoutdirtoutputt variablesRRo((RKRRisp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pytGetIdlBuildDataOs(      N(0RRt__doc__RoRvRRRRRtobjectRR{RRRRRRRRRRRRR RRRRR R'R*R,R_RMRlRRRRRRRRRRR(((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyRSsX #       4      j W          cCs:d}d}||kr$||kp9||ko9||kS(Ns.cs.ccs.cxxs.cpp(s.c(s.ccs.cxxs.cpp((Rtpch_source_exttc_extstcc_exts((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyRmstPrecompiledHeadercBs;eZdZdZdZdZdZdZRS(sHelper to generate dependencies and build rules to handle generation of precompiled headers. Interface matches the GCH handler in xcode_emulation.py. c Csi||_||_|jj|j}|||_tjj|\}}|||j|_dS(N( tsettingsRKRXt pch_sourceRRR tlowert output_obj( RiRRKRtgyp_to_unique_outputtobj_extRtfilenameR((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyRoxs   cCs!tjj|jj|jdS(sMGet the header that will appear in an #include line for all source files.i(RRRRRWRK(Ri((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyt _PchHeaderscCsp|jsgStjj|jd}x@|D]8}ttjj|d|r0dd|jfgSq0WgS(sGiven a list of sources files and the corresponding object files, returns a list of the pch files that should be depended upon. The additional wrapping in the return value is for interface compatibility with make.py on Mac, and xcode_emulation.py.iN(RRRR RRRR(RiR$tobjsRtpch_extR((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pytGetObjDependenciess  cCsgS(sNot used on Windows as there are no additional build steps required (instead, existing steps are modified in GetFlagsModifications below).((RiR((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pytGetPchBuildCommandssc Cs||jkrd|jg}|dkrTdt|||fg|jgfS|dkrdt|||fg|jgfSng||fS(sgGet the modified cflags and implicit dependencies that should be used for the pch compilation step.s/Yctcxxt cflags_cctcctcflags_c(RRR&R( RitinputRtimplicittcommandRRRt pch_output((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pytGetFlagsModificationss   (RRRRoRRRR(((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyRts    cCs1ts-tjj|jdddtantS(Nt msvs_versiontautotallow_fallback(R@Rrt MSVSVersiontSelectVisualStudioVersionRR(RI((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyREs   cCst|}|jS(N(REt SetupScript(RIRtvs((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyt_GetVsvarsSetupArgss cCsBd|kr>x/|jD]\}}|j||}qWn|S(s{Expand $(Variable) per expansions dict. See MsvsSettings.GetVSMacroEnv for the canonical way to retrieve a suitable dict.RD(ReR (tstringt expansionstoldtnew((sp/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/msvs_emulation.pyRFs c Csd}i}x|jD]}x|D]}}tj|d |jr&|jd d \}}|dkrtjjtj tj |}n|||j s@            4   !  5