Ë
    äØjj5  ã                   ó¦   — d dl 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 d dlmZ d dlmZ  e j$                  e«      Z G d	„ d
e	«      Zy)é    N)ÚIterableÚOptionalÚSetÚTuple)ÚBuildEnvironment)ÚAbstractDistribution)ÚInstallationError)ÚPackageFinder)ÚBaseDistribution)Úrunner_with_spinner_messagec                   óÎ   — e Zd ZdZedee   fd„«       Zdefd„Z	de
dededdfd	„Zde
ddfd
„Zdee   fd„Zdee   fd„Zde
ddfd„Zdedeeeef      ddfd„Zdee   ddfd„Zy)Ú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`.
    Úreturnc                 ór   — | j                   j                  sJ ‚| j                   j                  j                  S )z/Identify this requirement uniquely by its link.)ÚreqÚlinkÚurl_without_fragment©Úselfs    úc/opt/eval-harness/bench_task/venv/lib/python3.12/site-packages/pip/_internal/distributions/sdist.pyÚbuild_tracker_idz#SourceDistribution.build_tracker_id   s(   € ð �x‰x�}Š}Ðˆ}Ø�x‰x�}‰}×1Ñ1Ð1ó    c                 ó6   — | j                   j                  «       S )N)r   Úget_distr   s    r   Úget_metadata_distributionz,SourceDistribution.get_metadata_distribution   s   € Ø�x‰x× Ñ Ó"Ð"r   ÚfinderÚbuild_isolationÚcheck_build_depsNc                 ó&  — | j                   j                  «        | j                   j                  xr |}|r<| j                  |«       | j                   j	                  «        | j                  |«       | j                   j                  xr |}|ri| j                   j                  }|€J ‚| j                   j                  j                  |«      \  }}|r| j                  d|«       |r| j                  |«       | j                   j                  «        y )Núthe backend dependencies)r   Úload_pyproject_tomlÚ
use_pep517Ú_prepare_build_backendÚisolated_editable_sanity_checkÚ_install_build_reqsÚpyproject_requiresÚ	build_envÚcheck_requirementsÚ_raise_conflictsÚ_raise_missing_reqsÚprepare_metadata)	r   r   r   r   Úshould_isolateÚshould_check_depsr&   ÚconflictingÚmissings	            r   Úprepare_distribution_metadataz0SourceDistribution.prepare_distribution_metadata   së   € ð 	�‰×$Ñ$Ô&ð Ÿ™×,Ñ,Ò@°ˆÙð ×'Ñ'¨Ô/ð �H‰H×3Ñ3Ô5à×$Ñ$ VÔ,à ŸH™H×/Ñ/ÒDÐ4DÐÙØ!%§¡×!<Ñ!<ÐØ%Ð1Ð1Ð1Ø#'§8¡8×#5Ñ#5×#HÑ#HØ"ó$Ñ ˆK˜ñ Ø×%Ñ%Ð&@À+ÔNÙØ×(Ñ(¨Ô1Ø�‰×!Ñ!Õ#r   c                 ó  — | j                   j                  }|€J ‚t        «       | j                   _        | j                   j                  j	                  ||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 )NÚoverlayzbuild dependencies©Úkindz"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/   s        r   r#   z)SourceDistribution._prepare_build_backendE   sä   € ð "ŸX™X×8Ñ8ÐØ!Ð-Ð-Ð-ä-Ó/ˆ�‰ÔØ�‰×Ñ×/Ñ/ØÐ&¨	Ð8Lð 	0ô 	
ð  $Ÿx™x×1Ñ1×DÑDØ�H‰H×*Ñ*ó 
Ñˆ�Wñ Ø×!Ñ!Ð"FÈÔTÙÜ�N‰NØFØ—‘ôô �N‰NðAà—‘œS¤¤v¨g£Ó7Ó8õð r   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�   € Ø�X‰X×Ññ 	>Ü0Ð1VÓWˆFØ—h‘h×-Ñ-ˆ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   r>   r?   Úget_requires_for_build_editablerA   s      r   Ú_get_build_requires_editablez/SourceDistribution._get_build_requires_editableg   s�   € Ø�X‰X×Ññ 	AÜ0Ø8óˆFð —h‘h×-Ñ-ˆGØÐ&Ð&Ð&Ø×*Ñ*¨6Ó2ñ AØ×>Ñ>Ó@÷Að A÷	Añ 	A÷Að Aúð A÷	A÷ 	Añ 	AúrE   c                 óœ  — | j                   j                  rA| j                   j                  r+| j                   j                  «       r| j	                  «       }n| j                  «       }| j                   j                  j                  |«      \  }}|r| j                  d|«       | j                   j                  j                  ||dd¬«       y )Nr    Únormalzbackend dependenciesr3   )
r   ÚeditableÚpermit_editable_wheelsÚsupports_pyproject_editablerH   rD   r'   r(   r)   r5   )r   r   Ú
build_reqsr.   r/   s        r   r%   z&SourceDistribution._install_build_reqsq   s¤   € ð
 �H‰H×ÒØ—‘×/Ò/Ø—‘×4Ñ4Ô6à×:Ñ:Ó<‰Jà×7Ñ7Ó9ˆJØ#Ÿx™x×1Ñ1×DÑDÀZÓPÑˆ�WÙØ×!Ñ!Ð"<¸kÔJØ�‰×Ñ×/Ñ/Ø�G˜XÐ,Bð 	0õ 	
r   Úconflicting_withÚconflicting_reqsc           
      ó–   — 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(   è ø€ ò "á%�I˜vð �+Ð3°F°8Ô<ñ"ùs   ‚)ÚrequirementrO   Údescription)Úformatr   r9   r<   r	   )r   rO   rP   Úformat_stringÚerror_messages        r   r)   z#SourceDistribution._raise_conflicts„   sY   € ð?ð 	ð &×,Ñ,ØŸ™Ø-ØŸ	™	ñ "ä)/Ð0@Ó)Aô"ó ð -ó 
ˆô   Ó.Ð.r   r/   c                 ó¢   — d}|j                  | j                  dj                  t        t        t        |«      «      «      ¬«      }t        |«      ‚)NzASome build dependencies for {requirement} are missing: {missing}.rR   )rY   r/   )r[   r   r9   r:   r;   r<   r	   )r   r/   r\   r]   s       r   r*   z&SourceDistribution._raise_missing_reqs•   sK   € àOð 	ð &×,Ñ,ØŸ™¨$¯)©)´C¼¼fÀW»oÓ4NÓ*Oð -ó 
ˆô   Ó.Ð.r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úpropertyr   Ústrr   r   r   r
   Úboolr0   r#   r   rD   rH   r%   r   r   r)   r*   rT   r   r   r   r      sè   „ ñð ð2 (¨3¡-ò 2ó ð2ð
#Ð+;ó #ð%$àð%$ð ð%$ð ð	%$ð
 
ó%$ðN¨]ð ¸tó ð4>¨8°C©=ó >ðA¨h°s©mó Að
¨-ð 
¸Dó 
ð&/Ø #ð/Ø7:¸5ÀÀcÀ¹?Ñ7Kð/à	ó/ð"/¨3¨s©8ð /¸ô /r   r   )ÚloggingÚtypingr   r   r   r   Úpip._internal.build_envr   Ú pip._internal.distributions.baser   Úpip._internal.exceptionsr	   Ú"pip._internal.index.package_finderr
   Úpip._internal.metadatar   Úpip._internal.utils.subprocessr   Ú	getLoggerr_   r7   r   rT   r   r   ú<module>ro      sA   ðÛ ß 1Ó 1å 4Ý AÝ 6Ý <Ý 3Ý Fà	ˆ×	Ñ	˜8Ó	$€ôN/Ð-õ N/r   