Your IP : 3.135.207.204


Current Path : /opt/alt/alt-nodejs6/root/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/
Upload File :
Current File : //opt/alt/alt-nodejs6/root/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/common.pyo

�
�Rac@�s�ddlmZddlZddlZddlZddlZddlZddlZddl	Z	de
fd��YZdefd��YZ
d�Zd�Zd	�Zd
�Zd�Zd�Zd
�Zeed��Zedd��Zd�Zd�Zejd�Zejd�Zd�Zd�Zd�Z d�Z!d�Z"d�Z#d�Z$d�Z%d�Z&dd�Z'dej(fd��YZ)d efd!��YZ*d"�Z+d#�Z,dS($i����(twith_statementNtmemoizecB�seZd�Zd�ZRS(cC�s||_i|_dS(N(tfunctcache(tselfR((sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyt__init__s	cG�sDy|j|SWn.tk
r?|j|�}||j|<|SXdS(N(RtKeyErrorR(Rtargstresult((sh/opt/alt/alt-nodejs6/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-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/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__(((sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/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((sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pytExceptionAppend&s
	$cC�s-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-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pytFindQualifiedTargets0scC�s|jdd�}t|�dkr3|\}}nd}|jdd�}t|�dkrl|\}}nd}|||gS(Nt:iit#(trsplitRtNone(Rttarget_splitt
build_filettoolset((sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyR8scC�s�t|�\}}}|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/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyt
ResolveTargetKs
!		cC�st|�dS(Ni(R(tfully_qualified_target((sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyt	BuildFilemscC�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.(R!tenviron(tvar_listtdefaulttvar((sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pytGetEnvironFallbackrs
cC�s)|d|}|r%|d|}n|S(NRR((RRRtfully_qualified((sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pytQualifiedTarget{scC�s |rtjj|�}ntjj|�}tjj|�}tjdkr�tjj|�dj�tjj|�dj�kr�|Sn|jtjj	�}|jtjj	�}t
tjj||g��}tjjgt
|�|||}t
|�dkrdStjj
|�S(Ntwin32it(R!R"trealpathtabspathtsystplatformt
splitdrivetlowertsplittsepRtcommonprefixtpardirR$(R"trelative_totfollow_path_symlinkt
path_splittrelative_to_splitt
prefix_lentrelative_split((sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyR'�s cC�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.
  R N(RR'R!R"R$(R"ttoplevel_dir((sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pytInvertRelativePath�scC�s#tjj|�r|St||�S(N(R!R"R&R'(R"R@((sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pytFixIfRelativePath�scC�s1tjj|�}tjjtjj||��S(N(R!R"R%R#R$(R"R@trel_dir((sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/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"R5s\\\1(t
isinstanceRt_quotetsearchtretsubt_escape(targumenttquotetencoded((sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pytEncodePOSIXShellArguments
	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(tappendRUR$(tlisttencoded_argumentsRR((sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/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(tsettpoptaddtupdatetgetRW(ttarget_dictstrootsRZtpendingtrtspec((sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pytDeepDependencyTargets(s		

#cC�s)g|D]}t|�|kr|^qS(sHFrom a target_list, returns the subset from the specified build_file.
  (R,(ttarget_listRtp((sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pytBuildFileTargets;scC�s&t||�}t||�}||S(sNReturns all targets (direct and dependencies) for the specified build_file.
  (RiRf(RgRaRt	bftargetst
deptargets((sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyt
AllTargetsAsc�s#dtf�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(
ttempfiletmkstempR!R"R<ttmp_pathtfdopenttmp_filet	Exceptiontunlink(Rttmp_fd(tfilename(sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyRUs	"
cS�st|j|�S(N(tgetattrRv(Rtattrname((sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyt__getattr__bsc�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�R4(RvtclosetFalsetfilecmptcmpRttOSErrorterrnotENOENTR!RxtumasktchmodR8R9R"texiststremovetrenameRw(RtsameRR�(Rz(sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyR~fs&


!
(R
RR
RR}R~((Rz(sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyRmSs
	(tobject(RzRm((Rzsh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pytWriteOnDiffIs
<cC�s5ytjtjj|��Wntk
r0nXdS(s*Make sure the directory for |path| exists.N(R!tmakedirsR"R%R�(R"((sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pytEnsureDirExists�s
cC�s�idd6dd6dd6}d|kr/|dStj|krI|tjStjjd�r_dStjjd	�rud	Stjjd
�r�d
Stjjd�r�dStjjd�r�dSd
S(sFReturns |params.flavor| if it's set, the system's default flavor else.twintcygwinR4tmactdarwintflavortsunostsolaristfreebsdtopenbsdtnetbsdtaixtlinux(R8R9t
startswith(tparamstflavors((sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyt	GetFlavor�s&
c
C�s�idd6dd6dd6dd6j|d�}|s8dStjjtjjtjjt��d|�}t|��}|j	�}WdQXtjj|d|�}t|d	��/}|j
d
j|ddg|d
��WdQXtj|d�dS(sRFinds (flock|mac|win)_tool.gyp in the gyp directory and copies it
  to |out_path|.tflockR�R�R�R�Ns
%s_tool.pysgyp-%s-tooltwR5is!# Generated by gyp. Do not edit.
ii�(R`RR!R"R$R%R7t__file__topent	readlinestwriteR�(R�tout_pathRotsource_pathtsource_filetsourcet	tool_patht	tool_file((sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pytCopyTool�s"
	((cC�sn|dkrd�}ni}g}xC|D];}||�}||krOq+nd||<|j|�q+W|S(NcS�s|S(N((tx((sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyt<lambda>�R5i(RRV(tseqtidfuntseenRtitemtmarker((sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pytuniquer�s

t
OrderedSetcB�sqeZdd�Zd�Zd�Zd�Zd�Zd�Zd�Z	e
d�Zd�Zd	�Z
d
�ZRS(cC�sFg|_}|d||g7}i|_|dk	rB||O}ndS(N(tendRtmap(RtiterableR�((sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyR�s

	cC�s
t|j�S(N(RR�(R((sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyt__len__�scC�s
||jkS(N(R�(Rtkey((sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyt__contains__�scC�sO||jkrK|j}|d}|||g|d<|d<|j|<ndS(Nii(R�R�(RR�R�tcurr((sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyR^�s	
cC�sE||jkrA|jj|�\}}}||d<||d<ndS(Nii(R�R](RR�t	prev_itemt	next_item((sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pytdiscard�s
cc�s=|j}|d}x#||k	r8|dV|d}qWdS(Nii(R�(RR�R�((sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyt__iter__s
	
	cc�s=|j}|d}x#||k	r8|dV|d}qWdS(Nii(R�(RR�R�((sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyt__reversed__s
	
	cC�sN|std��n|r,|jddn|jdd}|j|�|S(Nsset is emptyiii(RR�R�(RtlastR�((sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyR]s
(
cC�s1|sd|jjfSd|jjt|�fS(Ns%s()s%s(%r)(t	__class__R
RW(R((sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyt__repr__scC�sSt|t�r=t|�t|�ko<t|�t|�kSt|�t|�kS(N(RLR�RRWR\(Rtother((sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyt__eq__s.cC�s1x*|D]"}||kr|j|�qqWdS(N(R^(RR�ti((sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyR_!s
N(R
RRRR�R�R^R�R�R�tTrueR]R�R�R_(((sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyR��s								t
CycleErrorcB�s eZdZd�Zd�ZRS(s9An exception raised when an unexpected cycle is detected.cC�s
||_dS(N(tnodes(RR�((sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyR)scC�sdt|j�S(NsCycleError: cycle involving: (RR�(R((sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyt__str__+s(R
RR
RR�(((sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/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�R^R�tinsert(tnodetneighbor(tVisitt	get_edgest
ordered_nodestvisitedtvisiting(sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyR�Hs


(RR\tsorted(tgraphR�R�((R�R�R�R�R�sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pytTopologicallySorted/s		cC�s|tjjd�p{tjjd�p{tjjd�p{tjjd�p{tjjd�p{tjjd�p{tjjd�S(NtGYP_CROSSCOMPILEtAR_hosttCC_hosttCXX_hostt	AR_targett	CC_targett
CXX_target(R!R-R`(((sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pytCrossCompileRequestedWs(-t
__future__RtcollectionsR�R�tos.pathR!RORrR8R�RRwRRRRR*R,R1R3R�R'RRGRHRJtcompileRMRQRURYRfRiRlR�R�R�R�R�t
MutableSetR�R�R�R�(((sh/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyt<module>sL
	
			"				
+
		"		
				I			$A	(

?>