PHP WebShell

Текущая директория: /opt/BitGoJS/node_modules/node-gyp/gyp/pylib/gyp/__pycache__

Просмотр файла: common.cpython-310.pyc

o

�1h�X�@srddlZddlZddlZddlZddlZddlZddlZddlm	Z	Gdd�d�Z
Gdd�de�Zdd�Z
d	d
�Zdd�Zd
d�Zdd�Zdd�Zdd�Ze
d@dd��Ze
dAdd��Zdd�Zdd�Ze�d�Ze�d�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Z d,d-�Z!d.d/�Z"ifd0d1�Z#d2d3�fd4d5�Z$Gd6d7�d7e	�Z%Gd8d9�d9e�Z&d:d;�Z'd<d=�Z(d>d?�Z)dS)B�N)�
MutableSetc@seZdZdd�Zdd�ZdS)�memoizecCs||_i|_dS�N)�func�cache)�selfr�r�:/opt/BitGoJS/node_modules/node-gyp/gyp/pylib/gyp/common.py�__init__s
zmemoize.__init__cGs8z|j|WSty|j|�}||j|<|YSwr)r�KeyErrorr)r�args�resultrrr	�__call__s

�zmemoize.__call__N)�__name__�
__module__�__qualname__r
rrrrr	rsrc@seZdZdZdS)�GypErrorz�Error class representing an error, which is to be presented
  to the user.  The main entry point will catch and display this.
  N)rrr�__doc__rrrr	r srcCsj|js	|f|_dSt|j�dkrt|jd�d|f|_dSt|jd�d|f|jdd�|_dS)z2Append a message to the given exception's message.�r� N)r�len�str)�e�msgrrr	�ExceptionAppend(s
,rcs�fdd�|D�S)zc
  Given a list of qualified targets, return the qualified targets for the
  specified |target|.
  cs g|]}t|�d�kr|�qS)r��ParseQualifiedTarget)�.0�t��targetrr	�
<listcomp>7s z(FindQualifiedTargets.<locals>.<listcomp>r)r �qualified_listrrr	�FindQualifiedTargets2sr#cCsV|�dd�}t|�dkr|\}}nd}|�dd�}t|�dkr$|\}}nd}|||gS)N�:r��#)�rsplitr)r �target_split�
build_file�toolsetrrr	r:s


rcCsbt|�\}}}|r(|r&tj�tj�tj�|�|��}tj�|�s%t|d�}n|}|r,|}|||gS)N�.)r�os�path�normpath�join�dirname�isabs�RelativePath)r)r r*�parsed_build_file�parsed_toolsetrrr	�
ResolveTargetMs
�
�
r5cCst|�dS�Nrr)�fully_qualified_targetrrr	�	BuildFilep�r8cCs&|D]}|tjvrtj|Sq|S)zpLook up a key in the environment, with fallback to secondary keys
  and finally falling back to a default value.)r,�environ)�var_list�default�varrrr	�GetEnvironFallbackus

�r>cCs |d|}|r|d|}|S)Nr$r&r)r)r r*�fully_qualifiedrrr	�QualifiedTarget~sr@TcCs�|r	tj�|�}ntj�|�}tj�|�}tjdkr0tj�|�d��tj�|�d��kr0|S|�tjj	�}|�tjj	�}t
tj�||g��}tjjgt
|�|||d�}t
|�dkradStjj
|�S)N�win32r�)r,r-�realpath�abspath�sys�platform�
splitdrive�lower�split�sepr�commonprefix�pardirr/)r-�relative_to�follow_path_symlink�
path_split�relative_to_split�
prefix_len�relative_splitrrr	r2�s(
�
�
�r2cCs,|s|S|dur
dn|}t|tj�||��S)aGiven 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.
  Nr+)r2r,r-r/)r-�toplevel_dirrrr	�InvertRelativePath�srTcCstj�|�r|St||�Sr)r,r-r1r2)r-rMrrr	�FixIfRelativePath�s
rUcCs"tj�|�}tj�tj�||��Sr)r,r-r0r.r/)r-rM�rel_dirrrr	�UnrelativePath�srWz[	
 #$%&'()*;<=>?[{|}~]|^$z(["\\`])cCs@t|t�s	t|�}t�|�rd}nd}|t�td|�|}|S)a�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.
  �"rBz\\\1)�
