o
    ~îjD  ã                   @  sÒ   d Z ddlmZ ddlZddlZddlZddlmZ ddlm	Z	 ddl
mZ ddlmZ ddlmZmZmZ e	r>dd	lmZ G d
d„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deeƒZG dd„ deƒZdS )z)Build environment related pip exceptions.é    )ÚannotationsN)ÚIterable)ÚTYPE_CHECKING)Úescape)ÚText)ÚDiagnosticPipErrorÚInstallationErrorÚPipError)ÚInstallRequirementc                      s&   e Zd ZdZdZd‡ fdd„Z‡  ZS )ÚBuildDependencyInstallErrorz3Raised when build dependencies cannot be installed.zfailed-build-dependency-installÚreqúInstallRequirement | NoneÚ
build_reqsúIterable[str]ÚcauseÚ	ExceptionÚ	log_linesúlist[str] | NoneÚreturnÚNonec                  sÈ   t |tƒrd}nd}|d u rtdƒ}n5t |tƒr!| d|› �¡ n| d t |¡¡ ¡ ¡ t 	dd |¡› d�d	t
|ƒ› d
�dfd |¡d¡}tddƒ}|rX|td|› �ƒ7 }tƒ j||d |d� d S )Nú&This is likely not a problem with pip.zmpip crashed unexpectedly. Please file an issue on pip's issue tracker: https://github.com/pypa/pip/issues/newzSee above for more details.zERROR: Ú zInstalling ú Ú
ú[z lines of output]
Úred)z
[end of output]r   z!Cannot install build dependenciesÚgreenz for ©ÚmessageÚcontextÚ	hint_stmtÚ	note_stmt)Ú
isinstancer	   r   ÚappendÚextendÚjoinÚ	tracebackÚformat_exceptionÚ
splitlinesÚassembleÚlenÚsuperÚ__init__)Úselfr   r   r   r   Únoter   r   ©Ú	__class__© úh/raid/bulk_storage/M2HATS/real-image-venv/lib/python3.10/site-packages/pip/_internal/exceptions/build.pyr,      s.   
ÿ

ÿü

ÿz$BuildDependencyInstallError.__init__)
r   r   r   r   r   r   r   r   r   r   ©Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	referencer,   Ú__classcell__r1   r1   r/   r2   r      ó    r   c                      s&   e Zd ZdZdZd‡ fdd„Z‡  ZS )ÚVenvImportErrorz%Raised when 'venv' can't be imported.zvenv-import-errorr   r   c                   s,   t jdkrd }nd}tƒ jddd|d� d S )NÚlinuxz�If this is an OS-provided Python, it's likely that your OS package maintainers have split Python's standard library across multiple OS packages.z>Cannot import the 'venv' module of the Python standard libraryzMThis is a symptom of a broken/modified Python, which cannot be used with pip.z>This is an issue with the Python installation itself, not pip.)r   r   r!   r    )ÚsysÚplatformr+   r,   )r-   r    r/   r1   r2   r,   M   s   
ÿ
ùzVenvImportError.__init__)r   r   r3   r1   r1   r/   r2   r;   H   r:   r;   c                      s&   e Zd ZdZdZd	‡ fdd„Z‡  ZS )
ÚVenvCreationErrorz3Raised when a virtual environment can't be created.zvenv-creation-errorr   Ústrr   r   c                   s.   t jdkrd}nd }tƒ jdt|ƒ|d� d S )NÚntz1This may be caused by running antivirus software.z#Cannot create a virtual environment)r   r   r    )ÚosÚnamer+   r,   r   )r-   r   Úhintr/   r1   r2   r,   f   s   

ýzVenvCreationError.__init__)r   r@   r   r   r3   r1   r1   r/   r2   r?   a   r:   r?   c                      s0   e Zd ZdZdZd‡ fdd„Zddd„Z‡  ZS )ÚInstallationSubprocessErrorzA subprocess call failed.zsubprocess-exited-with-errorÚcommand_descriptionr@   Ú	exit_codeÚintÚoutput_linesr   r   r   c                  st   |d u r	t dƒ}nt  dt|ƒ› d�¡t d |¡ƒ t  d¡ }tƒ jdt|ƒ› d|› �|d dd	� || _|| _d S )
NzNo available output.z[red][z lines of output][/]
r   z[red]\[end of output][/]z[green]z)[/] did not run successfully.
exit code: zNThis error originates from a subprocess, and is likely not a problem with pip.r   )	r   Úfrom_markupr*   r%   r+   r,   r   rF   rG   )r-   rF   rG   rI   Úoutput_promptr/   r1   r2   r,   w   s$   
ÿþÿÿø
z$InstallationSubprocessError.__init__c                 C  s   | j › d| j› �S )Nz exited with )rF   rG   ©r-   r1   r1   r2   Ú__str__—   s   z#InstallationSubprocessError.__str__)rF   r@   rG   rH   rI   r   r   r   ©r   r@   )r4   r5   r6   r7   r8   r,   rM   r9   r1   r1   r/   r2   rE   r   s
     rE   c                   @  s(   e Zd ZdZdZdd	d
„Zddd„ZdS )ÚBackendUnavailableErrorz&The build backend could not be loaded.zbackend-unavailableÚ	hook_namer@   Úbackend_nameÚbackend_errorr   r   c                C  s0   t j| dt|ƒ›d�|d dd� d|› �| _d S )NzCannot import build backend Ú.r   r   zCalling build backend hook )r   r,   r   rF   )r-   rP   rQ   rR   r1   r1   r2   r,       s   ûz BackendUnavailableError.__init__c                 C  s
   t | jƒS )N)r@   r   rL   r1   r1   r2   rM   ¬   s   
zBackendUnavailableError.__str__N)rP   r@   rQ   r@   rR   r@   r   r   rN   )r4   r5   r6   r7   r8   r,   rM   r1   r1   r1   r2   rO   ›   s
    
rO   )r7   Ú
__future__r   rB   r=   r&   Úcollections.abcr   Útypingr   Úpip._vendor.rich.markupr   Úpip._vendor.rich.textr   Úpip._internal.exceptions._baser   r   r	   Úpip._internal.req.req_installr
   r   r;   r?   rE   rO   r1   r1   r1   r2   Ú<module>   s"    0)