HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.7/site-packages/pip/_internal/operations/__pycache__/prepare.cpython-37.pyc
B

L��g�m�	@sZdZddlZddlZddlZddlmZddlmZmZm	Z	m
Z
ddlmZddl
mZddlmZddlmZmZmZmZmZmZmZdd	lmZdd
lmZmZddlmZddl m!Z!dd
l"m#Z#ddl$m%Z%m&Z&ddl'm(Z(m)Z)ddl*m+Z+ddl,m-Z-ddl.m/Z/ddl0m1Z1ddl2m3Z3m4Z4ddl5m6Z6m7Z7ddl8m9Z9ddl:m;Z;m<Z<m=Z=m>Z>ddl?m@Z@ddlAmBZBddlCmDZDe1eE�ZFe/e-eeGeGed�dd�ZHe!eIeJdd�dd �ZKGd!d"�d"�ZLd2e!e&e
eIe
e6eLd#�d$d%�ZMd3e!e
eIe
e6eLd&�d'd(�ZNd4e!eIe&eJe
eIe
e6e
eLd)�d*d+�ZOd5e!eIe
e6eGe
eId-�d.d/�ZPGd0d1�d1�ZQdS)6z)Prepares a distribution for installation
�N)�Path)�Dict�Iterable�List�Optional)�canonicalize_name)�)make_distribution_for_install_requirement)�InstalledDistribution)�DirectoryUrlHashUnsupported�HashMismatch�HashUnpinned�InstallationError�MetadataInconsistent�NetworkConnectionError�VcsHashUnsupported)�
PackageFinder)�BaseDistribution�get_metadata_distribution)�ArchiveInfo)�Link)�Wheel)�BatchDownloader�
Downloader)�HTTPRangeRequestUnsupported�dist_from_wheel_url)�
PipSession)�BuildTracker)�InstallRequirement)�	getLogger)�direct_url_for_editable�direct_url_from_link)�Hashes�
MissingHashes)�
indent_log)�display_path�	hash_file�hide_url�redact_auth_from_requirement)�
TempDirectory)�unpack_file)�vcs)�req�
build_tracker�finder�build_isolation�check_build_deps�returnc	CsDt|�}|j}|dk	r<|�||��|�|||�WdQRX|��S)z(Prepare a distribution for installation.N)rZbuild_tracker_id�track�prepare_distribution_metadatar)r+r,r-r.r/�
abstract_distZ
tracker_id�r4�D/tmp/pip-unpacked-wheel-hv55ucu3/pip/_internal/operations/prepare.py�_get_prepared_distribution;sr6)�link�location�	verbosityr0cCs2t�|j�}|dk	st�|j|t|j�|d�dS)N)�urlr9)r*�get_backend_for_scheme�scheme�AssertionError�unpackr&r:)r7r8r9�vcs_backendr4r4r5�unpack_vcs_linkMsr@c@s"eZdZeeedd�dd�ZdS)�FileN)�path�content_typer0cCs*||_|dkr t�|�d|_n||_dS)Nr)rB�	mimetypes�
guess_typerC)�selfrBrCr4r4r5�__init__Tsz
File.__init__)�__name__�
__module__�__qualname__�strrrGr4r4r4r5rASsrA)r7�download�download_dir�hashesr0cCsVtddd�}d}|r t|||�}|r.|}d}n|||j�\}}|rL|�|�t||�S)Nr>T)�kind�globally_managed)r(�_check_download_dirrB�check_against_pathrA)r7rLrMrN�temp_dir�already_downloaded_path�	from_pathrCr4r4r5�get_http_url\s
rV)r7rMrNr0cCs<d}|rt|||�}|r|}n|j}|r2|�|�t|d�S)z'Get file and optionally check its hash.N)rQ�	file_pathrRrA)r7rMrNrTrUr4r4r5�get_file_urlts
rX)r7r8rLr9rMrNr0cCsd|jrt|||d�dS|��r$t�|jr:t|||d�}nt||||d�}|js`t|j	||j
�|S)a_Unpack link into location, downloading if required.

    :param hashes: A Hashes object, one of whose embedded hashes must match,
        or HashMismatch will be raised. If the Hashes is empty, no matches are
        required, and unhashable types of requirements (like VCS ones, which
        would ordinarily raise HashUnsupported) are allowed.
    )r9N)rN)�is_vcsr@�is_existing_dirr=�is_filerXrV�is_wheelr)rBrC)r7r8rLr9rMrN�filer4r4r5�
unpack_url�sr^T)r7rMrN�warn_on_hash_mismatchr0cCsrtj�||j�}tj�|�s dSt�d|�|rny|�|�Wn.tk
rl|r^t�	d|�t�
|�dSX|S)z�Check download_dir for previously downloaded file with correct hash
    If a correct file is found return its path else None
    NzFile was already downloaded %sz;Previously-downloaded file %s has bad hash. Re-downloading.)�osrB�join�filename�exists�logger�inforRr�warning�unlink)r7rMrNr_�
download_pathr4r4r5rQ�s	
rQcs<eZdZdZeeeeeeeeee	eeee
edd��fdd�Zedd�dd�Z
eedd	�d
d�Zeed�dd
�Zeeed�dd�Zeeed�dd�Zeeed�dd�Zd'eeedd�dd�Zd(eeed	�dd�Zd)eeedd�dd�Zeeed	�dd�Zedd�d d!�Zeed�d"d#�Zeeed$�d%d&�Z�ZS)*�RequirementPreparerzPrepares a RequirementN)�	build_dirrM�src_dirr.r/r,�session�progress_barr-�require_hashes�
use_user_site�
lazy_wheelr9�legacy_resolverr0cs�t���||_||_||_||_t||�|_t||�|_	|	|_
||_||_||_
|
|_||_||_|
|_||_i|_d|_dS)N)�rr)�superrGrkrjr,�_sessionr�	_downloadr�_batch_downloadr-rMr.r/rnro�use_lazy_wheelr9rq�_downloaded�_previous_requirement_header)rFrjrMrkr.r/r,rlrmr-rnrorpr9rq)�	__class__r4r5rG�s$
zRequirementPreparer.__init__)r+r0c	Cs�|jjr$|js$d}tt|jj��}nd}|jr8t|j�nt|�}|jr~|jr~t	|jt�r`|j}n
|j�
�}|r~|d|�d�7}||f|jkr�||f|_t�
||�|jr�t��t�
d|jj�WdQRXdS)z3Provide context for the requirement being prepared.z
Processing %sz
Collecting %sz (from �)zUsing cached %sN)r7r[�is_wheel_from_cacherKr$rWr+r'�
comes_from�
isinstancerUryrdrer#rb)rFr+�messageZinformationr}r4r4r5�_log_preparing_links"

z'RequirementPreparer._log_preparing_link)r+�parallel_buildsr0cCsP|jjrdS|jdkst�|j��r2|jj|_dS|j|jd|d�|��dS)z1Ensure source_dir of a linked InstallRequirement.NT)�
autodeleter�)	r7r\�
source_dirr=rZrW�ensure_has_source_dirrjZensure_pristine_source_checkout)rFr+r�r4r4r5�_ensure_link_req_src_dir-s

