
0c@_                 @   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
 r d  d l m Z m Z d  d l m Z d  d	 l m Z e  j e  Z Gd
 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)	SourceDistributionzRepresents 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  j   S)N)reqget_dist)self r   @/tmp/pip-build-jynh7p1z/pip/pip/_internal/distributions/sdist.pyget_pkg_resources_distribution   s    z1SourceDistribution.get_pkg_resources_distributionc             C   sC   |  j  j   |  j  j o | } | r2 |  j |  |  j  j   d  S)N)r   Zload_pyproject_tomlZ
use_pep517_setup_isolationZprepare_metadata)r   finderZbuild_isolationZshould_isolater   r   r   prepare_distribution_metadata   s
    z0SourceDistribution.prepare_distribution_metadatac                s     f d d   }  j  j } | d  k	 s3 t  t    j  _  j  j j | | d d   j  j j  j  j  \   }   r | d    | r t j	 d  j   t j	 d d j
 t t t |      j  j R t d	  }  j  j } | d  k	 s
t  | j |   | j   } Wd  QRXWd  QRX j  j j |  \   }   rb| d
     j  j j | | d d  d  S)Nc          
      sS   d } | j  d  j d |  d d j d d   t    D   } t |   d  S)NzZSome build dependencies for {requirement} conflict with {conflicting_with}: {description}.requirementconflicting_withdescriptionz, c             s   s'   |  ] \ } } d  j  | |  Vq d S)z{} is incompatible with {}N)format).0	installedZwantedr   r   r   	<genexpr>6   s   zPSourceDistribution._setup_isolation.<locals>._raise_conflicts.<locals>.<genexpr>)r   r   joinsortedr   )r   Zconflicting_reqsformat_stringerror_message)conflictingr   r   r   _raise_conflicts,   s    			z=SourceDistribution._setup_isolation.<locals>._raise_conflictsZ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 dependenciesZnormalzInstalling backend dependencies)r   pyproject_requiresAssertionErrorr   Z	build_envZinstall_requirementsZcheck_requirementsZrequirements_to_checkloggerwarningr   mapreprr   r   Zpep517_backendZsubprocess_runnerZget_requires_for_build_wheel)r   r   r!   r"   missingZrunnerbackendreqsr   )r    r   r   r   *   s@    	
		z#SourceDistribution._setup_isolationN)__name__
__module____qualname____doc__r   r   r   r   r   r   r   r      s   r   )loggingZpip._internal.build_envr   Z pip._internal.distributions.baser   Zpip._internal.exceptionsr   Zpip._internal.utils.subprocessr   Zpip._internal.utils.typingr   Ztypingr   r   Zpip._vendor.pkg_resourcesr	   Z"pip._internal.index.package_finderr
   	getLoggerr+   r$   r   r   r   r   r   <module>   s   