B
    bI                 @   s   d Z ddlZddlZG dd deZG dd deZG dd deZG d	d
 d
eZG dd deZ	G dd de
ZG dd deZdddZdS )zMSCons exception classes.

Used to handle internal and user errors in SCons.

    Nc            	       s*   e Zd ZdZd
 fdd	Zdd	 Z  ZS )
BuildErrora>  SCons Errors that can occur while building.

    Attributes:
      Information about the cause of the build error :

      errstr: a description of the error message

      status: the return code of the action that caused the build error.
        Must be set to a non-zero value even if the build error is not due
        to an action returning a non-zero returned code.

      exitstatus: SCons exit status due to this build error.
        Must be nonzero unless due to an explicit Exit()
        call.  Not always the same as status, since
        actions return a status code that should be
        respected, but SCons typically exits with 2
        irrespective of the return value of the failed
        action.

      filename: The name of the file or directory that caused the
        build error. Set to None if no files are associated with
        this error. This might be different from the target
        being built. For example, failure to create the
        directory in which the target file will appear. It
        can be None if the error is not due to a particular
        filename.

      exc_info: Info about exception that caused the build
        error. Set to (None, None, None) if this build
        error is not due to an exception.

      Information about the what caused the build error :

      node: the error occurred while building this target node(s)

      executor: the executor that caused the build to fail (might
        be None if the build failures is not due to the
        executor failing)

      action: the action that caused the build to fail (might be
        None if the build failures is not due to the an
        action failure)

      command: the command line for the action that caused the
        build to fail (might be None if the build failures
        is not due to the an action failure)

    NUnknown error   NNNc
       
         s^   t j|| _|| _|| _|| _|	| _|| _|| _	|| _
|| _t |||||||||		 d S )N)SConsUtilZ	to_Stringerrstrstatus
exitstatusfilenameexc_infonodeexecutoractioncommandsuper__init__)
selfr   r   r	   r
   r   r   r   r   r   )	__class__ +lib/python3.7/site-packages/SCons/Errors.pyr   T   s    zBuildError.__init__c             C   s    | j r| j d | j S | jS d S )Nz: )r   r   )r   r   r   r   __str__i   s    zBuildError.__str__)	Nr   r   r   NNNNr   )__name__
__module____qualname____doc__r   r   __classcell__r   r   )r   r   r   "   s
   0  r   c               @   s   e Zd ZdS )InternalErrorN)r   r   r   r   r   r   r   r   o   s   r   c               @   s   e Zd ZdS )	UserErrorN)r   r   r   r   r   r   r   r   r   s   r   c               @   s   e Zd ZdS )	StopErrorN)r   r   r   r   r   r   r   r   u   s   r   c               @   s   e Zd ZdS )SConsEnvironmentErrorN)r   r   r   r   r   r   r   r    x   s   r    c               @   s   e Zd ZdS )	MSVCErrorN)r   r   r   r   r   r   r   r!   {   s   r!   c                   s   e Zd Zd fdd	Z  ZS )ExplicitExitNc                s"   || _ || _|| _t j|  d S )N)r   r	   r
   r   r   )r   r   r	   args)r   r   r   r      s    zExplicitExit.__init__)NN)r   r   r   r   r   r   r   )r   r   r"   ~   s   r"   c             C   sz  |st | tr| j| df}t | tr2| }d|_nDt | tr^| j} d|  }t|| | |d}nt | ttfrtt	| dd|d}nt | t
jry
| j}W n tk
r   d}Y nX t| jd | jd||d}nt | tttfrt| dd}t| dt	| }t| d	d}t||d||d}nZt | trFtd
| jj| f dd|d}n0tj| rdt| ddd}ntd|  | dd}|S )a,  Convert a return code to a BuildError Exception.

    The `buildError.status` we set here will normally be
    used as the exit status of the "scons" process.

    Args:
      status: can either be a return code or an Exception.
      exc_info (tuple, optional): explicit exception information.

    Nr   zExplicit exit, status %s)r   r	   r
   r   r   )r   r	   r
   r   r   r   strerrorerrnoz%s : %s)r   r	   r
   zError %s)
isinstance	Exceptionr   r   r
   r"   r	   r   r   strshutilZSameFileErrorr   AttributeErrorr#   r%   r    OSErrorIOErrorgetattrr   r   r   Z	is_String)r	   r   Z
buildErrorr   r   r$   r%   r   r   r   convert_to_BuildError   sp    









r.   )N)r   r)   Z
SCons.Utilr   r'   r   r   r   r   r    r,   r!   r"   r.   r   r   r   r   <module>   s   M