z,RequirementPreparer._ensure_link_req_src_dircCsT|js|jdd�S|jjr t��|j��r0t��|jsB|jsBt	��|jdd�pRt
�S)NT)�trust_internetF)rnrNr7rYrrZr
�	is_direct�	is_pinnedrr")rFr+r4r4r5�_get_linked_req_hashesDs
z*RequirementPreparer._get_linked_req_hashescCs>|jrt�d�dS|jr(t�d�dS|�|�p<|�|j�S)Nz9Metadata-only fetching is not used in the legacy resolverz?Metadata-only fetching is not used as hash checking is required)rqrd�debugrn�$_fetch_metadata_using_link_data_attr� _fetch_metadata_using_lazy_wheelr7)rFr+r4r4r5�_fetch_metadata_onlydsz(RequirementPreparer._fetch_metadata_onlyc	Cs�|j��}|dkrdS|jdk	s$t�t�d|j|�t||j|��d�}t	|j
d��}|��}WdQRXt||jj
|jj�}t|j�t|jj�kr�t|d|jj|j��|S)zGFetch metadata from the data-dist-info-metadata attribute, if possible.Nz/Obtaining dependency information for %s from %s)rN�rb�Name)r7�
metadata_linkr+r=rd�verboserVruZ	as_hashes�openrB�readrrb�namerZraw_namer)rFr+r�Z
metadata_file�fZmetadata_contents�
metadata_distr4r4r5r�ws,

