R|1үTdZddlmZddlZddlZddlZddlmZddlm Z ddl m Z ddl m Z ddlmZdd lmZdd lmZdd lmZdd lmZmZmZmZmZmZmZdd lmZddl m!Z!m"Z"ddl#m$Z$ddl%m&Z&ddl'm(Z(ddl)m*Z*ddl+m,Z,m-Z-ddl.m/Z/ddl0m1Z1ddl2m3Z3ddl4m5Z5ddl6m7Z7m8Z8ddl9m:Z:m;Z;ddlm?Z?m@Z@mAZAmBZBddlCmDZDddlEmFZFddlGmHZHe rddlImJZJe5eKZLdEd+ZMdFd3ZNe Gd4d5ZO dGdHd<ZP dGdId=ZQ dGdJd?ZR dKdLdBZSGdCdDZTdS)Mz(Prepares a distribution for installation) annotationsN)Iterable) dataclass)Path) TYPE_CHECKING)canonicalize_name)BuildEnvironmentInstaller))make_distribution_for_install_requirement)InstalledDistribution)DirectoryUrlHashUnsupported HashMismatch HashUnpinnedInstallationErrorMetadataInconsistentNetworkConnectionErrorVcsHashUnsupported) PackageFinder)BaseDistributionget_metadata_distribution) ArchiveInfo)Link)Wheel) Downloader)HTTPRangeRequestUnsupporteddist_from_wheel_url) PipSession) BuildTracker)InstallRequirement) getLogger)direct_url_for_editabledirect_url_from_link)Hashes MissingHashes) indent_log) display_path hash_filehide_urlredact_auth_from_requirement) TempDirectory) unpack_file)vcs)BarTypereqr build_trackerrbuild_env_installerr build_isolationboolcheck_build_depsreturnrct|}|j}|E|||5||||dddn #1swxYwY|S)z(Prepare a distribution for installation.N)r build_tracker_idtrackprepare_distribution_metadatar)r-r.r/r0r2 abstract_dist tracker_ids r/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib/python3.11/site-packages/pip/_internal/operations/prepare.py_get_prepared_distributionr;As>cBBM/J  j 1 1    7 7#_6F                    2 2 4 44sAAAlinkrlocationstr verbosityintNonectj|j}|J||t |j|dS)N)urlr?)r+get_backend_for_schemeschemeunpackr'rC)r<r=r? vcs_backends r:unpack_vcs_linkrHSsK,T[99K  " " "xXdh%7%79MMMMMc0eZdZUded<dZded<d dZdS) Filer>pathN str | None content_typer3rAc|j8 tj|jd|_dS#t$rYdSwxYwdS)Nr)rN mimetypes guess_typerLOSError)selfs r: __post_init__zFile.__post_init__^sZ   $ $-$8$C$CA$F!!!     % $s $/ ==)r3rA)__name__ __module__ __qualname____annotations__rNrTrIr:rKrKYsD III#L####rIrKdownloadr download_dirrMhashes Hashes | Nonectdd}d}|rt|||}|r|}d}n+|||j\}}|r||t ||S)NrFTkindglobally_managed)r)_check_download_dirrLcheck_against_pathrK)r<rZr[r\temp_diralready_downloaded_path from_pathrNs r: get_http_urlrghs (TBBBH"R"5dL&"Q"Q1+  #+(4"?"? <  1  % %i 0 0 0  < ( ((rIcd}|rt|||}|r|}n|j}|r||t|dS)z'Get file and optionally check its hash.N)rb file_pathrcrK)r<r[r\rerfs r: get_file_urlrjsi #R"5dL&"Q"Q#+ N -!!),,,  4  rI File | Nonec|jrt|||dS|rJ|jrt |||}nt ||||}|jst|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. )r?Nr\) is_vcsrHis_existing_diris_filerjrgis_wheelr*rLrN)r<r=rZr?r[r\files r: unpack_urlrss  {h)<<<<t##%%%% % |  D,v>>>        =<DIx):;;; KrITwarn_on_hash_mismatchc~tj||j}tj|sdSt d||rY ||nB#t$r5|rt d|tj |YdSwxYw|S)zCheck 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.) osrLjoinfilenameexistsloggerinforcr warningunlink)r<r[r\rt download_paths r:rbrbsGLLt}==M 7>>- ( (t KK0-@@@    % %m 4 4 4 4   $ Q! Im $ $ $44  s%A;;;B:9B:ceZdZdZd8fd Zd9d Zd:d"Zd;d$Zdd?d.Z d>d@d0Z d>dAd2Z d@d3Zd9d4ZdBd5ZdCd7ZxZS)DRequirementPreparerzPrepares a Requirement build_dirr>r[rMsrc_dirr0r1build_isolation_installerr r2r.rsessionr progress_barr,finderrrequire_hashes use_user_site lazy_wheelr?r@legacy_resolverresume_retriesr3rAcTt||_||_||_||_t || ||_| |_||_ ||_ ||_ ||_ | |_ | |_| |_||_||_i|_d|_dS)N)r)super__init__rrr._sessionr _downloadrr[r0r/r2rruse_lazy_wheelr?r _downloaded_previous_requirement_header)rSrr[rr0rr2r.rrrrrrr?rr __class__s r:rzRequirementPreparer.__init__s(  "* #G\>JJ ) /#< !1-+)# /,.-5)))rIr-rc|jjr0|js)d}tt |jj}n,d}|jrt|jnt|}|jrM|jrFt|jtr|j}n|j }|r |d|dz }||f|j kr$||f|_ t |||jrNt5t d|jjddddS#1swxYwYdSdS)z3Provide context for the requirement being prepared.z Processing %sz Collecting %sz (from )zUsing cached %sN)r<rpis_wheel_from_cacher>r%rir-r( comes_from isinstancerfrrzr{r$rx)rSr-message informationrs r:_log_preparing_linkz'RequirementPreparer._log_preparing_link!s 8  YC$; Y%Gl38+=>>??KK%GCF7X6sw???PSTWPXPXK 7 7s~ 7#.#.. 8),  ^5577  766666 [ !T%F F F18+0FD - KK - - -  " B B B -sx/@AAA B B B B B B B B B B B B B B B B B B B Bs&D66D:=D:parallel_buildsc|jjrdS|jJ|jr|jj|_dS||jd||dS)z1Ensure source_dir of a linked InstallRequirement.NT) autodeleter)r<rq source_dirroriensure_has_source_dirrensure_pristine_source_checkout)rSr-rs r:_ensure_link_req_src_dirz,RequirementPreparer._ensure_link_req_src_dir<s 8   F~%%% 8 # # % %  X/CN F !! N+ "   ++-----rIr"c>|js|dS|jjrt |jrt |js|jst|dp tS)NT)trust_internetF) rr\r<rnrror is_direct is_pinnedrr#rSr-s r:_get_linked_req_hashesz*RequirementPreparer._get_linked_req_hashesSs " 3::T:22 2 8? '$&& & 8 # # % % 0-// /} !S] !.. zzz//B=??BrIBaseDistribution | Nonec|jrtddS|jrtddS||p||jS)Nz9Metadata-only fetching is not used in the legacy resolverz?Metadata-only fetching is not used as hash checking is required)rrzdebugr$_fetch_metadata_using_link_data_attr _fetch_metadata_using_lazy_wheelr<rs r:_fetch_metadata_onlyz(RequirementPreparer._fetch_metadata_onlyss    LLK   4    LLQ   488   =  2 238 < < =rIcR|j}|dS|jJtd|j|t ||j|}t|j d5}| }dddn #1swxYwYt||jj |jj }t|jt|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 %srmrbName)r< metadata_linkr-rzverbosergr as_hashesopenrLreadrrxnamerraw_namer)rSr-r metadata_filefmetadata_contents metadata_dists r:rz8RequirementPreparer._fetch_metadata_using_link_data_attrse ..00  4w""" = G    %  N **,,   -$d + + )q !  ) ) ) ) ) ) ) ) ) ) ) ) ) ) )2  H  GL   ]3 4 48I#',8W8W W W&VSW\=+A sB''B+.B+r<rc|jsdS|js|jstd|dSt |j}|j}td||j |j ddd} t|||j S#t$rtd|YdSwxYw)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)rrprqrzrrrxrr{versionrCsplitrrr)rSr<wheelrrCs r:rz4RequirementPreparer._fetch_metadata_using_lazy_wheels " 4 < t}  LLO   4dm$$z 9  M   hnnS!$$Q' &tS$-@@ @*    LL=s C C C44 sB))%CCFpartially_downloaded_reqsIterable[InstallRequirement]ctddj}i}|D]}|jsJ|||j<|j||}|D]p\}\}} t d||||}||_||j |jj <|j s"| t|q|D]}|||dS)z>Download any requirements which were only fetched by metadata.rFTr_zDownloading link %s to %sN)r)rLr<rbatchkeysrzrlocal_file_pathrrCrqneeds_unpacked_archiver_prepare_linked_requirement) rSrrrdlinks_to_fully_downloadr-batch_downloadr<filepath_s r:_complete_partial_requirementsz2RequirementPreparer._complete_partial_requirementss&!hFFFK CE, 4 4C8OO803 #CH - ---.E.J.J.L.LhWW#1 ; ; D-8Q LL4dH E E E)$/C#+C .6D SX\ * < ;**4>>:::- C CC  , ,S/ B B B B C CrIrcP|jsJ||t5d}|jD|jjr8||}t |j|j||j }|||j|jj <ng| |}|Pd|_ | ||j t|j|j|_ |cdddS|||cdddS#1swxYwYdS)z3Prepare a requirement to be obtained from req.link.N)rtT)r<rr$r[rqrrbrrrCrneeds_more_preparationset_dist download_infor!rr)rSr-rrir\rs r:prepare_linked_requirementz.RequirementPreparer.prepare_linked_requirementsxx   %%% \\$ J$ JI ,1B,44S99/H%/2.E*E    $1: ..!% 9 9# > >  ,15C.LL///(0,@Hcn--))C$ J$ J$ J$ J$ J$ J$ J$ JH33CIII$ J$ J$ J$ J$ J$ J$ J$ J$ J$ J$ J$ J$ J$ J$ J$ J$ J$ JsB?D9DD"Dreqscd|D}|D]b}|jY|jjrM||}t |j|j|}|||j|jj<d|_cg}|D]5}|jr||| ||6| ||dS)z,Prepare linked requirements more, if needed.c g|] }|j | SrY)r).0r-s r: zHRequirementPreparer.prepare_linked_requirements_more..%s BBBs'ABBBBrINF)r) r[r<rqrrbrrCrappendrr)rSrrr-r\rirs r: prepare_linked_requirements_morez4RequirementPreparer.prepare_linked_requirements_more!sCBtBBB 7 7C ,1B,44S99/$:KVTT (5>D$SX\216C.?A! G GC) G)00555500oFFFF ++ %+ ,     rIc |jsJ|j}||}|r|jr|jJ|jsJ|jsJt |jjtr8|jjj r'| |jjj rd}n-t d|j |_|j}||||rd}n|j|jvrT t%||j|j|j|j|}nd#t.$r}t1d|d|d|d}~wwxYw|j|j}|r||t5|d}|j|jrJt9||j|_t |jjtrS|jjj sB|r@t;|jd}d||jj_ |r |j|_!tE||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 )rNrzsha256=)'r<rrrrqrprr{rr\ has_one_ofrzr|cached_wheel_source_linkrrorCrrsrrr?r[rrrcrKeditabler!r&rL hexdigesthashrr;r.r/r0r2) rSr-rr<r\ local_fileexcrirdists r:rz/RequirementPreparer._prepare_linked_requirement?sxxx,,S11  c- $000= =<  <3,1;?? %*1 %%c&7&<&CDD 1 7x %%c?;;;    ! ! <JJ XT- - - 'NNN%  *   '2S22 22+/22  (2I 5)))444id;;;J   $| # ## 4T3> J JC  3,1;?? ?).5 ? ? !11!4>>@@/?.>.>!&+  2",/C )     $   !    s (D33 E=EEcF|jJ|jJ|j}|js|r#|jr||jdS|rt d|dS|jdStj |j|j }tj |sFtj|j|t!|}t d|dSdS)NzENot copying link to destination directory since it is a directory: %szSaved %s)r[r<rnrorarchiverzrrrvrLrwrxryshutilcopyr%r{)rSr-r<download_locationr~s r:save_linked_requirementz+RequirementPreparer.save_linked_requirements' ,,,x###x ; 4//11 cl  KK) * * * F    ! !  LL.    F   & FGLL):DMJJw~~/00 3 K+-> ? ? ?():;;M KK M 2 2 2 2 2 3 3rIc|js Jdtd|t5|jrt d|d||j||j sJt|j |_ t||j|j|j|j}||jdddn #1swxYwY|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)rrzr{r$rrrrupdate_editablerr unpacked_source_directoryrr;r.r/r0r2check_if_existsr)rSr-rs r:prepare_editable_requirementz0RequirementPreparer.prepare_editable_requirementsT |LLLLL| NC((( \\ 4 4" '  % %dl 3 3 3    ! ! !> ! !> 78U V VC -"($% D    2 3 3 3) 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4, sB,C33C7:C7 skip_reasoncn|js Jd|Jd|jtd|||jjt 5|jrtdt|cdddS#1swxYwYdS)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)zSince 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_byrzr{rr$rrr r)rSr-rs r:prepare_installed_requirementz1RequirementPreparer.prepare_installed_requirements/ KK!KKK&& ,) , ,'&&  %{C9I9Q   \\ J J"  ( )--GGII J J J J J J J J J J J J J J J J J JsAB**B.1B.)"rr>r[rMrr>r0r1rr r2r1r.rrrrr,rrrr1rr1rr1r?r@rr1rr@r3rA)r-rr3rA)r-rrr1r3rA)r-rr3r")r-rr3r)r<rr3r)F)rrrr1r3rA)r-rrr1r3r)rrrr1r3rA)r-rr3r)r-rrr>r3r)rUrVrW__doc__rrrrrrrrrrrrrr __classcell__)rs@r:rrs  ;5;5;5;5;5;5zBBBB6.....CCCC@====&''''R@!&'C'C'C'C'CT@E*J*J*J*J*JZKP     r?r@r3rA)NN) r<rrZrr[rMr\r]r3rK)r<rr[rMr\r]r3rK)r<rr=r>rZrr?r@r[rMr\r]r3rk)T) r<rr[r>r\r]rtr1r3rM)Ur __future__rrPrvrcollections.abcr dataclassesrpathlibrtypingrpip._vendor.packaging.utilsrpip._internal.build_envr pip._internal.distributionsr %pip._internal.distributions.installedr pip._internal.exceptionsr r rrrrr"pip._internal.index.package_finderrpip._internal.metadatarrpip._internal.models.direct_urlrpip._internal.models.linkrpip._internal.models.wheelrpip._internal.network.downloadr pip._internal.network.lazy_wheelrrpip._internal.network.sessionr,pip._internal.operations.build.build_trackerrpip._internal.req.req_installrpip._internal.utils._logr&pip._internal.utils.direct_url_helpersr r!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+pip._internal.cli.progress_barsr,rUrzr;rHrKrgrjrsrbrrYrIr:rs%..#""""" $$$$$$!!!!!! 999999======QQQQQQGGGGGG=<<<<<NNNNNNNN777777******,,,,,,555555544444EEEEEE<<<<<<......=<<<<<<<222222 766666555555!!!!!!8777777 8  5555$NNNN           " $ )))))2JN!!!!!: $ (((((^#'