isinstancer�_quote�search�re�sub�_escape)�argument�quote�encodedrrr	�EncodePOSIXShellArguments


rbcCs&g}|D]	}|�t|��qd�|�S)z�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)�appendrbr/)�list�encoded_argumentsr_rrr	�EncodePOSIXShellList"s
rfcCsvt�}t|�}|r3|��}||vrq|�|�||}|�t|�dg���|�t|�dg���|s	t|t|��S)z2Returns the recursive list of target dependencies.�dependencies�dependencies_original)�set�pop�add�update�getrd)�target_dicts�rootsrg�pending�r�specrrr	�DeepDependencyTargets/s
�rscs�fdd�|D�S)zHFrom a target_list, returns the subset from the specified build_file.
  csg|]
}t|��kr|�qSr)r8)r�p�r)rr	r!Esz$BuildFileTargets.<locals>.<listcomp>r)�target_listr)rrur	�BuildFileTargetsBsrwcCst||�}t||�}||S)zNReturns all targets (direct and dependencies) for the specified build_file.
  )rwrs)rvrnr)�	bftargets�
deptargetsrrr	�
AllTargetsHs

rzcsG�fdd�d�}|�S)z�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).
  cs8eZdZdZ�fdd�Zdd�Z�fdd�Zdd	�Zd
S)zWriteOnDiff.<locals>.Writerz?Wrapper around file which only covers the target if it differs.csnt�rdntj���}tjdtj���dd|d�\}|_z
t�|d�|_	WdSt
y6t�|j��w)NrBz.tmprz.gyp.)�suffix�prefix�dir�wb)�IsCygwinr,r-r0�tempfile�mkstemprI�tmp_path�fdopen�tmp_file�	Exception�unlink)r�
base_temp_dir�tmp_fd��filenamerr	r
]s	��z$WriteOnDiff.<locals>.Writer.__init__cSst|j|�Sr)�getattrr�)r�attrnamerrr	�__getattr__tr9z'WriteOnDiff.<locals>.Writer.__getattr__c
s�zd|j��d}z
t�|j�d�}Wnty+}z
|jtjkr!�WYd}~nd}~ww|r7t�	|j�WdSt�
d�}t�
|�t�|jd|@�tj
dkr[tj���r[t���t�|j��WdStyrt�	|j��w)NF�?i�rA)r��close�filecmp�cmpr��OSError�errno�ENOENTr,r��umask�chmodrErFr-�exists�remove�renamer�)r�samerr�r�rr	r�xs.
���


�z!WriteOnDiff.<locals>.Writer.closecSs|j�|�d��dS)N�utf-8)r��write�encode)r�srrr	r��sz!WriteOnDiff.<locals>.Writer.writeN)rrrrr
r�r�r�rr�rr	�WriterZs+r�r)r�r�rr�r	�WriteOnDiffPs
Lr�cCs.zt�tj�|��WdStyYdSw)z*Make sure the directory for |path| exists.N)r,�makedirsr-r0r�)r-rrr	�EnsureDirExists�s
�r�cCs�dddd�}d|vr|dStj|vr|tjStj�d�r dStj�d�r(dStj�d	�r0d	Stj�d
�r8d
Stj�d�r@dStj�d�rHd
StjdkrOdSdS)zFReturns |params.flavor| if it's set, the system's default flavor else.�win�mac)�cygwinrA�darwin�flavor�sunos�solaris)�	dragonfly�freebsdr��openbsd�netbsd�aix)�os390�zosr��os400�linux)rErF�
startswith)�params�flavorsrrr	�	GetFlavor�s.�


r�c	Csddddddd��|d�}|sdStj�tj�tj�t��d|�}t|��}|��}Wd�n1s5wYd}|�dd�}|dkrN|rN|d	|7}tj�|d
|�}	t|	d��}
|
�	d�|d
|g|dd���Wd�n1sywYt�
|	d�dS)zRFinds (flock|mac|win)_tool.gyp in the gyp directory and copies it
  to |out_path|.�flockr�r�)r�r�r�r��iosr�Nz
