
    鴀jg                        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dS )    )annotationsN)Iterable)nullcontext)TYPE_CHECKING)BuildIsolationModeNoOpBuildEnvironmentVenvBuildEnvironmentVirtualBuildEnvironment)AbstractDistribution)InstallationError)BaseDistribution)runner_with_spinner_message)BuildEnvironmentInstallerc                  r    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dS )(SourceDistributionzRepresents a source distribution.

    The preparation step for these needs metadata for the packages to be
    generated.
    return
str | Nonec                @    | j         j        sJ | j         j        j        S )z/Identify this requirement uniquely by its link.)reqlinkurl_without_fragmentselfs    k/workspace/show-city-briefing-agent/.venv/lib/python3.11/site-packages/pip/_internal/distributions/sdist.pybuild_tracker_idz#SourceDistribution.build_tracker_id    s!     x}x}11    r   c                4    | j                                         S )N)r   get_distr   s    r   get_metadata_distributionz,SourceDistribution.get_metadata_distribution&   s    x  """r   build_env_installerr   build_isolationr   check_build_depsboolallow_editablesNonec                *   | j                                          |                     ||           |dk    rG|                     |           | j                                          |                     |||           n| j                                          |ra| j         j        }|J | j         j                            |          \  }}|r| 	                    d|           |r| 
                    |           | j                             |           d S )Noff)r$   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   r    r!   r"   r$   r.   conflictingmissings           r   prepare_distribution_metadataz0SourceDistribution.prepare_distribution_metadata)   sB    	$$&&&1DEEE e## ''888
 H**,,,$$#_o %     H**,,, 		2!%!<%111#'8#5#H#H"$ $ K  O%%&@+NNN 2((111!!/22222r   c                    |dk    rt          |          | j        _        n|dk    rt          |          | j        _        | j                            | j        j        j                   d S )Nvirtualvenv)r
   r   r/   r	   configure_backendpython_executable)r   r!   r    s      r   r*   z%SourceDistribution._prepare_build_envS   sg    
 i''!89L!M!MDH&&!56I!J!JDH""48#5#GHHHHHr   c                   | j         j        }|J t          | j         j        t                    rJ |dk    r| j         j        nt                      }|5  | j         j                            |dd| j                    d d d            n# 1 swxY w Y   | j         j                            | j         j                  \  }}|r| 	                    d|           |rpt                              d| j                    t                              dd                    t          t          t          |                                         d S d S )	Nr9   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_requirementsr0   requirements_to_checkr1   loggerwarningjoinmapreprsorted)r   r!   r.   contextr4   r5   s         r   r+   z)SourceDistribution._prepare_build_backend_   s   !X8!---dh02FGGGGG(76(A(A$($${}} 	 	H33")	 4   	 	 	 	 	 	 	 	 	 	 	 	 	 	 	  $x1DDH* 
  
W  	U!!"FTTT 		NNF   NNASvg7788    		 		s   )B		BBIterable[str]c                *   | j         j        5  t          d          }| j         j        }|J |                    |          5  |                                cd d d            cd d d            S # 1 swxY w Y   	 d d d            d S # 1 swxY w Y   d S )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:   X 	> 	>01VWWFh-G&&&**622 > >;;==> > > > > > >		> 	> 	> 	> 	> 	> 	> 	>> > > > > > > > >		> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	>5   5BA/B/A3	3B6A3	7BBBc                *   | j         j        5  t          d          }| j         j        }|J |                    |          5  |                                cd d d            cd d d            S # 1 swxY w Y   	 d d d            d S # 1 swxY w Y   d S )Nz&Getting requirements to build editable)r   r/   r   rM   rN   get_requires_for_build_editablerP   s      r   _get_build_requires_editablez/SourceDistribution._get_build_requires_editable   sn   X 	A 	A08 F h-G&&&**622 A A>>@@A A A A A A A	A 	A 	A 	A 	A 	A 	A 	AA A A A A A A A A	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	ArT   c                   | j         j        r#|r!| j         j        r|                                 }n|                                 }| j         j                            |          \  }}|r|                     d|           |dk    r| j         j        nt                      }|5  | j         j        	                    |dd| j                    d d d            d S # 1 swxY w Y   d S )Nr(   r9   normalzbackend dependenciesr>   )
r   editablesupports_pyproject_editablerW   rS   r/   r0   r1   r   rB   )r   r    r!   r$   
build_reqsr4   r5   rJ   s           r   r-   z&SourceDistribution._install_build_reqs   s@    H	:	: 4	:
 ::<<JJ7799J#x1DDZPPW 	K!!"<kJJJ(76(A(A$($${}} 	 	H33(> 4   	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s    )CCCconflicting_withstrconflicting_reqsset[tuple[str, str]]c           
         d}|                     | j        |d                    d t          |          D                                 }t	          |          )NzZSome build dependencies for {requirement} conflict with {conflicting_with}: {description}., c              3  *   K   | ]\  }}| d | V  dS )z is incompatible with N ).0	installedwanteds      r   	<genexpr>z6SourceDistribution._raise_conflicts.<locals>.<genexpr>   sH       " "%Iv <<F<<" " " " " "r   )requirementr]   description)formatr   rF   rI   r   )r   r]   r_   format_stringerror_messages        r   r1   z#SourceDistribution._raise_conflicts   sv    ? 	 &,,-		 " ")/0@)A)A" " "   - 
 
  ...r   r5   set[str]c                    d}|                     | j        d                    t          t          t          |                                        }t          |          )NzASome build dependencies for {requirement} are missing: {missing}.rb   )ri   r5   )rk   r   rF   rG   rH   rI   r   )r   r5   rl   rm   s       r   r2   z&SourceDistribution._raise_missing_reqs   sY    O 	 &,,$))CfWoo4N4N*O*O - 
 
  ...r   N)r   r   )r   r   )
r    r   r!   r   r"   r#   r$   r#   r   r%   )r!   r   r    r   r   r%   )r!   r   r   r%   )r   rK   )r    r   r!   r   r$   r#   r   r%   )r]   r^   r_   r`   r   r%   )r5   rn   r   r%   )__name__
__module____qualname____doc__propertyr   r   r6   r*   r+   rS   rW   r-   r1   r2   rd   r   r   r   r      s          2 2 2 X2
# # # #(3 (3 (3 (3T
I 
I 
I 
I   <> > > >A A A A   4/ / / /"/ / / / / /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   	getLoggerrp   rD   r   rd   r   r   <module>r      sI   " " " " " "  $ $ $ $ $ $ " " " " " "                        B A A A A A 6 6 6 6 6 6 3 3 3 3 3 3 F F F F F F BAAAAAA		8	$	$h/ h/ h/ h/ h/- h/ h/ h/ h/ h/r   