z8RequirementPreparer._fetch_metadata_using_link_data_attr)r7r0cCs�|js
dS|js|js&t�d|�dSt|j�}t|j�}t�	d||j
�|j�dd�d}yt
|||j�Stk
r�t�d|�dSXdS)z-Fetch metadata using lazy wheel, if possible.Nz=Lazy wheel is not used as %r does not point to a remote wheelz+Obtaining dependency information from %s %s�#�rz"%s does not support range requests)rwr[r\rdr�rrbrr�re�versionr:�splitrrtr)rFr7�wheelr�r:r4r4r5r��s&

z4RequirementPreparer._fetch_metadata_using_lazy_wheelF)�partially_downloaded_reqsr�r0c
Cs�tddd�j}i}x |D]}|js&t�|||j<qW|�|��|�}xR|D]J\}\}}	t�d||�||}||_||j	|jj
<|jsJ|�t
|��qJWx|D]}|�||�q�WdS)z>Download any requirements which were only fetched by metadata.r>T)rOrPzDownloading link %s to %sN)r(rBr7r=rv�keysrdr��local_file_pathrxr:r\Zneeds_unpacked_archiver�_prepare_linked_requirement)
rFr�r�rSZlinks_to_fully_downloadr+Zbatch_downloadr7�filepath�_r4r4r5�_complete_partial_requirements�s"


z2RequirementPreparer._complete_partial_requirementsc	Cs�|js
t�|�|�t��zd}|jdk	rT|jjrT|�|�}t|j|j||jd�}|dk	rl||j	|jj
<n|�|�}|dk	r�d|_|S|�
||�SQRXdS)z3Prepare a requirement to be obtained from req.link.N)r_T)r7r=r�r#rMr\r�rQr|rxr:r��needs_more_preparationr�)rFr+r�rWrNr�r4r4r5�prepare_linked_requirement�s$



z.RequirementPreparer.prepare_linked_requirement)�reqsr�r0cCs�dd�|D�}xT|D]L}|jdk	r|jjr|�|�}t|j|j|�}|dk	r||j|jj<d|_qWg}x*|D]"}|jr�|�|�qn|�	||�qnW|j
||d�dS)z,Prepare linked requirements more, if needed.cSsg|]}|jr|�qSr4)r�)�.0r+r4r4r5�
<listcomp>szHRequirementPreparer.prepare_linked_requirements_more.<locals>.<listcomp>NF)r�)rMr7r\r�rQrxr:r��appendr�r�)rFr�r�r+rNrWr�r4r4r5� prepare_linked_requirements_mores 



z4RequirementPreparer.prepare_linked_requirements_morec