%s_tool.pyz!# Generated by gyp. Do not edit.
�mac_toolchain_dirz,import os;
os.environ['DEVELOPER_DIR']='%s'
zgyp-%s-tool�wrBrri�)rmr,r-r/r0rD�__file__�open�	readlinesr�r�)r��out_path�generator_flagsr|�source_path�source_file�source�headerr��	tool_path�	tool_filerrr	�CopyTool�s4���

�&�r�cCs|Srr)�xrrr	�<lambda>�sr�cCs:i}g}|D]}||�}||vrqd||<|�|�q|S)Nr)rc)�seq�idfun�seenr
�item�markerrrr	�uniquer�sr�c@sheZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	ddd�Z
dd�Zdd�Zdd�Z
dS)�
OrderedSetNcCs6g|_}|d||g7}i|_|dur||O}dSdSr)�end�map)r�iterabler�rrr	r

s
�zOrderedSet.__init__cCs
t|j�Sr)rr��rrrr	�__len__�
zOrderedSet.__len__cCs
||jvSr)r�)r�keyrrr	�__contains__r�zOrderedSet.__contains__cCs@||jvr|j}|d}|||g|d<|d<|j|<dSdS)Nrr%)r�r�)rr�r��currrrr	rks

$�zOrderedSet.addcCs4||jvr|j�|�\}}}||d<||d<dSdS)Nr%r)r�rj)rr��	prev_item�	next_itemrrr	�discards

�zOrderedSet.discardcc�:�|j}|d}||ur|dV|d}||usdSdS)Nr%r�r��rr�r�rrr	�__iter__#��
�zOrderedSet.__iter__ccr�)Nrrr�r�rrr	�__reversed__*r�zOrderedSet.__reversed__TcCs:|std��|r|jddn|jdd}|�|�|S)Nzset is emptyrrr%)rr�r�)r�lastr�rrr	rj2s
 
zOrderedSet.popcCs*|s	|jj�d�S|jj�dt|��d�S)Nz()�(�))�	__class__rrdr�rrr	�__repr__9szOrderedSet.__repr__cCs:t|t�rt|�t|�kot|�t|�kSt|�t|�kSr)rYr�rrdri)r�otherrrr	�__eq__>s
 zOrderedSet.__eq__cCs |D]}||vr
|�|�qdSr)rk)rr��irrr	rlDs

��zOrderedSet.updater�T)rrrr
r�r�rkr�r�r�rjr�r�rlrrrr	r�	s

r�c@s eZdZdZdd�Zdd�ZdS)�
CycleErrorz9An exception raised when an unexpected cycle is detected.cCs
||_dSr)�nodes)rr�rrr	r
Mr�zCycleError.__init__cCsdt|j�S)NzCycleError: cycle involving: )rr�r�rrr	�__str__PszCycleError.__str__N)rrrrr
r�rrrr	r�Jsr�csFt���t��t��g������fdd��t|�D]}�|�q�S)a�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`|�vrt���|�vrdS��|���|��|�D]}�|�q��|���d|�dSr6)r�rkr��insert)�node�neighbor��Visit�	get_edges�
ordered_nodes�visited�visitingrr	r�ns



z"TopologicallySorted.<locals>.Visit)rri�sorted)�graphr�r�rr�r	�TopologicallySortedTs
r�cCsTtj�d�p)tj�d�p)tj�d�p)tj�d�p)tj�d�p)tj�d�p)tj�d�S)N�GYP_CROSSCOMPILE�AR_host�CC_host�CXX_host�	AR_target�	CC_target�
CXX_target)r,r:rmrrrr	�CrossCompileRequesteds
�
�
�
�
�
�rcCsJztjdtjtjd�}|��d�d�}dt|�vWSty$YdSw)N�uname)�stdout�stderrrr��CYGWINF)�
subprocess�Popen�PIPE�STDOUT�communicate�decoderr�)�outrrrr	r�s
��rr�r)*r�r��os.pathr,r\r�rEr�collections.abcrrr�rrr#rr5r8r>r@r2rTrUrW�compilerZr^rbrfrsrwrzr�r�r�r�r�r�r�r�rrrrrr	�<module>sP
#	
.

"

Y-
A
+

Выполнить команду


Для локальной разработки. Не используйте в интернете!