Re]dZddlZddlZddlZddlZddlmZmZmZm Z ddl m Z ddl m Z ddlmZddlmZmZmZmZmZmZmZddlmZdd lmZdd lmZdd lmZdd l m!Z!m"Z"dd l#m$Z$m%Z%ddl&m'Z'ddl(m)Z)ddl*m+Z+ddl,m-Z-ddl.m/Z/m0Z0ddl1m2Z2ddl3m4Z4m5Z5m6Z6m7Z7ddl8m9Z9ddl:m;Z;ddle?Z@de)de+dedeAdef dZBdedeCddfd ZDGd!d"ZE d2ded#e"d$e eCd%e e/deEf d&ZFd'eCd(eCddfd)ZGd*eCd+eCddfd,ZH d2ded$e eCd%e e/deEfd-ZI d2dedeCd#e"d$e eCd%e e/de eEf d.ZJded$eCd%e e/de eCfd/ZKGd0d1ZLdS)3z)Prepares a distribution for installation N)DictIterableListOptional)canonicalize_name))make_distribution_for_install_requirement)InstalledDistribution)DirectoryUrlHashUnsupported HashMismatch HashUnpinnedInstallationErrorNetworkConnectionErrorPreviousBuildDirErrorVcsHashUnsupported) PackageFinder)BaseDistribution)Link)Wheel)BatchDownloader Downloader)HTTPRangeRequestUnsupporteddist_from_wheel_url) PipSession)InstallRequirement)RequirementTracker) copy2_fixed)Hashes MissingHashes) indent_log) display_pathhide_urlis_installable_dirrmtree) TempDirectory) unpack_file)vcsreq req_trackerfinderbuild_isolationreturnct|}||5|||dddn #1swxYwY|S)z(Prepare a distribution for installation.N)rtrackprepare_distribution_metadataget_metadata_distribution)r'r(r)r* abstract_dists /builddir/build/BUILDROOT/alt-python311-pip-21.3.1-3.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_internal/operations/prepare.py_get_prepared_distributionr21s>cBBM   3  MM33FOLLLMMMMMMMMMMMMMMM  2 2 4 44sAA A linklocationctj|j}|J||t |jdS)N)url)r&get_backend_for_schemeschemeunpackr!r6)r3r4 vcs_backends r1unpack_vcs_linkr;>sI,T[99K  " " "xXdh%7%788888c.eZdZdedeeddfdZdS)Filepath content_typer+Nch||_|!tj|d|_dS||_dS)Nr)r? mimetypes guess_typer@)selfr?r@s r1__init__z File.__init__Es;   ) 4T : :1 =D    ,D   r<)__name__ __module__ __qualname__strrrEr<r1r>r>DsA-S- -$------r<r>download download_dirhashesctdd}d}|rt|||}|r|}d}n+|||j\}}|r||t ||S)Nr9Tkindglobally_managed)r$_check_download_dirr?check_against_pathr>)r3rKrLrMtemp_diralready_downloaded_path from_pathr@s r1 get_http_urlrWMs (TBBBH"R"5dL&"Q"Q1+  #+(4"?"? <  1  % %i 0 0 0  < ( ((r<srcdestc t||dS#tj$r5}tdt |||Yd}~dSd}~wwxYw)zCopying special files is not supported, but as a convenience to users we skip errors copying them. This supports tools that may create e.g. socket files in the project source directory. z>Ignoring special file error '%s' encountered copying %s to %s.N)rshutilSpecialFileErrorloggerwarningrI)rXrYes r1_copy2_ignoring_special_filesr`es  C  "     L FF             sA*AAsourcetargetchtj|}tj|tj|dt dt t dt t ffd }tj||dtdS)Ndnamesr+cxg}|kr|ddgz }tj|kr|gz }|S)Nz.toxz.nox)osr?abspath)rdreskippedratarget_basenametarget_dirnames r1ignorez!_copy_source_tree..ignore~sO ;; ' 'G 7??1   / / ( (Gr<T)rlsymlinks copy_function) rgr?rhbasenamedirnamerIrr[copytreer`)rarbtarget_abspathrlrjrks` @@r1_copy_source_treersysW__V,,Ng&&~66OW__^44N # d3i DI         O3 r<cd}|rt|||}|r|}n|j}|r||t|dS)z'Get file and optionally check its hash.N)rR file_pathrSr>)r3rLrMrUrVs r1 get_file_urlrvsi #R"5dL&"Q"Q#+ N -!!),,,  4  r<c|jrt||dS|rEtj|rt |t|j|dS|j rt|||}nt||||}|j st|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. N)rM)is_vcsr;is_existing_dirrgr?isdirr#rsruis_filervrWis_wheelr%r@)r3r4rKrLrMfiles r1 unpack_urlr~s {h'''t  7== " "  8   $.(333t |  D,v>>>        =<DIx):;;; Kr<cztj||j}tj|sdSt d||rW ||n@#t$r3t 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.) rgr?joinfilenameexistsr]inforSr r^unlink)r3rLrM download_paths r1rRrRs GLLt}==M 7>>- ( (t KK0-@@@    % %m 4 4 4 4    NNM    Im $ $ $44   s%A;;9B87B8c\eZdZdZdedeedededededed e d ed ed ed eddffd Z de ddfdZ de deddfdZ de defdZdedeefdZ d#dee deddfdZ d#de dedefdZ d#dee deddfdZde dedefdZde ddfdZde defd Zde d!edefd"ZxZS)$RequirementPreparerzPrepares a Requirement build_dirrLsrc_dirr*r(session progress_barr)require_hashes use_user_site lazy_wheel in_tree_buildr+Nc Rt||_||_||_||_t |||_t|||_ ||_ ||_ ||_ | |_ | |_| |_| |_i|_d|_dS)N)r)superrErrr(_sessionr _downloadr_batch_downloadr)rLr*rruse_lazy_wheelr _downloaded_previous_requirement_header)rDrrLrr*r(rrr)rrrr __class__s r1rEzRequirementPreparer.__init__s  "& #G\::.w EE ) /-+)+,.-5)))r<r'c|jjr0|js)d}tt |jj}nd}t|jp|}||f|jkr$||f|_t |||jrNt5t d|jj ddddS#1swxYwYdSdS)z3Provide context for the requirement being prepared.z Processing %sz Collecting %szUsing cached %sN) r3r{original_link_is_in_wheel_cacherIr rur'rr]rrr)rDr'message informations r1_log_preparing_linkz'RequirementPreparer._log_preparing_link3s: 8  .C$G .%Gl38+=>>??KK%Gcgn--K [ !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&CCCparallel_buildscL|jjrdS|jJ|jr|jr|jj|_dS||jd|t|jr(td ||jdS)z1Ensure source_dir of a linked InstallRequirement.NT) autodeleterzpip can't proceed with requirements '{}' due to apre-existing build directory ({}). This is likely due to a previous installation that failed . pip is being responsible and not assuming it can delete this. Please delete it and try again.) r3r| source_dirryrruensure_has_source_dirrr"rformat)rDr'rs r1_ensure_link_req_src_dirz,RequirementPreparer._ensure_link_req_src_dirDs 8   F~%%% 8 # # % % $*<  X/CN F !! N+ "    cn - - '239&cn2M2M    r<c>|js|dS|jjrt |jrt |j|jst|dp tS)NT)trust_internetF) rrMr3rxrryr original_link is_pinnedr r)rDr's r1_get_linked_req_hashesz*RequirementPreparer._get_linked_req_hashesis " 3::T:22 2 8? '$&& & 8 # # % % 0-// /   $S] $.. zzz//B=??Br<r3c |jsdS|jrtddS|js|jstd|dSt |j}t|j }t d||j |j ddd} t|||jS#t $rtd|YdSwxYw) z-Fetch metadata using lazy wheel, if possible.Nz3Lazy wheel is not used as hash checking is requiredz>Lazy wheel is not used as %r does not points to a remote wheelz+Obtaining dependency information from %s %s#rz"%s does not support range requests)rrr]debugr{r|rrrnamerversionr6splitrrr)rDr3wheelrr6s r1 _fetch_metadata_using_lazy_wheelz4RequirementPreparer._fetch_metadata_using_lazy_wheels " 4    LLN O O O4 < t}  LLP   4dm$$ ,, 9  M   hnnS!$$Q' &tS$-@@ @*    LL=s C C C44 sC%DDFpartially_downloaded_reqscXtddj}i}|D]}|jsJ|||j<|||}|D]3\}\}} t d||||}||_4|D]}|||dS)z>Download any requirements which were only fetched by metadata.r9TrOzDownloading link %s to %sN) r$r?r3rkeysr]rlocal_file_path_prepare_linked_requirement) rDrrrTlinks_to_fully_downloadr'batch_downloadr3filepath_s r1_complete_partial_requirementsz2RequirementPreparer._complete_partial_requirementss!hFFFK CE, 4 4C8OOO03 #CH - --- # ( ( * *   $2 + + D-8Q LL4dH E E E)$/C"*C  - C CC  , ,S/ B B B B C Cr<c|jsJ|j}||t5d}|j7|jr0||}t |j|j|}|||j|jj<n,| |}|d|_ |cdddS| ||cdddS#1swxYwYdS)z3Prepare a requirement to be obtained from req.link.NT) r3rrrLr|rrRrr6rneeds_more_preparationr)rDr'rr3rurM wheel_dists r1prepare_linked_requirementz.RequirementPreparer.prepare_linked_requirementsqxx   %%% \\ J JI ,,44S99/$:KVTT $1: .."BB4HH )15C.%! J J J J J J J J&33CII' J J J J J J J J J J J J J J J J J JsA7C8CC!Creqscd|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 | SrJ)r).0r's r1 zHRequirementPreparer.prepare_linked_requirements_more..s BBBs'ABBBBr<NF)r) rLr3r|rrRrr6rappendrr)rDrrr'rMrurs r1 prepare_linked_requirements_morez4RequirementPreparer.prepare_linked_requirements_moresCBtBBB 7 7C ,1B,44S99/$:KVTT (5>D$SX\216C.?A! G GC) G)00555500oFFFF ++ %+ ,     r<cZ|jsJ|j}|||||}|r |jrd}n|j|jvrZ t||j|j |j |}np#t$r)}td |||d}~wwxYw|j|j}|r||t|d}|r |j|_t%||j|j|j}|S)NzDCould not install requirement {} because of HTTP error {} for URL {})r@)r3rrryrr6rr~rrrLrr rrSr>r?rr2r(r)r*) rDr'rr3rM local_fileexcrudists r1rz/RequirementPreparer._prepare_linked_requirementsbxx %%c?;;;,,S11    ! ! ? ? ?():;;M KK M 2 2 2 2 2 3 3r<c|js Jdtd|t5|jr"t d|||j| t||j |j |j }||jdddn #1swxYwY|S)z Prepare an editable requirement.z-cannot prepare a non-editable req as editablez Obtaining %szoThe editable requirement {} cannot be installed when requiring hashes, because there is no single file to hash.N)rr]rrrr rrrupdate_editabler2r(r)r*check_if_existsr)rDr'rs r1prepare_editable_requirementz0RequirementPreparer.prepare_editable_requirementDs( |LLLLLL NC((( \\ 4 4" '"F3KK  % %dl 3 3 3    ! ! !-  $ D    2 3 3 3# 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4& sBCC!C skip_reasonc|js Jd|"Jd|jtd|||jjt 5|jrtdt| cdddS#1swxYwYdS)z)Prepare an already-installed requirement.z(req should have been satisfied but isn'tNzAdid 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_byrr]rrrrrr r/)rDr'rs r1prepare_installed_requirementz1RequirementPreparer.prepare_installed_requirementbs/ KK!KKKK&& !6#"233'&&  %{C9I9Q   \\ J J"  ( )--GGII J J J J J J J J J J J J J J J J J Js+AB::B>B>)F)rFrGrH__doc__rIrboolrrrrErrrrrrrrrrrrrrrr __classcell__)rs@r1rrs  0505sm05 05  05 ( 0505050505050505 050505050505dB'9BdBBBB"#%#8<# ####JC*<CCCCC@ " #D!&CC#+,>#?CC  CCCCB@EJJ%J8<J JJJJ:KP  /0 CG     <&%&8<& &&&&P3+=3$33334  <J JJ  JJJJJJJJr<r)NN)MrloggingrBrgr[typingrrrrpip._vendor.packaging.utilsrpip._internal.distributionsr%pip._internal.distributions.installedr pip._internal.exceptionsr r r r rrr"pip._internal.index.package_finderrpip._internal.metadatarpip._internal.models.linkrpip._internal.models.wheelrpip._internal.network.downloadrr pip._internal.network.lazy_wheelrrpip._internal.network.sessionrpip._internal.req.req_installrpip._internal.req.req_trackerrpip._internal.utils.filesystemrpip._internal.utils.hashesrrpip._internal.utils.loggingrpip._internal.utils.miscr r!r"r#pip._internal.utils.temp_dirr$pip._internal.utils.unpackingr%pip._internal.vcsr& getLoggerrFr]rr2rIr;r>rWr`rsrvr~rRrrJr<r1rs  111111111111999999QQQQQQGGGGGG=<<<<<333333******,,,,,,FFFFFFFF544444<<<<<<<<<<<<666666<<<<<<<<222222WWWWWWWWWWWW666666555555!!!!!!  8 $ $ 5  5# 5  5 5  5 5 5 59$9#9$9999 --------#'# )) ))3-) V  )  ))))0 s # $    (c34<PT!! !&sm!