Rac@sddlZddlZddlZddlZddlZddlZddlZddlZe e kZ de fdYZ defdYZdZdZdZd Zd Zd Zd Ze ed Ze ddZdZdZejdZejdZdZ dZ!dZ"dZ#dZ$dZ%dZ&dZ'dZ(ddZ)dej*fdYZ+defd YZ,d!Z-d"Z.d#Z/dS($iNtmemoizecBseZdZdZRS(cCs||_i|_dS(N(tfunctcache(tselfR((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyt__init__s cGsDy|j|SWn.tk r?|j|}||j|<|SXdS(N(RtKeyErrorR(Rtargstresult((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyt__call__s   (t__name__t __module__RR(((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyRs tGypErrorcBseZdZRS(sError class representing an error, which is to be presented to the user. The main entry point will catch and display this. (R R t__doc__(((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyR scCs|js|f|_net|jdkrQt|jdd|f|_n,t|jdd|f|jd|_dS(s2Append a message to the given exception's message.iit N(Rtlentstr(tetmsg((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pytExceptionAppend's  $cCs-g|D]"}t|d|kr|^qS(sc Given a list of qualified targets, return the qualified targets for the specified |target|. i(tParseQualifiedTarget(ttargettqualified_listtt((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pytFindQualifiedTargets1scCs|jdd}t|dkr3|\}}nd}|jdd}t|dkrl|\}}nd}|||gS(Nt:iit#(trsplitRtNone(Rt target_splitt build_filettoolset((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyR9scCst|\}}}|r~|rutjjtjjtjj||}tjj|s{t|d}q{q~|}n|r|}n|||gS(Nt.(Rtostpathtnormpathtjointdirnametisabst RelativePath(RRRtparsed_build_filetparsed_toolset((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyt ResolveTargetLs !   cCst|dS(Ni(R(tfully_qualified_target((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyt BuildFilenscCs/x(|D] }|tjkrtj|SqW|S(spLook up a key in the environment, with fallback to secondary keys and finally falling back to a default value.(R tenviron(tvar_listtdefaulttvar((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pytGetEnvironFallbackss cCs)|d|}|r%|d|}n|S(NRR((RRRtfully_qualified((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pytQualifiedTarget|scCs |rtjj|}ntjj|}tjj|}tjdkrtjj|djtjj|djkr|Sn|jtjj }|jtjj }t tjj ||g}tjj gt ||||}t |dkrdStjj |S(Ntwin32it(R R!trealpathtabspathtsystplatformt splitdrivetlowertsplittsepRt commonprefixtpardirR#(R!t relative_totfollow_path_symlinkt path_splittrelative_to_splitt prefix_lentrelative_split((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyR&s  cCs>|s |S|dkrdn|}t|tjj||S(sGiven a path like foo/bar that is relative to toplevel_dir, return the inverse relative path back to the toplevel_dir. E.g. os.path.normpath(os.path.join(path, InvertRelativePath(path))) should always produce the empty string, unless the path contains symlinks. RN(RR&R R!R#(R!t toplevel_dir((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pytInvertRelativePathscCs#tjj|r|St||S(N(R R!R%R&(R!R?((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pytFixIfRelativePathscCs1tjj|}tjjtjj||S(N(R R!R$R"R#(R!R?trel_dir((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pytUnrelativePathss[ #$%&'()*;<=>?[{|}~]|^$s(["\\`])cCs]t|tst|}ntj|r6d}nd}|tjtd||}|S(sEncodes |argument| suitably for consumption by POSIX shells. argument may be quoted and escaped as necessary to ensure that POSIX shells treat the returned value as a literal representing the argument passed to this function. Parameter (variable) expansions beginning with $ are allowed to remain intact without escaping the $, to allow the argument to contain references to variables to be expanded by the shell. t"R4s\\\1(t isinstanceRt_quotetsearchtretsubt_escape(targumenttquotetencoded((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pytEncodePOSIXShellArguments  cCs7g}x!|D]}|jt|q Wdj|S(sEncodes |list| suitably for consumption by POSIX shells. Returns EncodePOSIXShellArgument for each item in list, and joins them together using the space character as an argument separator. R (tappendRTR#(tlisttencoded_argumentsRQ((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pytEncodePOSIXShellLists cCst}t|}x}|r|j}||kr<qn|j|||}|jt|jdg|jt|jdgqWt|t|S(s2Returns the recursive list of target dependencies.t dependenciestdependencies_original(tsettpoptaddtupdatetgetRV(t target_dictstrootsRYtpendingtrtspec((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pytDeepDependencyTargets)s       #cCs)g|D]}t||kr|^qS(sHFrom a target_list, returns the subset from the specified build_file. (R+(t target_listRtp((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pytBuildFileTargets<scCs&t||}t||}||S(sNReturns all targets (direct and dependencies) for the specified build_file. (RhRe(RfR`Rt bftargetst deptargets((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyt AllTargetsBscs#dtffdY}|S(sWrite to a file only if the new contents differ. Arguments: filename: name of the file to potentially write to. Returns: A file like object which will write to temporary file and only overwrite the target if it differs (on close). tWritercs>eZdZfdZdZfdZdZRS(s?Wrapper around file which only covers the target if it differs.cstrdntjj}tjdddtjjddd|\}|_ytj|d|_ Wn$t k rtj |jnXdS( NR4tsuffixs.tmptprefixis.gyp.tdirtwb( tIsCygwinR R!R$ttempfiletmkstempR;ttmp_pathtfdopenttmp_filet Exceptiontunlink(Rt base_temp_dirttmp_fd(tfilename(sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyRVs!  cSst|j|S(N(tgetattrRv(Rtattrname((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyt __getattr__hscsy|jjt}ytj|jt}Wn+tk r_}|jtjkr`q`nX|ryt j |jnxt j d}t j |t j |jd|@t jdkrt jjrt jnt j|jWn$tk rt j |jnXdS(Ni?iR3(RvtclosetFalsetfilecmptcmpRttOSErrorterrnotENOENTR RxtumasktchmodR7R8R!texiststremovetrenameRw(RtsameRR(R{(sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyRls&    ! cSs|jj|jddS(Nsutf-8(Rvtwritetencode(Rts((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyRs(R R R RR~RR((R{(sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyRlTs  )(tobject(R{Rl((R{sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyt WriteOnDiffJs DcCs5ytjtjj|Wntk r0nXdS(s*Make sure the directory for |path| exists.N(R tmakedirsR!R$R(R!((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pytEnsureDirExistss cCsidd6dd6dd6}d|kr/|dStj|krI|tjStjjdr_dStjjd rud Stjjd rd Stjjd rd Stjjd rd Stjjd rd Stjjdrd SdS(sFReturns |params.flavor| if it's set, the system's default flavor else.twintcygwinR3tmactdarwintflavortsunostsolaristfreebsdtopenbsdtnetbsdtaixtzostos390tlinux(R7R8t startswith(tparamstflavors((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyt GetFlavors.   c Csidd6dd6dd6dd6j|d}|s8dStjjtjjtjjtd|}t|}|j }WdQXtjj|d|}t|d /}|j d j|d d g|d WdQXtj |ddS(sRFinds (flock|mac|win)_tool.gyp in the gyp directory and copies it to |out_path|.tflockRRRRNs %s_tool.pys gyp-%s-tooltwR4is!# Generated by gyp. Do not edit. ii( R_RR R!R#R$R6t__file__topent readlinesRR(Rtout_pathRnt source_patht source_filetsourcet tool_patht tool_file((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pytCopyTools"   ((cCsn|dkrd}ni}g}xC|D];}||}||krOq+nd||<|j|q+W|S(NcSs|S(N((tx((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pytR4i(RRU(tseqtidfuntseenRtitemtmarker((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pytuniquers      t OrderedSetcBsqeZd dZdZdZdZdZdZdZ e dZ dZ d Z d ZRS( cCsFg|_}|d||g7}i|_|dk rB||O}ndS(N(tendRtmap(RtiterableR((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyRs    cCs t|jS(N(RR(R((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyt__len__scCs ||jkS(N(R(Rtkey((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyt __contains__scCsO||jkrK|j}|d}|||g|d<|d<|j| ['a', 'c', b'] cs|krtn|kr+dSj|j|x|D]}|qRWj|jd|dS(Ni(RR]Rtinsert(tnodetneighbor(tVisitt get_edgest ordered_nodestvisitedtvisiting(sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyRUs     (RR[tsorted(tgraphRR((RRRRRsh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pytTopologicallySorted<s    cCs|tjjdp{tjjdp{tjjdp{tjjdp{tjjdp{tjjdp{tjjdS(NtGYP_CROSSCOMPILEtAR_hosttCC_hosttCXX_hostt AR_targett CC_targett CXX_target(R R,R_(((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pytCrossCompileRequesteddscCsxy_tjddtjdtj}|j\}}trN|jd}ndt|kSWntk rst SXdS(Ntunametstdouttstderrsutf-8tCYGWIN( t subprocesstPopentPIPEtSTDOUTt communicatetPY3tdecodeRRwR(toutRR((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyRqos    (0t collectionsRRtos.pathR RNRrR7RtbytesRRRRRwR RRRR)R+R0R2RR&RRFRGRItcompileRLRPRTRXReRhRkRRRRRt MutableSetRRRRRq(((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pytsP             "  +  "     Q   $ A (