B
    b                 @   s   d Z ddlZddlZddlZddlZddlmZ G dd dejZG dd dej	j
ZG dd	 d	ej	jZG d
d dej	j	Ze Zej	jej dS )zEAlias nodes.

This creates a hash of global Aliases (dummy targets).
    N)hash_signaturec               @   s   e Zd Zdd Zdd ZdS )AliasNameSpacec             K   sT   t |tjjjr|S y| | }W n. tk
rN   tjjj|f|}|| |< Y nX |S )N)
isinstanceSConsNodeAliasKeyError)selfnamekwa r   /lib/python3.7/site-packages/SCons/Node/Alias.pyr   %   s    zAliasNameSpace.Aliasc             K   s"   y| | S  t k
r   d S X d S )N)r   )r	   r
   r   r   r   r   lookup/   s    zAliasNameSpace.lookupN)__name__
__module____qualname__r   r   r   r   r   r   r   $   s   
r   c               @   s2   e Zd ZdZdZdgZdd Zdd Zdd	 Zd
S )AliasNodeInfo)csig   r   c             C   s
   t |S )N)default_ansr   )r	   sr   r   r   str_to_node9   s    zAliasNodeInfo.str_to_nodec             C   s   t | di  }xBt|  D ]2}x,t |ddD ]}t| |r0t | |||< q0W qW | j|d< y
|d= W n tk
r|   Y nX |S )a0  
        Return all fields that shall be pickled. Walk the slots in the class
        hierarchy and add those to the state dictionary. If a '__dict__' slot is
        available, copy all entries to the dictionary. Also include the version
        id, which is fixed for all instances of a class.
        __dict__	__slots__r   _version_id__weakref__)getattrcopytypemrohasattrcurrent_version_idr   )r	   stateobjr
   r   r   r   __getstate__<   s    


zAliasNodeInfo.__getstate__c             C   s4   |d= x(|  D ]\}}|dkrt| || qW dS )z>
        Restore the attributes from a pickled state.
        r   )r   N)itemssetattr)r	   r#   keyvaluer   r   r   __setstate__Q   s    zAliasNodeInfo.__setstate__N)	r   r   r   r   r"   Z
field_listr   r%   r*   r   r   r   r   r   5   s   r   c               @   s   e Zd ZdZdZdS )AliasBuildInfor   r   N)r   r   r   r   r"   r   r   r   r   r+   \   s   r+   c                   s   e Zd ZeZeZ fddZdd Zdd Z	dd Z
ejjjZejjjZd	d
 Zdd Zdd Zdd Zdd Zdd Z  ZS )r   c                s    t    || _d| _d| _d S )N   r   )super__init__r
   Zchanged_since_last_buildZ
store_info)r	   r
   )	__class__r   r   r.   e   s    
zAlias.__init__c             C   s   d|    d S )N")__str__)r	   r   r   r   str_for_displayk   s    zAlias.str_for_displayc             C   s   | j S )N)r
   )r	   r   r   r   r1   n   s    zAlias.__str__c             C   s   |    d S )N)get_csig)r	   r   r   r   
make_readyq   s    zAlias.make_readyc             C   s   dS )Nr,   r   )r	   dirr   r   r   is_underw   s    zAlias.is_underc             C   s   dd |   D }d|S )zcThe contents of an alias is the concatenation
        of the content signatures of all its sources.c             S   s   g | ]}|  qS r   )r3   ).0nr   r   r   
<listcomp>   s    z&Alias.get_contents.<locals>.<listcomp> )Zchildrenjoin)r	   Z	childsigsr   r   r   get_contents}   s    zAlias.get_contentsc             C   s   dS )z+An Alias is not recorded in .sconsign filesNr   )r	   r   r   r   sconsign   s    zAlias.sconsignc             C   s   dS )zA "builder" for aliases.Nr   )r	   r   r   r   build   s    zAlias.buildc             C   s2   y| ` W n tk
r   Y nX |   | j| _d S )N)ZbuilderAttributeErrorZreset_executorreally_buildr>   )r	   r   r   r   convert   s      zAlias.convertc             C   s<   y| j jS  tk
r   Y nX |  }t|}||  _|S )z
        Generate a node's content signature, the digested signature
        of its content.

        node - the node
        cache - alternate node to use for the signature cache
        returns - the content signature
        )Zninfor   r?   r<   r   Z	get_ninfo)r	   contentsr   r   r   r   r3      s    	
zAlias.get_csig)r   r   r   r   ZNodeInfor+   Z	BuildInfor.   r2   r1   r4   r   r   r>   r@   Zchildren_are_up_to_dateZis_up_to_dater6   r<   r=   rA   r3   __classcell__r   r   )r/   r   r   `   s   

r   )__doc__collectionsZSCons.Errorsr   Z
SCons.NodeZ
SCons.Utilr   UserDictr   r   ZNodeInfoBaser   ZBuildInfoBaser+   r   r   Zarg2nodes_lookupsappendr   r   r   r   r   <module>   s   'H