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||_||_| |_||_||_d|_|jrW|j rKtjjtjj|j|_|#|r!|jrt|j}|x|_|_d|_d|_d|_|jr1|jj r|jj|_| r| |_n#|r|j&|_nt)|_||r |j*}||_d|_d|_d|_d|_|r|ng|_| r| ni|_| |_d|_| |_||_ tC|_"d|_#d|_$g|_%d|_&||_'d|_(d|_)yNF)*rBrCr>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&$$  &<#*. ==||"$''"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/rEformatr0rSrZlocationr,rC isinstancestr from_path)rfsrnrCs rg__str__zInstallRequirement.__str__s 88,TXX6AyyZ&&';DIIMM'JKK YY$TYY]]3A&A    (  ))5'(9(9(B(BC% 4z" "A ??$//3/,0OO !__668 wzl!,,ricvdj|jjt||jS)Nz<{} object: {} editable={!r}>)rm __class____name__rprDrfs rg__repr__zInstallRequirement.__repr__s..55 NN # #SY   rict|t}fdt|D}dj|jjdj |S)z5An un-tested helper for getting state, for debugging.c3HK|]}dj||yw)z{}={!r}N)rm).0attr attributess rg z2InstallRequirement.format_debug..s$Tmd!!$ 4(89ms"z<{name} object: {{{state}}}>z, )namestate)varssortedrmrurvjoin)rfnamesrr}s @rg format_debugzInstallRequirement.format_debugsU$Z z"TfUmT-44(())E"5  ricH|jy|jjSN)rBrrws rgrzInstallRequirement.names 88 xx}}ric$|jsy|j5td}|jj |5d|jj vcdddcdddS#1swYnxYw dddy#1swYyxYw)NFz1Checking if build backend supports build_editablebuild_editable)rGr_r2rcsubprocess_runner_supported_features)rfrunners rgsupports_pyproject_editablez.InstallRequirement.supports_pyproject_editablesr ^^0CF$$66v>'4+>+>+R+R+TT?> ^?>> ^^s#'BA0 B0A9 5BBc.|jjSr)rB specifierrws rgrzInstallRequirement.specifiersxx!!!ric|jduS)z7Whether this requirement was specified as a direct URL.N)rTrws rg is_directzInstallRequirement.is_directs!!--ric|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)rf specifierss rg is_pinnedzInstallRequirement.is_pinneds<XX'' :!#XT*-=(>(G(G=(XXriextras_requestedcN|sd}jtfd|DSy)N)c3K|]q}jjd|ixsNjjdt|ixs&jjdt|isyw)extraN)rFevaluater1r)r{rrfs rgr~z3InstallRequirement.match_markers..s .E  %%w&67N<<((':e3D)EFN<<(('3DU3K)LM N .sA7A:T)rFany)rfrs` rg match_markersz InstallRequirement.match_markers s9 %  << # .  ric,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 rghas_hash_optionsz#InstallRequirement.has_hash_optionssD%%&&ritrust_internetc>|jj}|r |j}n'|jr|jr |j }nd}|rA|j r5|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@rThash setdefault hash_nameappendr()rfr good_hashesrEs rghasheszInstallRequirement.hashes(sz'',,. 99D ^^ 2 2%%DD DII  " "4>>2 6 = =dii Hk""ric|jyt|j}|jrKt|jtr |j}n|jj }|r|d|zz }|S)z8Format a nice indicator to show where this "comes from" Nz->)rBrprCrorq)rfrrrCs rgrqzInstallRequirement.from_pathCsc 88  M ??$//3/!__ !__668 TJ&&ri build_dir autodeleteparallel_buildsc|j|jjS|j6ttj d|_|jjSt |jj}|r#|dtjj}tjj|s+tjd|tj|tjj!||}|rdnd}t||tj djS)NT)kindglobally_managed_zCreating directory %sF)rOdeleterr)r\rOrBr3r4 REQ_BUILDrruuiduuid4hexrNexistsloggerdebugmakedirsr)rfrrrdir_nameactual_build_dir delete_args rgensure_build_locationz(InstallRequirement.ensure_build_locationRs    +'',, , 88 $1",,t$D '',, ,*$((--8 "1TZZ\%5%5$67Hww~~i( LL0) < KK "77<< 8<(TU !((!  $  rictt|jdtrd}nd}t dj |jd||jdg|_y)z*Set requirement after generating metadata.rrrrNameN)ro parse_versionmetadatarrrrB)rfops rg_set_requirementz#InstallRequirement._set_requirement}s^ mDMM)$<=w GBB GGMM&)MM),  rict|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.)rrrBrrwarningr)rf metadata_names rgwarn_on_mismatching_namez+InstallRequirement.warn_on_mismatching_namesa)$--*?@ TXX]] +} <   ! II  II  }-ri 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 rk)rBrget_distributionrrcontainsversionrZ in_usersiter[r6in_site_packagesrraw_namernin_install_pathrD)rfr existing_distversion_compatibles rgcheck_if_existsz"InstallRequirement.check_if_existss 88  /1BB488==Q  !XX//88  ! !9 " $D  ,,,0D)-/M4R4R+77D7M7M6NO+4457 ..(,%/ 5S/}}(,%%)!$1!ricH|jsy|jjSrK)rEis_wheelrws rgrzInstallRequirement.is_wheelsyyyy!!!ric|jduSr)rUrws rgis_wheel_from_cachez&InstallRequirement.is_wheel_from_caches,,D88rictjj|j|jxr|jj xsdS)Nr)rNrOrrLrEsubdirectory_fragmentrws rgunpacked_source_directoryz,InstallRequirement.unpacked_source_directorys:ww|| OOTYYJ499+J+JPb  ricZtjj|jd}|S)Nzsetup.pyrNrOrr)rfsetup_pys rg setup_py_pathz InstallRequirement.setup_py_paths#77<< > > KricZtjj|jd}|S)Nz setup.cfgr)rf setup_cfgs rgsetup_cfg_pathz!InstallRequirement.setup_cfg_paths$GGLL!?!?M ric,t|jSr)r%rrws rgpyproject_toml_pathz&InstallRequirement.pyproject_toml_paths#4#A#ABBric2t|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'rbrar)rrc)rfpyproject_toml_datarequiresbackendcheckrs rgr$z&InstallRequirement.load_pyproject_tomls2 OOT55t7I7I3t9   &##EdV1M=# $DO 1D.'5,%*""*>   * * %  ric|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) rDrGrrNrOisfilerrrrws rgisolated_editable_sanity_checkz1InstallRequirement.isolated_editable_sanity_checks MM446GGNN4#5#56GGNN4#6#67#4&!HI 877  ric:|jxsd|j}|jrx|jrD|jr8|j r(t |j|j||_ net|j|j||_ n=t|j|j|j|j||_ |js|jn|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. zfrom )r_rdetails)r_rrLrHrN)rrErGrDrArr!r_rcr`r generate_metadata_legacyrrrHrrassert_source_matches_version)rfrs rgprepare_metadataz#InstallRequirement.prepare_metadata+s))2tyyk2 ?? //446*D"nn //#+' +<"nn //#+' '?.."0099 'D #yy  ! ! #  ) ) + **,ricpt|ds|jj|_|jS)N _metadata)hasattrget_distrrrws rgrzInstallRequirement.metadataWs)t[)!]]_55DN~~ric |jrt|jS|jrH|jrP>P/P NN9  LLMT__-  ri 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)rLr)rfrrrs rgensure_has_source_dirz(InstallRequirement.ensure_has_source_dir~s3 ?? ""88% /9DO #riarchive_sourcec||_yr)re)rfr s rgneeds_unpacked_archivez)InstallRequirement.needs_unpacked_archives -ric|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.)rer5rprLr.rrws rgensure_pristine_source_checkoutz2InstallRequirement.ensure_pristine_source_checkoutsj    + D0014?? C  0(7v>1150AB22  1ric^|js!tjd|jy|jjdk(ryt j |jj}t|jj}|j|j|dy)Nz>Cannot update repository at %s; repository location is unknownfiler)rS verbosity) rErrrLschemer7get_backend_for_schemer-rSobtain)rf vcs_backend hidden_urls rgupdate_editablez"InstallRequirement.update_editablesyy LLP   99  v % 001A1AB diimm, 4?? aHri auto_confirmverbosec tj|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) rrrBrrrinfor& from_distremove)rfrrdistuninstalled_pathsets rg uninstallzInstallRequirement.uninstallsn '(99$((--H NN@$)) L 5t<.88>""<9""rirO parentdirrootdircdtdtdtfd}tjj||}|||}|jj dz|zS)NrprefixrIc||t|dzd}|jtjjd}|S)Nr/)rreplacerNrOsep)rr#s rg_clean_zip_namez=InstallRequirement._get_archive_name.._clean_zip_names6F a)*D<< S1DKrir%)rprNrOrrBr)rfrOr r!r(rs rg_get_archive_namez$InstallRequirement._get_archive_namesV # s s ww||It,tW-xx}}s"T))ric:|yd}dj|j|jd}tjj ||}tjj |rtdjt|d}|dk(rd}n|d k(r5tjd t|tj|nj|d k(rKt|}tjd t|t|tj||n|d k(rtj d|syt#j$|d t"j&d}|5tjj)tjj+|j,}tj.|D]\} } } | D]G} |j1| | |} t#j2| dz}d|_|j7|dI| D]H}|j1|| |}tjj | |}|j9||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 %sr.) allowZip64)r r!r%irzSaved %s)rmrrrNrOrrr*r,rrrr+shutilmovesysexitzipfileZipFile ZIP_DEFLATEDnormcaserQrwalkr)ZipInfo external_attrwritestrwriter)rfrcreate_archive archive_name archive_pathresponse dest_file zip_outputdirdirpathdirnames filenamesdirname dir_arcnamezipdirfilename file_arcnames rgarchivezInstallRequirement.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 *C>JJroothomer#warn_script_location pycompilec $t|jj||||j|}|jrh|j s\t ||ng||||jj|j|j|j|j d|_ yt|jj|j|t|j|||jr |jnd|j d|_ y)N)userrOrNrHr#) r;r#rOrrrrHr_rT)rreq_descriptionrQrP direct_url requested)rrBrrHrDrinstall_editable_legacyrr_rr]r#rWrprrVr@) rfr;rNrOr#rPrrQrs rginstallzInstallRequirement.install)s HHMM]]   == #1?1K~QS+XX]]"00..*.*H*H &*D "   HHMM  M!5-1^^t))(( "&ri)FNNNFr)T)rIN)FF)NNNNTFT)>rv __module__ __qualname____doc__r rr rprrr r rrrhrsrxrpropertyr functools lru_cacherrrrrrrrr(rrqrrrrrrrrrrr$rrrrrrrrrr r rr&rr)rMr rXr:rirgr9r9As#$(%)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 3ri