
    <wjg                        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
mZmZ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j.                  e      Z G d de      Zy)    )annotationsN)Iterable)nullcontext)TYPE_CHECKING)BuildIsolationModeNoOpBuildEnvironmentVenvBuildEnvironmentVirtualBuildEnvironment)AbstractDistribution)InstallationError)BaseDistribution)runner_with_spinner_message)BuildEnvironmentInstallerc                      e Zd ZdZedd       ZddZ	 	 	 	 	 	 	 	 	 	 ddZ	 	 	 	 	 	 ddZddZ	ddZ
ddZ	 	 	 	 	 	 	 	 dd	Z	 	 	 	 	 	 dd
ZddZy)SourceDistributionzRepresents a source distribution.

    The preparation step for these needs metadata for the packages to be
    generated.
    c                r    | j                   j                  sJ | j                   j                  j                  S )z/Identify this requirement uniquely by its link.)reqlinkurl_without_fragmentselfs    _/root/dashboard-youtube/.venv/lib/python3.12/site-packages/pip/_internal/distributions/sdist.pybuild_tracker_idz#SourceDistribution.build_tracker_id    s(     xx}}}xx}}111    c                6    | j                   j                         S )N)r   get_distr   s    r   get_metadata_distributionz,SourceDistribution.get_metadata_distribution&   s    xx  ""r   c                &   | j                   j                          | j                  ||       |dk7  r@| j                  |       | j                   j	                          | j                  |||       n| j                   j	                          |ri| j                   j                  }|J | j                   j                  j                  |      \  }}|r| j                  d|       |r| j                  |       | j                   j                  |       y )Noff)allow_editablesthe backend dependencies)r   load_pyproject_toml_prepare_build_env_prepare_build_backendeditable_sanity_check_install_build_reqspyproject_requires	build_envcheck_requirements_raise_conflicts_raise_missing_reqsprepare_metadata)r   build_env_installerbuild_isolationcheck_build_depsr    r'   conflictingmissings           r   prepare_distribution_metadataz0SourceDistribution.prepare_distribution_metadata)   s     	$$&1DE e# ''8
 HH**,$$#_o %  HH**,!%!<!<%111#'88#5#5#H#H"$ K %%&@+N((1!!/2r   c                    |dk(  rt        |      | j                  _        n|dk(  rt        |      | j                  _        | j                  j	                  | j                  j                  j
                         y )Nvirtualvenv)r
   r   r(   r	   configure_backendpython_executable)r   r.   r-   s      r   r#   z%SourceDistribution._prepare_build_envS   sZ    
 i'!89L!MDHH&!56I!JDHH""488#5#5#G#GHr   c                   | j                   j                  }|J t        | j                   j                  t              rJ |dk(  r| j                   j                  n	t               }|5  | j                   j                  j                  |dd| j                          d d d        | j                   j                  j                  | j                   j                        \  }}|r| j                  d|       |r]t        j                  d| j                          t        j                  ddj                  t        t        t        |                         y y # 1 sw Y   xY w)	Nr5   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'   
isinstancer(   r   r   install_requirementsr)   requirements_to_checkr*   loggerwarningjoinmapreprsorted)r   r.   r'   contextr0   r1   s         r   r$   z)SourceDistribution._prepare_build_backend_   s%   !XX88!---dhh002FGGG(76(A$(($${} 	HH33")	 4 	  $xx11DDHH** 
W !!"FTNNF NNASvg78 	 	s   (4EEc                &   | j                   j                  5  t        d      }| j                   j                  }|J |j	                  |      5  |j                         cd d d        cd d d        S # 1 sw Y   nxY w	 d d d        y # 1 sw Y   y xY w)Nz#Getting requirements to build wheel)r   r(   r   pep517_backendsubprocess_runnerget_requires_for_build_wheelr   runnerbackends      r   _get_build_requires_wheelz,SourceDistribution._get_build_requires_wheel}   s    XX 	>01VWFhh--G&&&**62 >;;=> >		> 	>> > >		> 	> 	>#   7BA1	B1A:	6BBc                &   | j                   j                  5  t        d      }| j                   j                  }|J |j	                  |      5  |j                         cd d d        cd d d        S # 1 sw Y   nxY w	 d d d        y # 1 sw Y   y xY w)Nz&Getting requirements to build editable)r   r(   r   rH   rI   get_requires_for_build_editablerK   s      r   _get_build_requires_editablez/SourceDistribution._get_build_requires_editable   s    XX 	A08F hh--G&&&**62 A>>@A A	A 	AA A A	A 	A 	ArO   c                   | j                   j                  r)|r'| j                   j                  r| j                         }n| j	                         }| j                   j
                  j                  |      \  }}|r| j                  d|       |dk(  r| j                   j
                  n	t               }|5  | j                   j
                  j                  |dd| j                          d d d        y # 1 sw Y   y xY w)Nr!   r5   normalzbackend dependenciesr:   )
r   editablesupports_pyproject_editablerR   rN   r(   r)   r*   r   r>   )r   r-   r.   r    
build_reqsr0   r1   rF   s           r   r&   z&SourceDistribution._install_build_reqs   s     HH44::<J779J#xx11DDZPW!!"<kJ(76(A$(($${} 	HH33(> 4 	 	 	s   34C00C9c           
         d}|j                  | j                  |dj                  d t        |      D                    }t	        |      )NzZSome build dependencies for {requirement} conflict with {conflicting_with}: {description}., c              3  0   K   | ]  \  }}| d |   yw)z is incompatible with N ).0	installedwanteds      r   	<genexpr>z6SourceDistribution._raise_conflicts.<locals>.<genexpr>   s(      "%Iv +3F8<"s   )requirementconflicting_withdescription)formatr   rB   rE   r   )r   ra   conflicting_reqsformat_stringerror_messages        r   r*   z#SourceDistribution._raise_conflicts   sY    ? 	 &,,-		 ")/0@)A"  - 
  ..r   c                    d}|j                  | j                  dj                  t        t        t        |                        }t        |      )NzASome build dependencies for {requirement} are missing: {missing}.rY   )r`   r1   )rc   r   rB   rC   rD   rE   r   )r   r1   re   rf   s       r   r+   z&SourceDistribution._raise_missing_reqs   sK    O 	 &,,$))CfWo4N*O - 
  ..r   N)returnz
str | None)rh   r   )
r-   r   r.   r   r/   boolr    ri   rh   None)r.   r   r-   r   rh   rj   )r.   r   rh   rj   )rh   zIterable[str])r-   r   r.   r   r    ri   rh   rj   )ra   strrd   zset[tuple[str, str]]rh   rj   )r1   zset[str]rh   rj   )__name__
__module____qualname____doc__propertyr   r   r2   r#   r$   rN   rR   r&   r*   r+   r[   r   r   r   r      s     2 2
#(36(3 ,(3 	(3
 (3 
(3T
I+
I 7
I 
	
I<>A6 , 	
 
4/ #/7K/	/"/r   r   )
__future__r   loggingcollections.abcr   
contextlibr   typingr   pip._internal.build_envr   r   r	   r
    pip._internal.distributions.baser   pip._internal.exceptionsr   pip._internal.metadatar   pip._internal.utils.subprocessr   r   	getLoggerrl   r@   r   r[   r   r   <module>r|      sT    "  $ "    B 6 3 FA			8	$h/- h/r   