U
    «ÃT_ö  ã                   @   sŽ   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
 e
rpd dlmZmZ d dlmZ d d	lmZ e  e¡ZG d
d„ deƒZdS )é    N)ÚBuildEnvironment)ÚAbstractDistribution)ÚInstallationError)Úrunner_with_spinner_message)ÚMYPY_CHECK_RUNNING)ÚSetÚTuple)ÚDistribution)ÚPackageFinderc                   @   s(   e Zd ZdZdd„ Zdd„ Zdd„ ZdS )	ÚSourceDistributionz½Represents a source distribution.

    The preparation step for these needs metadata for the packages to be
    generated, either using PEP 517 or using the legacy `setup.py egg_info`.
    c                 C   s
   | j  ¡ S ©N)ÚreqÚget_dist)Úself© r   úE/tmp/pip-unpacked-wheel-8u7dkzi1/pip/_internal/distributions/sdist.pyÚget_pkg_resources_distribution   s    z1SourceDistribution.get_pkg_resources_distributionc                 C   s2   | j  ¡  | j jo|}|r$|  |¡ | j  ¡  d S r   )r   Úload_pyproject_tomlÚ
use_pep517Ú_setup_isolationÚprepare_metadata)r   ÚfinderÚbuild_isolationÚshould_isolater   r   r   Úprepare_distribution_metadata   s
    

z0SourceDistribution.prepare_distribution_metadatac              
      s  ‡ ‡fdd„}ˆj j}|d k	s"t‚tƒ ˆj _ˆj j ||dd¡ ˆj j ˆj j¡\‰ }ˆ rd|dˆ ƒ |r’t 	dˆj ¡ t 	dd 
ttt|ƒƒ¡¡ ˆj j�@ td	ƒ}ˆj j}|d k	s¸t‚| |¡� | ¡ }W 5 Q R X W 5 Q R X ˆj j |¡\‰ }ˆ �r|d
ˆ ƒ ˆj j ||dd¡ d S )Nc                    s6   d}|j ˆj| d dd„ tˆ ƒD ƒ¡d�}t|ƒ‚d S )NzZSome build dependencies for {requirement} conflict with {conflicting_with}: {description}.z, c                 s   s   | ]\}}d   ||¡V  qdS )z{} is incompatible with {}N)Úformat)Ú.0Ú	installedÚwantedr   r   r   Ú	<genexpr>5   s   ÿzPSourceDistribution._setup_isolation.<locals>._raise_conflicts.<locals>.<genexpr>)ÚrequirementÚconflicting_withÚdescription)r   r   ÚjoinÚsortedr   )r!   Úconflicting_reqsÚformat_stringÚerror_message©Úconflictingr   r   r   Ú_raise_conflicts,   s    ÿ
þýz=SourceDistribution._setup_isolation.<locals>._raise_conflictsÚoverlayzInstalling build dependenciesz"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 z#Getting requirements to build wheelzthe backend dependenciesÚnormalzInstalling backend dependencies)r   Úpyproject_requiresÚAssertionErrorr   Ú	build_envÚinstall_requirementsÚcheck_requirementsÚrequirements_to_checkÚloggerÚwarningr#   ÚmapÚreprr$   r   Úpep517_backendÚsubprocess_runnerÚget_requires_for_build_wheel)r   r   r*   r-   ÚmissingÚrunnerÚbackendÚreqsr   r(   r   r   *   sV    
  þÿÿþý
ÿ
  þz#SourceDistribution._setup_isolationN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r   r      s   r   )ÚloggingÚpip._internal.build_envr   Ú pip._internal.distributions.baser   Úpip._internal.exceptionsr   Úpip._internal.utils.subprocessr   Úpip._internal.utils.typingr   Útypingr   r   Zpip._vendor.pkg_resourcesr	   Ú"pip._internal.index.package_finderr
   Ú	getLoggerr>   r3   r   r   r   r   r   Ú<module>   s   
