ReJdddlZddlZddlZddlZddlZddlZddlZddlmZm Z m Z m Z m Z m Z mZmZddlmZddlmZddlmZddlmZddlmZddlmZdd lmZdd lmZdd l m!Z!dd l"m#Z#m$Z$dd l%m&Z&ddl'm(Z(ddl)m*Z*ddl+m,Z,ddl-m.Z.ddl/m,Z0ddl1m2Z3ddl4m5Z5ddl4m6Z7ddl8m9Z9ddl:m;Z;mZ>ddl?m@Z@ddlAmBZBmCZCddlDmEZEddlFmGZGmHZHmIZImJZJmKZKmLZLmMZMmNZNmOZOddlPmQZQddlRmSZSddlTmUZUmVZVddlWmXZXdd lYmZZZej[e\Z]d!e^d"e!fd#Z_Gd$d%Z`d&e`d"e^fd'ZadS)(N)Any CollectionDictIterableListOptionalSequenceUnion) pkg_resources)Marker) Requirement) SpecifierSet)canonicalize_name)Version)parse)Pep517HookCaller) Distribution)BuildEnvironmentNoOpBuildEnvironment)InstallationError) get_scheme)Link)generate_metadata)generate_editable_metadata)install_editable)LegacyInstallFailure)install) install_wheel)load_pyproject_tomlmake_pyproject_path)UninstallPathSet) deprecated)direct_url_for_editabledirect_url_from_link)Hashes) ask_path_exists backup_dir display_pathdist_in_install_pathdist_in_site_packagesdist_in_usersiteget_distributionhide_urlredact_auth_from_url) get_metadata)runner_with_spinner_message) TempDirectory tempdir_kinds)running_under_virtualenv)vcsmetadata_directoryreturnc|tj}tj|\}}t j||}|dr2t j}tj |d}na|dsJt j }tj |ddd}||||S)zQReturn a pkg_resources.Distribution for the provided metadata directory. z .egg-inforz .dist-info-) project_namemetadata) rstriposseppathsplitr PathMetadataendswithrsplitextDistInfoDistribution)r5dist_dirbase_dir dist_dir_namer:dist_cls dist_names /builddir/build/BUILDROOT/alt-python311-pip-21.3.1-3.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_internal/req/req_install.py _get_distrJBs"((00H!gmmH55Hm)(H==H%%E -G$$]33A6   ..... 5G$$]33A6<edefd?Z5d#eeddfd@Z6 dLd e ed ee7edAeedBeedCeedDed)edEeddfdFZ8dS)MInstallRequirementz Represents something that may be installed later on, may have information about where to fetch the relevant requirement and also contains logic for installing the said requirement. FNreq comes_fromeditablelinkmarkers use_pep517isolatedinstall_optionsglobal_options hash_options constraintextras user_suppliedpermit_editable_wheelsr6c|t|ts J|||_||_| |_||_||_d|_d|_|jrQ|sJ|j rFtj tj |j|_||r|jrt!|j}|x|_|_d|_d|_|jr|jj r|jj|_| r| |_n,|rd|jD|_nt-|_| |r|j}||_d|_d|_d|_d|_|r|ng|_| r| ng|_| r| ni|_d|_ | |_!||_"tG|_$d|_%d|_&g|_'d|_(||_)d|_*dS)NFc6h|]}tj|SrN)r safe_extra).0extras rI z.InstallRequirement.__init__..s#SSSu=3E::SSSrK)+ isinstancer rOrPrYrQr\legacy_install_reason source_diris_filer<r>normpathabspath file_pathurlrrR original_linkoriginal_link_is_in_wheel_cachelocal_file_pathrZsetmarkerrS satisfied_byshould_reinstall_temp_build_dirinstall_succeededrVrWrXpreparedr[rUr build_envr5pyproject_requiresrequirements_to_checkpep517_backendrTneeds_more_preparation)selfrOrPrQrRrSrTrUrVrWrXrYrZr[r\s rI__init__zInstallRequirement.__init__cs "{jk::{{C{{{$$  &<#48"*. = TKKK| T"$'"2"227??4>3R3R"S"S FnnB,8@LLb +  +?+A+A 268<13";?%',###rKc|jrKt|j}|jr/|dt |jjz }n#|jrt |jj}nd}|j/|dt|jjz }|j rFt|j tr|j }n|j }|r |d|dz }|S)Nz from {}zz in {}z (from )) rOstrrRformatr.rjrpr(locationrPrc from_pathrzsrPs rI__str__zInstallRequirement.__str__s 8 'DH Ay LZ&&';DIM'J'JKKK Y '$TY]33AA&A   ( d.?.H!I!IJJ JA ? -$/3// 9,0O !_6688  -,z,,,,rKchd|jjt||jS)Nz<{} object: {} editable={!r}>)r __class____name__r~rQrzs rI__repr__zInstallRequirement.__repr__s..55 N #SYY    rKct|t}fdt|D}d|jjd|S)z5An un-tested helper for getting state, for debugging.c3PK|] }d||V!dS)z{}={!r}N)r)r`attr attributess rI z2InstallRequirement.format_debug..s8TTd!!$ 4(899TTTTTTrKz<{name} object: {{{state}}}>z, )namestate)varssortedrrrjoin)rznamesrrs @rI format_debugzInstallRequirement.format_debugsn$ZZ z""TTTTfUmmTTT-44())E""5   rKcP|jdStj|jjSN)rOr safe_namerrs rIrzInstallRequirement.names$ 8 4&tx}555rKc<|jsdS|jsJ|j5td}|j|5d|jvcdddcdddS#1swxYwY ddddS#1swxYwYdS)NFz1Checking if build backend supports build_editablebuild_editable)rTrxrur0subprocess_runner_supported_features)rzrunners rIsupports_pyproject_editablez.InstallRequirement.supports_pyproject_editables~ 5"""" ^ U U0CF$66v>> U U'4+>+R+R+T+TT U U U U U U U  U U U U U U U U U U U U U U U U U  U U U U U U U U U U U U U U U U U Us5*BA8 B8A< <B?A< BBBc|jjSr)rO specifierrs rIrzInstallRequirement.specifiers x!!rKc||j}t|dko"tt|jdvS)zReturn whether I am pinned to an exact version. For example, some-package==1.2 is pinned; some-package>1.2 is not. >=====)rlennextiteroperator)rz specifierss rI is_pinnedzInstallRequirement.is_pinneds9 ^ :!#XT*-=-=(>(>(G=(XXrKextras_requestedcT|sd}jtfd|DSdS)N)c3PK|] }jd|iV!dS)raN)rSevaluate)r`rarzs rIrz3InstallRequirement.match_markers..sI2 6 6 = =di H H Hk"""rKc|jdSt|j}|jrEt|jtr|j}n|j}|r|d|zz }|S)z8Format a nice indicator to show where this "comes from" Nz->)rOr~rPrcrrs rIrzInstallRequirement.from_path<sr 8 4 MM ? '$/3// 9!_ !_6688  'TJ&&rK build_dir autodeleteparallel_buildscD|J|j|jjsJ|jjS|j,ttjd|_|jjSt |j}|r|dtj j }tj |s/td|tj|tj||}|rdnd}t||tjdjS)NT)kindglobally_managed_zCreating directory %sF)r>deleterr)rrr>rOr1r2 REQ_BUILDrruuiduuid4hexr<existsloggerdebugmakedirsr)rzrrrdir_nameactual_build_dir delete_args rIensure_build_locationz(InstallRequirement.ensure_build_locationJs1$$$   +', , , ,', , 8 $1",t$$$D ', ,*$)44  8"77TZ\\%577Hw~~i(( # LL0) < < < K " " "7<< 8<<(2TTU !(!      rKc |jJ|jJ|jJtt |jdt rd}nd}t d|jd||jdg|_dS)z*Set requirement after generating metadata.NrrrrName)rOr:rerc parse_versionrr r)rzops rI_set_requirementz#InstallRequirement._set_requirementusx}(((*** mDM)$<==w G G BBB GGM&)M),    rKct|jd}t|jj|krdStd|j||jt ||_dS)NrzeGenerating metadata for package %s produced metadata for project name %s. Fix your #egg=%s fragments.)rr:rOrrwarningr )rz metadata_names rIwarn_on_mismatching_namez+InstallRequirement.warn_on_mismatching_namess)$-*?@@ TX] + +} < < F  ! I  I    }--rK use_user_sitec|jdSt|jj}|sdS|j}|duo |jj|d}|sd|_|rft|r d|_dStrrrerRsubdirectory_fragmentrs rIunpacked_source_directoryz,InstallRequirement.unpacked_source_directorys2w|| OTYJ49+JPb   rKcx|js Jd|tj|jd}|S)NNo source dir for zsetup.pyrer<r>rr)rzsetup_pys rI setup_py_pathz InstallRequirement.setup_py_paths>;; ;T ; ;;;;7<< > KKrKcx|js Jd|tj|jd}|S)Nrz setup.cfgr)rz setup_cfgs rIsetup_cfg_pathz!InstallRequirement.setup_cfg_paths?;; ;T ; ;;;;GLL!?MM rKcR|js Jd|t|jS)Nr)rer rrs rIpyproject_toml_pathz&InstallRequirement.pyproject_toml_paths2;; ;T ; ;;;;"4#ABBBrKct|j|j|jt |}| d|_dSd|_|\}}}}||_||_t|j|||_ dS)aALoad the pyproject.toml file. After calling this routine, all of the attributes related to PEP 517 processing for this requirement have been set. In particular, the use_pep517 attribute can be used to determine whether we should follow the PEP 517 or legacy (setup.py) code path. NFT) backend_path) rrTrrr~rwrvrrrx)rzpyproject_toml_datarequiresbackendcheckrs rIrz&InstallRequirement.load_pyproject_tomls2 OT5t7I3t99    &#DO F1D.'5,%*""*.  * %   rKc|jrv|jrq|s_tj|js=tj|jstd|ddSdSdSdSdS)zCheck that an editable requirement if valid for use with PEP 517/518. This verifies that an editable that has a pyproject.toml either supports PEP 660 or as a setup.py or a setup.cfg zProject z has a 'pyproject.toml' and its build backend is missing the 'build_editable' hook. Since it does not have a 'setup.py' nor a 'setup.cfg', it cannot be installed in editable mode. Consider using a build backend that supports PEP 660.N) rQrTrr<r>isfilerrrrs rIisolated_editable_sanity_checkz1InstallRequirement.isolated_editable_sanity_checks M  4466 GNN4#566  GNN4#677 $I4III           rKc|jsJ|jrm|jJ|jr<|jr5|r!t |j|j|_n]t|j|j|_nCannot update repository at %s; repository location is unknownfilezUnsupported VCS URL )rj) rRrrrerQschemer4get_backend_for_schemerjr-obtain)rz vcs_backend hidden_urls rIupdate_editablez"InstallRequirement.update_editableusy  LLP    F} 9 v % % F01ABB BBB49=BBBBBdim,, 4? ;;;;;rK auto_confirmverbosec|jsJt|jj}|s"td|jdStd|t j|}||||S)a Uninstall the distribution currently satisfying this requirement. Prompts before removing or modifying files unless ``auto_confirm`` is True. Refuses to delete or modify files outside of ``sys.prefix`` - thus uninstallation within a virtual environment can only modify that virtual environment, even if the virtualenv is linked to global site-packages. z#Skipping %s as it is not installed.NzFound existing installation: %s) rOr,rrrinfor! from_distremove)rzrrdistuninstalled_pathsets rI uninstallzInstallRequirement.uninstallsx ..  NN@$) L L L4 5t<<<.8>>""<999""rKr> parentdirrootdircdtdtdtfd}tj||}|||}|jdz|zS)Nrprefixr6c||tjjzsJd|d||t |dzd}|tjjd}|S)Nzname z doesn't start with prefix r/) startswithr<r>r=rreplace)rrs rI_clean_zip_namez=InstallRequirement._get_archive_name.._clean_zip_names??$ E EDtDD&DD E E EF a))*D<< S11DKrKr!)r~r<r>rr)rzr>rrr$rs rI_get_archive_namez$InstallRequirement._get_archive_namesd # s s    w||It,,tW--y3%%rKc|jsJ|dSd}d|j|jd}tj||}tj|rtdt|d}|dkrd}n|d kr=t d t|t j |n{|d kr[t|}t d t|t|tj||n|d krt!jd|sdSt%j|d t$jd}|5tjtj|j}t j|D]\} } } | D]N} || | |} t%j| dz}d|_||dO| D]P}||| |}tj| |}|||Q dddn #1swxYwYtdt|dS)z}Saves archive to provided build_dir. Used for saving downloaded VCS requirements as part of `pip download`. NTz {}-{}.ziprz8The file {} exists. (i)gnore, (w)ipe, (b)ackup, (a)bort )iwbar'Fr(z Deleting %sr)zBacking up %s to %sr*) allowZip64)rrr!irzSaved %s)rerrr:r<r>rrr&r(rrrr'shutilmovesysexitzipfileZipFile ZIP_DEFLATEDnormcaserhrwalkr%ZipInfo external_attrwritestrwriter)rzrcreate_archive archive_name archive_pathresponse dest_file zip_outputdirdirpathdirnames filenamesdirname dir_arcnamezipdirfilename file_arcnames rIarchivezInstallRequirement.archives    F"))$)T]95MNN w||I|<< 7>>, ' ' &%%+VL,F,F%G%G$H 3!&S}l<.H.HIII ,''''S&|44 ) .. ++  L)4444S   F_         = ='""27??43Q#R#RSSC02  = =,9'44G"&"8"8") ##9##K %_[3->??F+6F(''3333 )==H#'#9#9 ") #$:$$L "w||GX>>H$$X|<<<<= = = = = = = = = = = = = = = = =*  J \ : :;;;;;sDJ""J&)J&roothomerwarn_script_location pycompilec t|j||||j|} ||ng}|jrB|js;t ||||||j|j|j|j|j d|_ dS|jr|j sJd} |jrt|j} n'|j r t|j |j|j} t!|j|j | t#|j||| |jd|_ dSt)||jz}t)||jz} t/|||||||| |j|j|j|j|jt#|j} n1#t0$r} d|_ | jd} ~ wt4$r d|_ wxYw| |_ | r8|jdkr/t9d|jd dd dSdSdS) N)userrKrJrUr)rrKrrrrUrurT)r req_descriptionrMrL direct_url requested)rVrWrJrKrrrMr rrUreq_namerurrPFi zg{} was installed using the legacy 'setup.py install' method, because a wheel could not be built for it.z+to fix the wheel build issue reported abovereason replacementgone_inissue)rrrUrQrinstall_editable_legacyrrurrsrmr#rkr$rerlrr~rOr[listrWrVinstall_legacyr __cause__ Exceptionrdr"r) rzrVrWrJrKrrLrrMr rQsuccessexcs rIrzInstallRequirement.installs I]    ,:+E2 =   #+Y"0.*.*H    &*D " F = ' ' ' 'J} 4T5STT # 1&O8  $ #DH #%9%,    &*D " Fn--0CC//$2FF $ /-+#"0.*.*H #DH GG $   %*D "-    %)D "  ")  t1T99 IIO JJJ        99s4AE== F+FF+) FNNNFNNNFrNFFr)T)r6N)FF)NNNNTFT)9r __module__ __qualname____doc__rr r r~rrr rrrr{rrrpropertyr functools lru_cacherrrrrrrr%rrrrrrrrrrrrrrrr:rrrr rr!rr%rIr rrNrKrIrMrM\sv#$(%)/3.27; "$#',h,h, k "h,U3(<#<=>h, h, tn h, &! h,TNh,h,"$s),h,!c+h,tCcN34h,h,3h,h,!%h, !h,h,h,h,T( #     c     6hsm666X6 Y UT U U U U"<"""X"Y4YYYXY  hx}.E QU    '$'''X'##T#V####* 8C=    ))*.)AE) ))))V    ,...."+2T+2d+2+2+2+2\"$"""X"  3   X sX X CSCCCXC    4*'-'-'-'-R#X 2,2222*! %    .<<<<*;@## #37# " #####4 &c &c &C &C & & & &A<#A<4A<A<A<Ars SSSSSSSSSSSSSSSSSSSS%%%%%%000000::::::999999999999111111@@@@@@888888222222JJJJJJJJ666666......******EEEEEEWWWWWWIHHHHHMMMMMM@@@@@@LLLLLLLL<<<<<<666666.-----                      766666FFFFFFEEEEEEEECCCCCC!!!!!!  8 $ $#,4C C C C C C C C L'9crK