ÿØÿà JFIF    ÿÛ „ ( %!1!%*+...983,7(-.-  ]vQc@sddlmZddlZddlZddlZddlZddlZddlZde fdYZ de fdYZ dZ dZd Zd Zd Zd Ze d Ze ddZdZdZejdZejdZdZdZdZdZdZdZ dZ!dZ"ddZ#de fdYZ$dZ%dS(i(twith_statementNtmemoizecBseZdZdZRS(cCs||_i|_dS(N(tfunctcache(tselfR((sH//opt/alt/alt-nodejs6/root/usr/lib/python2.7/site-packages/gyp/common.pyt__init__s cGsDy|j|SWn.tk r?|j|}||j|<|SXdS(N(RtKeyErrorR(Rtargstresult((sH//opt/alt/alt-nodejs6/root/usr/lib/python2.7/site-packages/gyp/common.pyt__call__s   (t__name__t __module__RR (((sH//opt/alt/alt-nodejs6/root/usr/lib/python2.7/site-packages/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-nodejs6/root/usr/lib/python2.7/site-packages/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-nodejs6/root/usr/lib/python2.7/site-packages/gyp/common.pytExceptionAppend%s  $cCs|jdd}t|dkr3|\}}nd}|jdd}t|dkrl|\}}nd}|||gS(Nt:iit#(trsplitRtNone(ttargett target_splitt build_filettoolset((sH//opt/alt/alt-nodejs6/root/usr/lib/python2.7/site-packages/gyp/common.pytParseQualifiedTarget/scCst|\}}}|r~|rutjjtjjtjj||}tjj|s{t|d}q{q~|}n|r|}n|||gS(Nt.(Rtostpathtnormpathtjointdirnametisabst RelativePath(RRRtparsed_build_filetparsed_toolset((sH//opt/alt/alt-nodejs6/root/usr/lib/python2.7/site-packages/gyp/common.pyt ResolveTargetBs !   cCst|dS(Ni(R(tfully_qualified_target((sH//opt/alt/alt-nodejs6/root/usr/lib/python2.7/site-packages/gyp/common.pyt BuildFiledscCs/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.(Rtenviron(tvar_listtdefaulttvar((sH//opt/alt/alt-nodejs6/root/usr/lib/python2.7/site-packages/gyp/common.pytGetEnvironFallbackis cCs)|d|}|r%|d|}n|S(NRR((RRRtfully_qualified((sH//opt/alt/alt-nodejs6/root/usr/lib/python2.7/site-packages/gyp/common.pytQualifiedTargetrscCstjj|}tjj|}|jtjj}|jtjj}ttjj||g}tjjgt||||}t|dkrdStjj|S(Nit( RRtrealpathtsplittsepRt commonprefixtpardirR!(Rt relative_tot path_splittrelative_to_splitt prefix_lentrelative_split((sH//opt/alt/alt-nodejs6/root/usr/lib/python2.7/site-packages/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$RRR!(Rt toplevel_dir((sH//opt/alt/alt-nodejs6/root/usr/lib/python2.7/site-packages/gyp/common.pytInvertRelativePathscCs#tjj|r|St||S(N(RRR#R$(RR7((sH//opt/alt/alt-nodejs6/root/usr/lib/python2.7/site-packages/gyp/common.pytFixIfRelativePathscCs1tjj|}tjjtjj||S(N(RRR"R R!(RR7trel_dir((sH//opt/alt/alt-nodejs6/root/usr/lib/python2.7/site-packages/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"R1s\\\1(t isinstanceRt_quotetsearchtretsubt_escape(targumenttquotetencoded((sH//opt/alt/alt-nodejs6/root/usr/lib/python2.7/site-packages/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(tappendRKR!(tlisttencoded_argumentsRH((sH//opt/alt/alt-nodejs6/root/usr/lib/python2.7/site-packages/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(tsettpoptaddtupdatetgetRM(t target_dictstrootsRPtpendingtrtspec((sH//opt/alt/alt-nodejs6/root/usr/lib/python2.7/site-packages/gyp/common.pytDeepDependencyTargetss       #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-nodejs6/root/usr/lib/python2.7/site-packages/gyp/common.pytBuildFileTargets$scCs&t||}t||}||S(sNReturns all targets (direct and dependencies) for the specified build_file. (R_R\(R]RWRt bftargetst deptargets((sH//opt/alt/alt-nodejs6/root/usr/lib/python2.7/site-packages/gyp/common.pyt AllTargets*scs ddfdY}|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). tWritercs5eZdZfdZdZfdZRS(s?Wrapper around file which only covers the target if it differs.cstjdddtjjdddtjjd\}|_ytj|d|_Wn$tk rtj |jnXdS( Ntsuffixs.tmptprefixis.gyp.tdiritwb( ttempfiletmkstempRRR3ttmp_pathtfdopenttmp_filet Exceptiontunlink(Rttmp_fd(tfilename(sH//opt/alt/alt-nodejs6/root/usr/lib/python2.7/site-packages/gyp/common.pyR>s " cSst|j|S(N(tgetattrRl(Rtattrname((sH//opt/alt/alt-nodejs6/root/usr/lib/python2.7/site-packages/gyp/common.pyt __getattr__Kscsy|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?itwin32(RltclosetFalsetfilecmptcmpRjtOSErrorterrnotENOENTRRntumasktchmodtsystplatformRtexiststremovetrenameRm(RtsameRR|(Rp(sH//opt/alt/alt-nodejs6/root/usr/lib/python2.7/site-packages/gyp/common.pyRuOs&    ! (R R R RRsRu((Rp(sH//opt/alt/alt-nodejs6/root/usr/lib/python2.7/site-packages/gyp/common.pyRc<s (((RpRc((RpsH//opt/alt/alt-nodejs6/root/usr/lib/python2.7/site-packages/gyp/common.pyt WriteOnDiff2s R1i(RRL(tseqtidfuntseenRtitemtmarker((sH//opt/alt/alt-nodejs6/root/usr/lib/python2.7/site-packages/gyp/common.pytuniquers      t CycleErrorcBs eZdZdZdZRS(s9An exception raised when an unexpected cycle is detected.cCs ||_dS(N(tnodes(RR((sH//opt/alt/alt-nodejs6/root/usr/lib/python2.7/site-packages/gyp/common.pyRscCsdt|jS(NsCycleError: cycle involving: (RR(R((sH//opt/alt/alt-nodejs6/root/usr/lib/python2.7/site-packages/gyp/common.pyt__str__s(R R R RR(((sH//opt/alt/alt-nodejs6/root/usr/lib/python2.7/site-packages/gyp/common.pyRs csdtttgfdxt|D]}|qLWS(sTopologically sort based on a user provided edge definition. Args: graph: A list of node names. get_edges: A function mapping from node name to a hashable collection of node names which this node has outgoing edges to. Returns: A list containing all of the node in graph in topological order. It is assumed that calling get_edges once for each node and caching is cheaper than repeatedly calling get_edges. Raises: CycleError in the event of a cycle. Example: graph = {'a': '$(b) $(c)', 'b': 'hi', 'c': '$(b)'} def GetEdges(node): return re.findall(r'\$\(([^))]\)', graph[node]) print TopologicallySorted(graph.keys(), GetEdges) ==> ['a', 'c', b'] cs|krtn|kr+dSj|j|x|D]}|qRWj|jd|dS(Ni(RRTRtinsert(tnodetneighbor(tVisitt get_edgest ordered_nodestvisitedtvisiting(sH//opt/alt/alt-nodejs6/root/usr/lib/python2.7/site-packages/gyp/common.pyRs     (RRRtsorted(tgraphRR((RRRRRsH//opt/alt/alt-nodejs6/root/usr/lib/python2.7/site-packages/gyp/common.pytTopologicallySorteds    (&t __future__RRzRwtos.pathRRERhR~tobjectRRmR RRR'R)R.R0R$RR=R>R@tcompileRCRGRKROR\R_RbRRRRRR(((sH//opt/alt/alt-nodejs6/root/usr/lib/python2.7/site-packages/gyp/common.pyts@         "    "     I