VULN_CHECK_I913V6 jXddlZddlZddlZddlZddlZddlZddlZddlmZddl m Z ddl m Z m Z mZmZmZmZmZmZddlmZddlmZddlmZddlmZdd lmZdd lmZdd l m!Z!dd l"m#Z#m$Z$dd l%m&Z&m'Z'ddl(m)Z)ddl*m+Z+m,Z,m-Z-m.Z.ddl/m0Z0ddl1m2Z2ddl3m4Z4ddl5m6Z6ddl7m8Z8ddl9m6Z:ddl;mm?Z?ddl@mAZAmBZBddlCmDZDddlEmFZFddlGmHZHddlImJZJmKZKmLZLmMZMmNZNmOZOmPZPmQZQddlRmSZSddlTmUZUddlVmWZWmXZXddlYmZZZdd l[m\Z\dd!l]m^Z^eje`ZaGd"d#Zbd$ebd%ecfd&Zdd'ed(eebd)ecd%eefd*Zfd'ed(eebd%dfd+Zgy),N)Values)Path)Any CollectionDictIterableListOptionalSequenceUnion)Marker) Requirement) SpecifierSet)canonicalize_name)Version)parse)BuildBackendHookCaller)BuildEnvironmentNoOpBuildEnvironment)InstallationErrorPreviousBuildDirError) get_scheme)BaseDistributionget_default_environmentget_directory_distributionget_wheel_distribution)FilesystemWheel) DirectUrl)Link)generate_metadata)generate_editable_metadata)install_editable) install_wheel)load_pyproject_tomlmake_pyproject_path)UninstallPathSet) deprecated)Hashes) ConfiguredBuildBackendHookCallerask_path_exists backup_dir display_pathhide_urlis_installable_dirredact_auth_from_requirementredact_auth_from_url) safe_extra)runner_with_spinner_message) TempDirectory tempdir_kinds) unpack_file)running_under_virtualenv)vcsc eZdZdZ dLdddddddddeedeeedfded ee d ee d eed ed ee edee ee efdee eeee effdede edededdfdZdefdZdefdZdefdZedeefdZej*defdZedefdZedefdZedefdZdMdeeedefdZedefd ZdNd!edefd"Zdeefd#Z d$ed%ed&edefd'Z!dOd(Z"dOd)Z#d*eddfd+Z$edefd,Z%edefd-Z&edefd.Z'edefd/Z(edefd0Z)edefd1Z*dOd2Z+dOd3Z,dOd4Z-ede.fd5Z/de0fd6Z1dOd7Z2 dPd8ed%ed&eddfd9Z3d:e4ddfd;Z5dOd<Z6dOd=Z7 dPd>ed?edee8fd@Z9dAedBedCedefdDZ:d$eeddfdEZ; dQd eer?r@rAreturnc|t|tsJ|||_||_| |_||_||_d|_|j r[|sJ|jrKtjjtjj|j|_|#|r!|jrt|j}|x|_|_d|_d|_d|_|j r1|j jr|j j|_| r| |_n#|r|j*|_nt-|_||r |j.}||_d|_d|_d|_d|_|r|ng|_| r| ni|_| |_d|_ | |_!||_"tG|_$d|_%d|_&g|_'d|_(||_)d|_*d|_+yNF), isinstancerrBrCr>rDrA source_diris_fileospathnormpathabspath file_pathurlrrE original_linkcached_wheel_source_link download_infolocal_file_pathr?setmarkerrF satisfied_byshould_reinstall_temp_build_dirinstall_succeededr;r<r=preparedr@rHr build_envmetadata_directorypyproject_requiresrequirements_to_checkpep517_backendrGneeds_more_preparation_archive_source)selfrBrCrDrErFrGrHr;r<r=r>r?r@rAs B/usr/lib/python3.12/site-packages/pip/_internal/req/req_install.py__init__zInstallRequirement.__init__Hs${jk:?C?:$$  &<#*. ==K4||"$''"2"2277??4>>3R"S nB,8Lb. +  +?+A 268<13"AE%',#04ch|jrSt|j}|jr`|djt |jj z }n.|jr t |jj }nd}|j @|j j t|j j}nd}|d|z }|jrLt|jtr |j}n|jj}|r |d|dz }|S)Nz from {}zz in z (from )) rBr/rEformatr0rTr[locationr,rCrLstr from_path)rgsrorCs rh__str__zInstallRequirement.__str__s 88,TXX6AyyZ&&';DIIMM'JKK YY$TYY]]3A&A    (  ))5'(9(9(B(BC% 4z" "A ??$//3/,0OO !__668 wzl!,,rjcvdj|jjt||jS)Nz<{} object: {} editable={!r}>)rn __class____name__rprDrgs rh__repr__zInstallRequirement.__repr__s..55 NN # #SY   rjct|t}fdt|D}dj|jjdj |S)z5An un-tested helper for getting state, for debugging.c3HK|]}dj||yw)z{}={!r}N)rn).0attr attributess rh z2InstallRequirement.format_debug..s$Tmd!!$ 4(89ms"z<{name} object: {{{state}}}>z, )namestate)varssortedrnrurvjoin)rgnamesrr}s @rh format_debugzInstallRequirement.format_debugsU$Z z"TfUmT-44(())E"5  rjcH|jy|jjSN)rBrrws rhrzInstallRequirement.names 88 xx}}rjc@|jsy|jsJ|j5td}|jj |5d|jj vcdddcdddS#1swYnxYw dddy#1swYyxYw)NFz1Checking if build backend supports build_editablebuild_editable)rGrdr`r2subprocess_runner_supported_features)rgrunners rhsupports_pyproject_editablez.InstallRequirement.supports_pyproject_editables"""" ^^0CF$$66v>'4+>+>+R+R+TT?> ^?>> ^^s#'BA>+ B>B BBcJ|jJ|jjSr)rB specifierrws rhrzInstallRequirement.specifiers"xx###xx!!!rjc|jduS)z7Whether this requirement was specified as a direct URL.N)rUrws rh is_directzInstallRequirement.is_directs!!--rjc|jJ|jj}t|dk(xr tt |j dvS)zReturn whether I am pinned to an exact version. For example, some-package==1.2 is pinned; some-package>1.2 is not. >=====)rBrlennextiteroperator)rg specifierss rh is_pinnedzInstallRequirement.is_pinnedsL xx###XX'' :!#XT*-=(>(G(G=(XXrjextras_requestedcN|sd}jtfd|DSy)N)c3K|]q}jjd|ixsNjjdt|ixs&jjdt|isyw)extraN)rFevaluater1r)r{rrgs rhr~z3InstallRequirement.match_markers..s .E  %%w&67N<<((':e3D)EFN<<(('3DU3K)LM N .sA7A:T)rFany)rgrs` rh match_markersz InstallRequirement.match_markers s9 %  << # .  rjc,t|jS)zReturn whether any known-good hashes are specified as options. These activate --require-hashes mode; hashes specified as part of a URL do not. )boolr<rws rhhas_hash_optionsz#InstallRequirement.has_hash_optionssD%%&&rjtrust_internetcZ|jj}|r |j}n'|jr|jr |j }nd}|rO|j rC|jJ|j|jgj|j t|S)aReturn a hash-comparer that considers my option- and URL-based hashes to be known-good. Hashes in URLs--ones embedded in the requirements file, not ones downloaded from an index server--are almost peers with ones from flags. They satisfy --require-hashes (whether it was implicitly or explicitly activated) but do not activate it. md5 and sha224 are not allowed in flags, which should nudge people toward good algos. We always OR all hashes together, even ones from URLs. :param trust_internet: Whether to trust URL-based (#md5=...) hashes downloaded from the internet, as by populate_link() N) r<copyrErr@rUhash hash_name setdefaultappendr()rgr good_hashesrEs rhhasheszInstallRequirement.hashes(s'',,. 99D ^^ 2 2%%DD DII>>- --  " "4>>2 6 = =dii Hk""rjc|jyt|j}|jrKt|jtr |j}n|jj }|r|d|zz }|S)z8Format a nice indicator to show where this "comes from" Nz->)rBrprCrLrq)rgrrrCs rhrqzInstallRequirement.from_pathCsc 88  M ??$//3/!__ !__668 TJ&&rj build_dir autodeleteparallel_buildsc|J|j.|jjsJ|jjS|j6ttj d|_|jjSt |jj}|r#|dtjj}tjj|s+tjd|tj|tjj!||}|rdnd}t||tj djS)NT)kindglobally_managed_zCreating directory %sF)rPdeleterr)r]rPrBr3r4 REQ_BUILDrruuiduuid4hexrOexistsloggerdebugmakedirsr)rgrrrdir_nameactual_build_dir delete_args rhensure_build_locationz(InstallRequirement.ensure_build_locationRs"$$$    +'',, ,,'',, , 88 $1",,t$D '',, ,*$((--8 "1TZZ\%5%5$67Hww~~i( LL0) < KK "77<< 8<(TU !((!  $  rjc&|jJ|jJ|jJtt |jdt rd}nd}t dj|jd||jdg|_y)z*Set requirement after generating metadata.NrrrrName)rBmetadatarMrL parse_versionrrr)rgops rh_set_requirementz#InstallRequirement._set_requirement}sxx}}(((*** mDMM)$<=w GBB GGMM&)MM),  rjc|jJt|jd}t|jj|k(rytj d|j||jt ||_y)NrzeGenerating metadata for package %s produced metadata for project name %s. Fix your #egg=%s fragments.)rBrrrrwarningr)rg metadata_names rhwarn_on_mismatching_namez+InstallRequirement.warn_on_mismatching_namesqxx###)$--*?@ TXX]] +} <   ! II  II  }-rj use_user_sitec|jytj|jj}|sy|jjj |j d}|sod|_|rO|jrd|_ ytrG|jr:td|jd|j|jrd|_ yyyy|j rd|_ d|_y||_y)zFind an installed distribution that satisfies or conflicts with this requirement, and set self.satisfied_by or self.should_reinstall appropriately. NT) prereleaseszNWill not install to the user site because it will lack sys.path precedence to rl)rBrget_distributionrrcontainsversionr[ in_usersiter\r6in_site_packagesrraw_nameroin_install_pathrD)rgr existing_distversion_compatibles rhcheck_if_existsz"InstallRequirement.check_if_existss 88  /1BB488==Q  !XX//88  ! !9 " $D  ,,,0D)-/M4R4R+77D7M7M6NO+4457 ..(,%/ 5S/}}(,%%)!$1!rjcH|jsy|jjSrK)rEis_wheelrws rhrzInstallRequirement.is_wheelsyyyy!!!rjc|jduSr)rVrws rhis_wheel_from_cachez&InstallRequirement.is_wheel_from_caches,,D88rjc|js Jd|tjj|j|jxr|jj xsdS)NNo source dir for r)rMrOrPrrEsubdirectory_fragmentrws rhunpacked_source_directoryz,InstallRequirement.unpacked_source_directorysQ;"4TF ;;ww|| OOTYYJ499+J+JPb  rjc|js Jd|tjj|jd}|S)Nrzsetup.pyrMrOrPrr)rgsetup_pys rh setup_py_pathz InstallRequirement.setup_py_paths:;"4TF ;;77<< > > Krjc|js Jd|tjj|jd}|S)Nrz setup.cfgr)rg setup_cfgs rhsetup_cfg_pathz!InstallRequirement.setup_cfg_paths;;"4TF ;;GGLL!?!?M rjcX|js Jd|t|jS)Nr)rMr%rrws rhpyproject_toml_pathz&InstallRequirement.pyproject_toml_paths,;"4TF ;;"4#A#ABBrjc2t|j|j|jt |}|&|j rt d|dddd|_yd|_|\}}}}||_||_t||j|| |_ y) 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. Nz(Config settings are ignored for project .z?to use --use-pep517 or add a pyproject.toml file to the project24.0)reason replacementgone_inFT) backend_path) r$rGrrrpr=r'rcrbr)rrd)rgpyproject_toml_datarequiresbackendcheckrs rhr$z&InstallRequirement.load_pyproject_tomls2 OOT55t7I7I3t9   &##EdV1M=# $DO 1D.'5,%*""*>   * * %  rjc|jr|jrt|jsctjj |j s9tjj |jstd|dyyyyy)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) rDrGrrOrPisfilerrrrws rhisolated_editable_sanity_checkz1InstallRequirement.isolated_editable_sanity_checks MM446GGNN4#5#56GGNN4#6#67#4&!HI 877  rjc|js Jd||jxsd|j}|jr|jJ|j rD|j r8|jr(t|j|j||_ net|j|j||_ n=t|j|j|j|j||_ |js|j!n|j#|j%y)zEnsure that project metadata is available. Under PEP 517 and PEP 660, call the backend hook to prepare the metadata. Under legacy processing, call setup.py egg-info. rzfrom N)r`rdetails)r`rrMrHr)rMrrErGrdrDrArr!r`rar generate_metadata_legacyrrrHrrassert_source_matches_version)rgrs rhprepare_metadataz#InstallRequirement.prepare_metadata+s  ;"4TF ;;))2tyyk2 ??&&2 22 //446*D"nn //#+' +<"nn //#+' '?.."0099 'D #yy  ! ! #  ) ) + **,rjcpt|ds|jj|_|jS)N _metadata)hasattrget_distrrrws rhrzInstallRequirement.metadataWs)t[)!]]_55DN~~rjc&|jrt|jS|jrV|jrJ|jJt t |jt|jjStd|d)NzInstallRequirement zC has no metadata directory and no wheel: can't make a distribution.) rarrXrrBrrrrAssertionErrorrws rhrzInstallRequirement.get_dist^s  " "-d.E.EF F  ! !dmm88' '') 4 45!$((--0 !$() *  rjcH|js Jd||jd}|jrF|jjr0||jjvrtj d||ytj dt|j||y)Nrrz'Requested %s, but installing version %sz;Source in %s has version %s, which satisfies requirement %s)rMrrBrrrrr,)rgrs rhrz0InstallRequirement.assert_source_matches_versionls;"4TF ;;-- * 88**wdhh>P>P/P NN9  LLMT__-  rj parent_dircP|j|j||||_yy)aAEnsure that a source_dir is set. This will create a temporary build dir if the name of the requirement isn't known yet. :param parent_dir: The ideal pip parent_dir for the source_dir. Generally src_dir for editables and build_dir for sdists. :return: self.source_dir N)rr)rMr)rgrrrs rhensure_has_source_dirz(InstallRequirement.ensure_has_source_dir~s3 ?? ""88% /9DO #rjarchive_sourcec.|jJ||_yr)rf)rgr s rhneeds_unpacked_archivez)InstallRequirement.needs_unpacked_archives##+++-rjc|jJ|j*tt|j|jyt |jrt d|d|jdy)z6Ensure the source directory has not yet been built in.Nz%pip can't proceed with requirements 'z)' due to a pre-existing build directory (z). 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.)rMrfr5rpr.rrws rhensure_pristine_source_checkoutz2InstallRequirement.ensure_pristine_source_checkoutsx***    + D0014?? C  0(7v>1150AB22  1rjc|js!tjd|jy|jsJ|jsJ|jj dk(ryt j|jj }|sJd|jjt|jj}|j|j|dy)Nz>Cannot update repository at %s; repository location is unknownfilezUnsupported VCS URL r)rT verbosity) rErrrMrDschemer7get_backend_for_schemerTr-obtain)rg vcs_backend hidden_urls rhupdate_editablez"InstallRequirement.update_editablesyy LLP  }}} 99  v % 001A1AB B2499==/BB{diimm, 4?? aHrj auto_confirmverbosec<|jsJtj|jj}|s!tj d|jytj d|tj|}|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) rBrrrrrinfor& from_distremove)rgrrdistuninstalled_pathsets rh uninstallzInstallRequirement.uninstallsyxxx&(99$((--H NN@$)) L 5t<.88>""<9""rjrP parentdirrootdircdtdtdtfd}|jJtjj ||}|||}|jj dz|zS)NrprefixrIc|j|tjjzs Jd|d||t |dzd}|j tjjd}|S)Nzname z doesn't start with prefix r/) startswithrOrPseprreplace)rr$s rh_clean_zip_namez=InstallRequirement._get_archive_name.._clean_zip_namest??$ Eth9&D EF a)*D<< S1DKrjr&)rprBrOrPrr)rgrPr!r"r*rs rh_get_archive_namez$InstallRequirement._get_archive_namesf # s s xx###ww||It,tW-xx}}s"T))rjcV|jsJ|yd}dj|j|jd}tj j ||}tj j|rtdjt|d}|dk(rd}n|d k(r5tjd t|t j|nj|d k(rKt|}tjd t|t|tj||n|d k(rt!j"d|syt%j&|d t$j(d}|5tj j+tj j-|j.}t j0|D]\} } } | D]G} |j3| | |} t%j4| dz}d|_|j9|dI| D]H}|j3|| |}tj j | |}|j;||J dddtj=dt|y#1swY)xYw)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 %sr0) allowZip64)r!r"r&irzSaved %s)rMrnrrrOrPrrr*r,rrrr+shutilmovesysexitzipfileZipFile ZIP_DEFLATEDnormcaserRrwalkr+ZipInfo external_attrwritestrwriter)rgrcreate_archive archive_name archive_pathresponse dest_file zip_outputdirdirpathdirnames filenamesdirname dir_arcnamezipdirfilename file_arcnames rharchivezInstallRequirement.archives:    "))$))T]]95MN ww||I|< 77>>, '&%%+VL,F%G$H 3!&S}l<.HI ,'S&|4 ) . +  L)4S  __      ''""277??43Q3Q#RSC02 ,9'G"&"8"8") ##9#K %__[3->?F+6F(''3 (!*H#'#9#9 ") #$:$L "ww||GX>H$$X|<!*1=*  J \ :;+Zs 8C>JJ(roothomer$warn_script_location pycompilec x|jJt|jj||||j|}|jrh|j s\t ||ng||||jj|j|j|j|j d|_ y|j sJ|jsJt|jj|j|t|j|||jr |jnd|j d|_ y)N)userrQrPrHr$) r;r$rQrrrrHr`rT)rreq_descriptionrSrR direct_url requested)rBrrrHrDrinstall_editable_legacyrr`rr^rXr#rprrWr@) rgr;rPrQr$rRrrSrs rhinstallzInstallRequirement.install)sxx### HHMM]]   == #1?1K~QS+XX]]"00..*.*H*H &*D " }}}#### HHMM  M!5-1^^t))(( "&rj)FNNNFr)T)rIN)FF)NNNNTFT)>rv __module__ __qualname____doc__r rr rprrr r rrrirsrxrpropertyr functools lru_cacherrrrrrrrr(rrqrrrrrrrrrrr$rrrrrrrr rr rrr&r r+rOr rZr:rjrhr9r9As#$(%)t4/37;FJ "$#',!t4 k "t4U3(<#<=>t4 t4 tn t4 &! t4TNt4t4!c+t4tCcN34t4"$sE#tCy.,A'A"BCt4t43t4t4 !%!t4" #t4l0 #  c  hsm Y UT U U"<"".4..Y4YYhx}.EQU"'$''#T#V#6 8C= ))*.)AE) )V ,.$#2T#2d#2L"$"" 9T99  3  s  CSCC" H**-X#  *  *! %    ,.T.d.$I*;@# #37# " ##4 *c *c *C *C *A<#A<4Ars! SSS0:991@>JM. 85*EWAL<6-   5FE5C!   8 $X &X &v'9c8t,>'?QU3 3 ! "3 3rj