Cs�|js
t�|j}|�|�}|r�|jr�|jdk	s2t�|js<t�|jsFt�t|jjt	�rt|jjj
rt|�|jjj
�rtd}nt�
d�|j|_|j}|�||�|��r�d}n�|j|jk�ryt||j|j|j|j|�}Wn>tk
�r}ztd|�d|�d|����Wdd}~XYnXn(|j|j}|�r0|�|�t|dd�}|jdk�r�|j�rTt�t||j�|_t|jjt	��r�|jjj
�s�|�r�t|j�d� �}d|��|jj_!|�r�|j|_"t#||j$|j%|j&|j'�}	|	S)NzyThe hashes of the source archive found in cache entry don't match, ignoring cached built wheel and re-downloading source.zCould not install requirement z because of HTTP error z	 for URL )rCrzsha256=)(r7r=r�r|�
download_infor\r[r~rerrNZ
has_one_ofrdrfZcached_wheel_source_linkr�rZr:rxr^r�rur9rMrr
rRrA�editabler r%rB�	hexdigest�hashr�r6r,r-r.r/)
rFr+r�r7rN�
local_file�excrWr��distr4r4r5r�-sf






,
z/RequirementPreparer._prepare_linked_requirementcCs�|jdk	st�|jdk	st�|j}|js6|��rF|jrF|�|j�dS|��r^t�d|�dS|j	dkrldSt
j�|j|j
�}t
j�|�s�t�|j	|�t|�}t�d|�dS)NzENot copying link to destination directory since it is a directory: %szSaved %s)rMr=r7rYrZr��archiverdr�r�r`rBrarbrc�shutil�copyr$re)rFr+r7�download_locationrhr4r4r5�save_linked_requirement�s$
z+RequirementPreparer.save_linked_requirementc	Cs�|jstd��t�d|�t��j|jr8td|�d���|�|j�|�	�|j
sVt�t|j�|_
t||j|j|j|j�}|�|j�WdQRX|S)z Prepare an editable requirement.z-cannot prepare a non-editable req as editablezObtaining %szThe editable requirement zT cannot be installed when requiring hashes, because there is no single file to hash.N)r�r=rdrer#rnr
r�rk�update_editabler�r�unpacked_source_directoryr�r6r,r-r.r/�check_if_existsro)rFr+r�r4r4r5�prepare_editable_requirement�s$
z0RequirementPreparer.prepare_editable_requirement)r+�skip_reasonr0c	Csh|jstd��|dk	s&td|j����t�d|||jj�t��|jrRt�d�t|��	�SQRXdS)z)Prepare an already-installed requirement.z(req should have been satisfied but isn'tNz?did not get skip reason skipped but req.satisfied_by is set to zRequirement %s: %s (%s)z�Since it is already installed, we are trusting this package without checking its hash. To ensure a completely repeatable environment, install into an empty virtualenv.)
�satisfied_byr=rdrer�r#rnr�r	r)rFr+r�r4r4r5�prepare_installed_requirement�s
z1RequirementPreparer.prepare_installed_requirement)F)F)F)rHrIrJ�__doc__rKr�boolrrr�intrGrr�r�r!r�rr�r�rr�rr�r�r�r�r�r�r��
__classcell__r4r4)rzr5ri�sP*"(
)%
Z ri)NN)NN)NN)T)Rr�rDr`r��pathlibr�typingrrrr�pip._vendor.packaging.utilsr�pip._internal.distributionsr�%pip._internal.distributions.installedr	�pip._internal.exceptionsr
rrr
rrr�"pip._internal.index.package_finderrZpip._internal.metadatarr�pip._internal.models.direct_urlr�pip._internal.models.linkr�pip._internal.models.wheelr�pip._internal.network.downloadrrZ pip._internal.network.lazy_wheelrr�pip._internal.network.sessionrZ,pip._internal.operations.build.build_trackerrZpip._internal.req.req_installrZpip._internal.utils._logr�&pip._internal.utils.direct_url_helpersrr �pip._internal.utils.hashesr!r"�pip._internal.utils.loggingr#�pip._internal.utils.miscr$r%r&r'�pip._internal.utils.temp_dirr(�pip._internal.utils.unpackingr)�pip._internal.vcsr*rHrdr�r6rKr�r@rArVrXr^rQrir4r4r4r5�<module>s^$	(