o
    àejã  ã                   @  s–   d dl m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 d dlmZ d d	lmZ er<d d
lmZ e e¡ZG dd„ de
ƒZdS )é    )ÚannotationsN)ÚIterable)ÚTYPE_CHECKING)ÚBuildEnvironment)ÚAbstractDistribution)ÚInstallationError)ÚBaseDistribution)Úrunner_with_spinner_message)ÚBuildEnvironmentInstallerc                   @  sn   e Zd ZdZed%dd„ƒZd&dd„Zd'dd„Zd(dd„Zd)dd„Z	d)dd„Z
d(dd„Zd*dd„Zd+d"d#„Zd$S ),ÚSourceDistributionzRepresents a source distribution.

    The preparation step for these needs metadata for the packages to be
    generated.
    Úreturnú
str | Nonec                 C  s   | j jsJ ‚| j jjS )z/Identify this requirement uniquely by its link.)ÚreqÚlinkÚurl_without_fragment©Úself© r   úa/var/www/html/choboyeo/PHP/venv/lib/python3.10/site-packages/pip/_internal/distributions/sdist.pyÚbuild_tracker_id   s   
z#SourceDistribution.build_tracker_idr   c                 C  s
   | j  ¡ S )N)r   Úget_distr   r   r   r   Úget_metadata_distribution    s   
z,SourceDistribution.get_metadata_distributionÚbuild_env_installerr
   Úbuild_isolationÚboolÚcheck_build_depsÚNonec                 C  sŽ   | j  ¡  |r|  |¡ | j  ¡  |  |¡ n| j  ¡  |r@| j j}|d us(J ‚| j j |¡\}}|r9|  d|¡ |r@|  	|¡ | j  
¡  d S )Núthe backend dependencies)r   Úload_pyproject_tomlÚ_prepare_build_backendÚeditable_sanity_checkÚ_install_build_reqsÚpyproject_requiresÚ	build_envÚcheck_requirementsÚ_raise_conflictsÚ_raise_missing_reqsÚprepare_metadata)r   r   r   r   r"   ÚconflictingÚmissingr   r   r   Úprepare_distribution_metadata#   s"   



ÿ
z0SourceDistribution.prepare_distribution_metadatac              	   C  s”   | j j}|d us
J ‚t|ƒ| j _| j jj|dd| j d� | j j | j j¡\}}|r/|  d|¡ |rHt 	d| j ¡ t 	dd 
ttt|ƒƒ¡¡ d S d S )NÚoverlayzbuild dependencies©ÚkindÚfor_reqz"PEP 517/518 supported requirementsz4Missing build requirements in pyproject.toml for %s.z`The project does not specify a build backend, and pip cannot fall back to setuptools without %s.z and )r   r"   r   r#   Úinstall_requirementsr$   Úrequirements_to_checkr%   ÚloggerÚwarningÚjoinÚmapÚreprÚsorted)r   r   r"   r(   r)   r   r   r   r   I   s*   
ÿÿþýûz)SourceDistribution._prepare_build_backendúIterable[str]c              	   C  óŠ   | j j�7 tdƒ}| j j}|d usJ ‚| |¡� | ¡ W  d   ƒ W  d   ƒ S 1 s.w   Y  W d   ƒ d S 1 s>w   Y  d S )Nz#Getting requirements to build wheel)r   r#   r	   Úpep517_backendÚsubprocess_runnerÚget_requires_for_build_wheel©r   ÚrunnerÚbackendr   r   r   Ú_get_build_requires_wheele   s   
ÿü"üz,SourceDistribution._get_build_requires_wheelc              	   C  r8   )Nz&Getting requirements to build editable)r   r#   r	   r9   r:   Úget_requires_for_build_editabler<   r   r   r   Ú_get_build_requires_editablem   s   
ÿÿú"úz/SourceDistribution._get_build_requires_editablec                 C  sh   | j jr| j jr| j jr|  ¡ }n|  ¡ }| j j |¡\}}|r&|  d|¡ | j jj	|dd| j d� d S )Nr   Únormalzbackend dependenciesr,   )
r   ÚeditableÚpermit_editable_wheelsÚsupports_pyproject_editablerA   r?   r#   r$   r%   r/   )r   r   Ú
build_reqsr(   r)   r   r   r   r!   w   s   ÿþý


ÿz&SourceDistribution._install_build_reqsÚconflicting_withÚstrÚconflicting_reqsúset[tuple[str, str]]c                 C  s2   d}|j | j|d dd„ t|ƒD ƒ¡d�}t|ƒ‚)NzZSome build dependencies for {requirement} conflict with {conflicting_with}: {description}.ú, c                 s  s"   � | ]\}}|› d |› �V  qdS )z is incompatible with Nr   )Ú.0Ú	installedÚwantedr   r   r   Ú	<genexpr>–   s
   € ÿ
ÿz6SourceDistribution._raise_conflicts.<locals>.<genexpr>)ÚrequirementrG   Údescription)Úformatr   r3   r6   r   )r   rG   rI   Úformat_stringÚerror_messager   r   r   r%   Œ   s   ÿ
þýz#SourceDistribution._raise_conflictsr)   úset[str]c                 C  s,   d}|j | jd ttt|ƒƒ¡d�}t|ƒ‚)NzASome build dependencies for {requirement} are missing: {missing}.rK   )rP   r)   )rR   r   r3   r4   r5   r6   r   )r   r)   rS   rT   r   r   r   r&   �   s   ÿÿz&SourceDistribution._raise_missing_reqsN)r   r   )r   r   )r   r
   r   r   r   r   r   r   )r   r
   r   r   )r   r7   )rG   rH   rI   rJ   r   r   )r)   rU   r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úpropertyr   r   r*   r   r?   rA   r!   r%   r&   r   r   r   r   r      s    


&




r   )Ú
__future__r   ÚloggingÚcollections.abcr   Útypingr   Úpip._internal.build_envr   Ú pip._internal.distributions.baser   Úpip._internal.exceptionsr   Úpip._internal.metadatar   Úpip._internal.utils.subprocessr	   r
   Ú	getLoggerrV   r1   r   r   r   r   r   Ú<module>   s    
