HEX
Server: Apache
System: Linux p102.lithium.hosting 4.18.0-553.141.1.el8_10.x86_64 #1 SMP Fri Jul 10 17:48:02 UTC 2026 x86_64
User: bvzmoamr (9955)
PHP: 8.1.34
Disabled: syslog
Upload Files
File: //proc/self/root/usr/lib/python3.6/site-packages/gyp/__pycache__/common.cpython-36.pyc
3

?9�^.P�@s�ddlmZddlZddlZddlZddlZddlZddlZyddl	m
Z
Wn ek
rlddlm
Z
YnXGdd�de
�ZGdd�de�Zdd	�Zd
d�Zdd
�Zdd�Zdd�Zdd�Zdd�Zed=dd��Zed>dd��Zdd�Zdd�Zejd�Zejd �Zd!d"�Zd#d$�Z d%d&�Z!d'd(�Z"d)d*�Z#d+d,�Z$d-d.�Z%d/d0�Z&ifd1d2�Z'd?d3d4�Z(Gd5d6�d6e
�Z)Gd7d8�d8e�Z*d9d:�Z+d;d<�Z,dS)@�)�with_statementN)�
MutableSetc@seZdZdd�Zdd�ZdS)�memoizecCs||_i|_dS)N)�func�cache)�selfr�r�/usr/lib/python3.6/common.py�__init__szmemoize.__init__cGs8y
|j|Stk
r2|j|�}||j|<|SXdS)N)r�KeyErrorr)r�args�resultrrr	�__call__s


zmemoize.__call__N)�__name__�
__module__�__qualname__r
rrrrr	rsrc@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#srcCsf|js|f|_nRt|j�dkr:t|jd�d|f|_n(t|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>9sz(FindQualifiedTargets.<locals>.<listcomp>r)rZqualified_listr)rr	�FindQualifiedTargets4sr cCsV|jdd�}t|�dkr"|\}}nd}|jdd�}t|�dkrH|\}}nd}|||gS)N�:r��#)�rsplitr)rZtarget_split�
build_file�toolsetrrr	r<s

rcCsbt|�\}}}|rP|rLtjjtjjtjj|�|��}tjj|�sPt|d�}n|}|rX|}|||gS)N�.)r�os�path�normpath�join�dirname�isabs�RelativePath)r%rr&Zparsed_build_fileZparsed_toolsetrrr	�
ResolveTargetOs
r/cCst|�dS)Nr)r)Zfully_qualified_targetrrr	�	BuildFileqsr0cCs&x |D]}|tjkrtj|SqW|S)zpLook up a key in the environment, with fallback to secondary keys
  and finally falling back to a default value.)r(�environ)Zvar_list�default�varrrr	�GetEnvironFallbackvs

r4cCs |d|}|r|d|}|S)Nr!r#r)r%rr&Zfully_qualifiedrrr	�QualifiedTargetsr5TcCs�|rtjj|�}ntjj|�}tjj|�}tjdkr`tjj|�dj�tjj|�dj�kr`|S|jtjj	�}|jtjj	�}t
tjj||g��}tjjgt
|�|||d�}t
|�dkr�dStjj
|�S)N�win32r�)r(r)�realpath�abspath�sys�platform�
splitdrive�lower�split�sepr�commonprefix�pardirr+)r)�relative_toZfollow_path_symlinkZ
path_splitZrelative_to_splitZ
prefix_lenZrelative_splitrrr	r.�s 
r.cCs,|s|S|dkrdn|}t|tjj||��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')r.r(r)r+)r)Ztoplevel_dirrrr	�InvertRelativePath�srCcCstjj|�r|St||�S)N)r(r)r-r.)r)rBrrr	�FixIfRelativePath�srDcCs"tjj|�}tjjtjj||��S)N)r(r)r,r*r+)r)rBZrel_dirrrr	�UnrelativePath�srEz[	
 #$%&'()*;<=>?[{|}~]|^$z(["\\`])cCs@t|t�st|�}tj|�r"d}nd}|tjtd|�|}|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.
  �"r7z\\\1)�
