Your IP : 3.129.25.152


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

�
��Rac@s�ddlZddlZddlZddlZddlZddlZddlZddlZe	e
kZdefd��YZ
defd��YZd�Zd�Zd�Zd	�Zd
�Zd�Zd�Ze
ed
��Ze
dd��Zd�Zd�Zejd�Zejd�Zd�Z d�Z!d�Z"d�Z#d�Z$d�Z%d�Z&d�Z'd�Z(dd�Z)dej*fd��YZ+defd ��YZ,d!�Z-d"�Z.d#�Z/dS($i����NtmemoizecBseZd�Zd�ZRS(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(s�Error 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|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-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.pyR9scCs�t|�\}}}|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|�}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-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.pytInvertRelativePath�scCs#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.pytFixIfRelativePath�scCs1tjj|�}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.pytUnrelativePath�ss[	
 #$%&'()*;<=>?[{|}~]|^$s(["\\`])cCs]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"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(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
(tappendRTR#(tlisttencoded_argumentsRQ((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pytEncodePOSIXShellLists
cCs�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(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+(ttarget_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#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).
  tWritercs>eZdZ�fd�Zd�Z�fd�Zd�ZRS(s?Wrapper around file which only covers the target if it differs.cs�t�rdntjj��}tjdddtjj��ddd|�\}|_ytj|d�|_	Wn$t
k
r�tj|j��nXdS(	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�|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�R3(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|jd��dS(Nsutf-8(Rvtwritetencode(Rts((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyR��s(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.pytWriteOnDiffJs
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.pytEnsureDirExists�s
cCs�idd6dd6dd6}d|kr/|dStj|krI|tjStjjd�r_dStjjd	�rud	Stjjd
�r�d
Stjjd�r�dStjjd�r�dStjjd
�r�d
Stjjd�r�d
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	GetFlavor�s.
c
Cs�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-tooltwR4is!# Generated by gyp. Do not edit.
ii�(R_RR R!R#R$R6t__file__topent	readlinesR�R�(R�tout_pathRntsource_pathtsource_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.pytCopyTool�s"
	((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.pyt<lambda>�R4i(RRU(tseqtidfuntseenRtitemtmarker((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pytuniquer�s

t
OrderedSetcBsqeZdd�Zd�Zd�Zd�Zd�Zd�Zd�Z	e
d�Zd�Z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.pyR�s

	cCs
t|j�S(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|<ndS(Nii(R�R�(RR�R�tcurr((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyR]s	
cCsE||jkrA|jj|�\}}}||d<||d<ndS(Nii(R�R\(RR�t	prev_itemt	next_item((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pytdiscards
ccs=|j}|d}x#||k	r8|dV|d}qWdS(Nii(R�(RR�R�((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyt__iter__
s
	
	ccs=|j}|d}x#||k	r8|dV|d}qWdS(Nii(R�(RR�R�((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyt__reversed__s
	
	cCsN|std��n|r,|jddn|jdd}|j|�|S(Nsset is emptyiii(RR�R�(RtlastR�((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyR\s
(
cCs1|sd|jjfSd|jjt|�fS(Ns%s()s%s(%r)(t	__class__R	RV(R((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyt__repr__#scCsSt|t�r=t|�t|�ko<t|�t|�kSt|�t|�kS(N(RKR�RRVR[(Rtother((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyt__eq__(s.cCs1x*|D]"}||kr|j|�qqWdS(N(R](RR�ti((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyR^.s
N(R	R
RRR�R�R]R�R�R�tTrueR\R�R�R^(((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyR��s								t
CycleErrorcBs eZdZd�Zd�ZRS(s9An exception raised when an unexpected cycle is detected.cCs
||_dS(N(tnodes(RR�((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyR6scCsdt|j�S(NsCycleError: cycle involving: (RR�(R((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyt__str__8s(R	R
RRR�(((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyR�4s	csdt���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']
  cs�|�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-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyR�Us


(RR[tsorted(tgraphR�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.pytTopologicallySorted<s		cCs|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-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
subprocesstPopentPIPEtSTDOUTtcommunicatetPY3tdecodeRRwR�(toutR�R�((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyRqos	
(0tcollectionsR�R�tos.pathR RNRrR7R�tbytesRR�R�RRwRRRRR)R+R0R2R�R&RRFRGRItcompileRLRPRTRXReRhRkR�R�R�R�R�t
MutableSetR�R�R�R�Rq(((sh/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/common.pyt<module>sP
	
			"				
+
		"		
				Q			$A	(	

?>