%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/self/root/usr/src/node-v0.10.4/tools/gyp/pylib/gyp/
Upload File :
Create Path :
Current File : //proc/self/root/usr/src/node-v0.10.4/tools/gyp/pylib/gyp/common.pyc

�
4�fQc@�s�ddlmZddlZddlZddlZddlZddlZddlZde	fd��YZ
defd��YZd�Z
d�Zd	�Zd
�Zd�Zd�Ze
d
��Ze
dd��Zd�Zd�Zejd�Zejd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d�Z"dd�Z#defd��YZ$d�Z%dS(i����(twith_statementNtmemoizecB�seZd�Zd�ZRS(cC�s||_i|_dS(N(tfunctcache(tselfR((s./tools/gyp/pylib/gyp/common.pyt__init__s	cG�sDy|j|SWn.tk
r?|j|�}||j|<|SXdS(N(RtKeyErrorR(Rtargstresult((s./tools/gyp/pylib/gyp/common.pyt__call__s

(t__name__t
__module__RR	(((s./tools/gyp/pylib/gyp/common.pyRs	tGypErrorcB�seZdZRS(s�Error class representing an error, which is to be presented
  to the user.  The main entry point will catch and display this.
  (R
Rt__doc__(((s./tools/gyp/pylib/gyp/common.pyRscC�s�|js|f|_net|j�dkrQt|jd�d|f|_n,t|jd�d|f|jd|_dS(s2Append a message to the given exception's message.iit N(Rtlentstr(tetmsg((s./tools/gyp/pylib/gyp/common.pytExceptionAppend%s
	$cC�s|jdd�}t|�dkr3|\}}nd}|jdd�}t|�dkrl|\}}nd}|||gS(Nt:iit#(trsplitRtNone(ttargetttarget_splitt
build_filettoolset((s./tools/gyp/pylib/gyp/common.pytParseQualifiedTarget/scC�s�t|�\}}}|r~|rutjjtjjtjj|�|��}tjj|�s{t|d�}q{q~|}n|r�|}n|||gS(Nt.(RtostpathtnormpathtjointdirnametisabstRelativePath(RRRtparsed_build_filetparsed_toolset((s./tools/gyp/pylib/gyp/common.pyt
ResolveTargetBs
!		cC�st|�dS(Ni(R(tfully_qualified_target((s./tools/gyp/pylib/gyp/common.pyt	BuildFiledscC�s/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((s./tools/gyp/pylib/gyp/common.pytGetEnvironFallbackis
cC�s)|d|}|r%|d|}n|S(NRR((RRRtfully_qualified((s./tools/gyp/pylib/gyp/common.pytQualifiedTargetrscC�s�tjj|�}tjj|�}|jtjj�}|jtjj�}ttjj||g��}tjjgt|�|||}t|�dkr�dStjj|�S(Nit(	RRtrealpathtsplittsepRtcommonprefixtpardirR!(Rtrelative_tot
path_splittrelative_to_splitt
prefix_lentrelative_split((s./tools/gyp/pylib/gyp/common.pyR$|scC�s>|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((s./tools/gyp/pylib/gyp/common.pytInvertRelativePath�scC�s#tjj|�r|St||�S(N(RRR#R$(RR7((s./tools/gyp/pylib/gyp/common.pytFixIfRelativePath�scC�s1tjj|�}tjjtjj||��S(N(RRR"R R!(RR7trel_dir((s./tools/gyp/pylib/gyp/common.pytUnrelativePath�ss[	
 #$%&'()*;<=>?[{|}~]|^$s(["\\`])cC�s]t|t�st|�}ntj|�r6d}nd}|tjtd|�|}|S(s�Encodes |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((s./tools/gyp/pylib/gyp/common.pytEncodePOSIXShellArgument�s
	cC�s7g}x!|D]}|jt|��q
Wdj|�S(s�Encodes |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((s./tools/gyp/pylib/gyp/common.pytEncodePOSIXShellLists
cC�s�t�}t|�}x}|r�|j�}||kr<qn|j|�||}|jt|jdg���|jt|jdg���qWt|t|��S(s2Returns the recursive list of target dependencies.tdependenciestdependencies_original(tsettpoptaddtupdatetgetRM(ttarget_dictstrootsRPtpendingtrtspec((s./tools/gyp/pylib/gyp/common.pytDeepDependencyTargetss		

#cC�s)g|D]}t|�|kr|^qS(sHFrom a target_list, returns the subset from the specified build_file.
  (R)(ttarget_listRtp((s./tools/gyp/pylib/gyp/common.pytBuildFileTargets$scC�s&t||�}t||�}||S(sNReturns all targets (direct and dependencies) for the specified build_file.
  (R_R\(R]RWRt	bftargetst
deptargets((s./tools/gyp/pylib/gyp/common.pyt
AllTargets*sc�s dd�fd��Y}|�S(s�Write 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).
  tWriterc�s5eZdZ�fd�Zd�Z�fd�ZRS(s?Wrapper around file which only covers the target if it differs.c�s�tjdddtjj��dddtjj��d�\}|_ytj|d�|_Wn$tk
r�tj	|j��nXdS(	Ntsuffixs.tmptprefixis.gyp.tdiritwb(
ttempfiletmkstempRRR3ttmp_pathtfdopenttmp_filet	Exceptiontunlink(Rttmp_fd(tfilename(s./tools/gyp/pylib/gyp/common.pyR>s	"
cS�st|j|�S(N(tgetattrRl(Rtattrname((s./tools/gyp/pylib/gyp/common.pyt__getattr__Ksc�sy�|jj�t}ytj|j�t�}Wn+tk
r_}|jtjkr`�q`nX|ryt	j
|j�nxt	jd�}t	j|�t	j|jd|@�t
jdkr�t	jj��r�t	j��nt	j|j��Wn$tk
rt	j
|j��nXdS(Ni?i�twin32(RltclosetFalsetfilecmptcmpRjtOSErrorterrnotENOENTRRntumasktchmodtsystplatformRtexiststremovetrenameRm(RtsameRR|(Rp(s./tools/gyp/pylib/gyp/common.pyRuOs&


!
(R
RR
RRsRu((Rp(s./tools/gyp/pylib/gyp/common.pyRc<s
	(((RpRc((Rps./tools/gyp/pylib/gyp/common.pytWriteOnDiff2s
<cC�s�idd6dd6dd6}d|kr/|dStj|krI|tjStjjd�r_dStjjd	�rud	Stjjd
�r�d
Stjjd�r�dSdS(
sFReturns |params.flavor| if it's set, the system's default flavor else.twintcygwinRttmactdarwintflavortsunostsolaristfreebsdtopenbsdtaixtlinux(R~Rt
startswith(tparamstflavors((s./tools/gyp/pylib/gyp/common.pyt	GetFlavor{s"
c
C�s�idd6dd6dd6j|d�}|s1dStjjtjjtjjt��d|�}t|��}|j	�}WdQXtjj|d|�}t|d��/}|j
d	j|d
dg|d��WdQXtj|d
�dS(sPFinds (mac|sun|win)_tool.gyp in the gyp directory and copies it
  to |out_path|.tsunR�R�R�Ns
%s_tool.pysgyp-%s-tooltwR1is!# Generated by gyp. Do not edit.
ii�(RVRRRR!R"tabspatht__file__topent	readlinestwriteR}(R�tout_pathRetsource_pathtsource_filetsourcet	tool_patht	tool_file((s./tools/gyp/pylib/gyp/common.pytCopyTool�s'	((cC�sn|dkrd�}ni}g}xC|D];}||�}||krOq+nd||<|j|�q+W|S(NcS�s|S(N((tx((s./tools/gyp/pylib/gyp/common.pyt<lambda>�si(RRL(tseqtidfuntseenRtitemtmarker((s./tools/gyp/pylib/gyp/common.pytuniquer�s

t
CycleErrorcB�s eZdZd�Zd�ZRS(s9An exception raised when an unexpected cycle is detected.cC�s
||_dS(N(tnodes(RR�((s./tools/gyp/pylib/gyp/common.pyR�scC�sdt|j�S(NsCycleError: cycle involving: (RR�(R((s./tools/gyp/pylib/gyp/common.pyt__str__�s(R
RR
RR�(((s./tools/gyp/pylib/gyp/common.pyR��s	c�sdt���t��t��g������fd��xt|�D]}�|�qLW�S(s�Topologically 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']
  c�s�|�krt���n|�kr+dS�j|��j|�x�|�D]}�|�qRW�j|��jd|�dS(Ni(R�RTR�tinsert(tnodetneighbor(tVisitt	get_edgest
ordered_nodestvisitedtvisiting(s./tools/gyp/pylib/gyp/common.pyR��s


(RRRtsorted(tgraphR�R�((R�R�R�R�R�s./tools/gyp/pylib/gyp/common.pytTopologicallySorted�s		(&t
__future__RRzRwtos.pathRRERhR~tobjectRRmRRRR'R)R.R0R$RR=R>R@tcompileRCRGRKROR\R_RbR�R�R�R�R�R�(((s./tools/gyp/pylib/gyp/common.pyt<module>s@
	
		"				

		"		
				I		


Zerion Mini Shell 1.0