isinstancer�_quote�search�re�sub�_escape)�argumentZquoteZencodedrrr	�EncodePOSIXShellArguments


rNcCs*g}x|D]}|jt|��q
Wdj|�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)�appendrNr+)�listZencoded_argumentsrMrrr	�EncodePOSIXShellLists
rQcCsxt�}t|�}xX|rf|j�}||kr&q|j|�||}|jt|jdg���|jt|jdg���qWt|t|��S)z2Returns the recursive list of target dependencies.�dependenciesZdependencies_original)�set�pop�add�update�getrP)�target_dicts�rootsrR�pending�r�specrrr	�DeepDependencyTargets,s
r]cs�fdd�|D�S)zHFrom a target_list, returns the subset from the specified build_file.
  csg|]}t|��kr|�qSr)r0)r�p)r%rr	rBsz$BuildFileTargets.<locals>.<listcomp>r)�target_listr%r)r%r	�BuildFileTargets?sr`cCst||�}t||�}||S)zNReturns all targets (direct and dependencies) for the specified build_file.
  )r`r])r_rXr%Z	bftargetsZ
deptargetsrrr	�
AllTargetsEs

racsG�fdd�dt�}|�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).
  cs0eZdZdZ�fdd�Zdd�Z�fdd�ZdS)	zWriteOnDiff.<locals>.Writerz?Wrapper around file which only covers the target if it differs.csltjdtjj��ddtjj��dd�\}|_ytj|d�|_Wn"tk
rftj	|j��YnXdS)Nz.tmprz.gyp.r)�suffix�prefix�dir�w)
�tempfileZmkstempr(r)r>�tmp_path�fdopen�tmp_file�	Exception�unlink)rZtmp_fd)�filenamerr	r
Ysz$WriteOnDiff.<locals>.Writer.__init__cSst|j|�S)N)�getattrri)rZattrnamerrr	�__getattr__fsz'WriteOnDiff.<locals>.Writer.__getattr__cs�y�|jj�d}ytj|j�d�}Wn0tk
rT}z|jtjkrD�WYdd}~XnX|rhtj	|j�nVtj
d�}tj
|�tj|jd|@�tj
dkr�tjj��r�tj��tj|j��Wn"tk
r�tj	|j��YnXdS)NF�?i�r6)ri�close�filecmpZcmprg�OSError�errno�ENOENTr(rk�umask�chmodr:r;r)�exists�remove�renamerj)rZsamerru)rlrr	rpjs&



z!WriteOnDiff.<locals>.Writer.closeN)rrrrr
rnrpr)rlrr	�WriterWs
rz)�object)rlrzr)rlr	�WriteOnDiffMs
<r|cCs0ytjtjj|��Wntk
r*YnXdS)z*Make sure the directory for |path| exists.N)r(�makedirsr)r,rr)r)rrr	�EnsureDirExists�sr~cCs�dddd�}d|kr|dStj|kr0|tjStjjd�r@dStjjd�rPdStjjd�r`dStjjd	�rpd	Stjjd
�r�d
Stjjd�r�dStjjd�r�dSd
S)zFReturns |params.flavor| if it's set, the system's default flavor else.�win�mac)�cygwinr6�darwin�flavor�sunos�solarisZfreebsdZopenbsdZnetbsd�aixZzosZos390�linux)r:r;�
startswith)ZparamsZflavorsrrr	�	GetFlavor�s,

r�cCs�ddddd�j|d�}|sdStjjtjjtjjt��d|�}t|��}|j�}WdQRXd}|jdd�}|dkr�|r�|d	|7}tjj|d
|�}	t|	d��*}
|
j	dj|d
|g|dd���WdQRXtj
|	d�dS)zRFinds (flock|mac|win)_tool.gyp in the gyp directory and copies it
  to |out_path|.Zflockr�r)r�r�r�rNz
%s_tool.pyz!# Generated by gyp. Do not edit.
�mac_toolchain_dirz,import os;
os.environ['DEVELOPER_DIR']='%s'
zgyp-%s-toolrer7rri�)rWr(r)r+r,r9�__file__�open�	readlines�writerv)r�Zout_pathZgenerator_flagsrc�source_pathZsource_file�source�headerr�Z	tool_pathZ	tool_filerrr	�CopyTool�s*
*r�cCsN|dkrdd�}i}g}x0|D](}||�}||kr4qd||<|j|�qW|S)NcSs|S)Nr)�xrrr	�<lambda>�szuniquer.<locals>.<lambda>r)rO)�seqZidfun�seenr
�itemZmarkerrrr	�uniquer�s
r�c@sheZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	ddd�Z
dd�Zdd�Zdd�Z
dS)�
OrderedSetNcCs2g|_}|d||g7}i|_|dk	r.||O}dS)N)�end�map)r�iterabler�rrr	r
�s

zOrderedSet.__init__cCs
t|j�S)N)rr�)rrrr	�__len__�szOrderedSet.__len__cCs
||jkS)N)r�)r�keyrrr	�__contains__szOrderedSet.__contains__cCs<||jkr8|j}|d}|||g|d<|d<|j|<dS)Nrr")r�r�)rr�r��currrrr	rUs
zOrderedSet.addcCs0||jkr,|jj|�\}}}||d<||d<dS)Nr"r)r�rT)rr�Z	prev_itemZ	next_itemrrr	�discard	s
zOrderedSet.discardccs2|j}|d}x||k	r,|dV|d}qWdS)Nr"r)r�)rr�r�rrr	�__iter__s


zOrderedSet.__iter__ccs2|j}|d}x||k	r,|dV|d}qWdS)Nrr)r�)rr�r�rrr	�__reversed__s


zOrderedSet.__reversed__TcCs:|std��|r|jddn|jdd}|j|�|S)Nzset is emptyrrr")rr�r�)rZlastr�rrr	rTs
 
zOrderedSet.popcCs&|sd|jjfSd|jjt|�fS)Nz%s()z%s(%r))�	__class__rrP)rrrr	�__repr__%szOrderedSet.__repr__cCs:t|t�r*t|�t|�ko(t|�t|�kSt|�t|�kS)N)rGr�rrPrS)r�otherrrr	�__eq__*s
 zOrderedSet.__eq__cCs$x|D]}||kr|j|�qWdS)N)rU)rr��irrr	rV0s
zOrderedSet.update)N)T)rrrr
r�r�rUr�r�r�rTr�r�rVrrrr	r��s

r�c@s eZdZdZdd�Zdd�ZdS)�
CycleErrorz9An exception raised when an unexpected cycle is detected.cCs
||_dS)N)�nodes)rr�rrr	r
8szCycleError.__init__cCsdt|j�S)NzCycleError: cycle involving: )rr�)rrrr	�__str__:szCycleError.__str__N)rrrrr
r�rrrr	r�6sr�csJt���t��t��g������fdd��xt|�D]}�|�q6W�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']
  csd|�krt���|�krdS�j|��j|�x�|�D]}�|�q:W�j|��jd|�dS)Nr)r�rUrx�insert)�nodeZneighbor)�Visit�	get_edges�
ordered_nodes�visited�visitingrr	r�Ws


z"TopologicallySorted.<locals>.Visit)rrS�sorted)Zgraphr�r�r)r�r�r�r�r�r	�TopologicallySorted>sr�cCsTtjjd�pRtjjd�pRtjjd�pRtjjd�pRtjjd�pRtjjd�pRtjjd�S)NZGYP_CROSSCOMPILEZAR_hostZCC_hostZCXX_hostZ	AR_targetZ	CC_targetZ
CXX_target)r(r1rWrrrr	�CrossCompileRequestedfsr�)T)N)N)-Z
__future__rrsrqZos.pathr(rJrfr:�collections.abcr�ImportError�collectionsr{rrjrrr rr/r0r4r5r.rCrDrE�compilerHrLrNrQr]r`rar|r~r�r�r�r�r�r�r�rrrr	�<module>sR

"	
+
"


I+
A(