\bg^ dZddlZddlZddlmZddlmZddlmZm Z m Z m Z m Z m Z ddlmZddlmZddlmZdd lmZmZmZmZmZmZmZdd lmZdd lmZdd l m!Z!dd l"m#Z#ddl$m%Z%ddl&m'Z'm(Z(ddl)m*Z*ddl+m,Z,m-Z-ddl.m/Z/ddl0m1Z1ddl2m3Z3ddl4m5Z5ddl6m7Z7ddl8m9Z9ej:e;Z d dede e?e?e?fde@ddfdZAGdde,ZBdS)!ayDependency Resolution The dependency resolution in pip is performed as follows: for top-level requirements: a. only one spec allowed per project, regardless of conflicts or not. otherwise a "double requirement" exception is raised b. they override sub-dependency requirements. for sub-dependencies a. "first found, wins" (where the order is breadth first) N) defaultdict)chain) DefaultDictIterableListOptionalSetTuple) specifiers) Requirement) WheelCache)BestVersionAlreadyInstalledDistributionNotFound HashError HashErrorsInstallationErrorNoneMetadataErrorUnsupportedPythonVersion) PackageFinder)BaseDistribution)Link)Wheel)RequirementPreparer)InstallRequirementcheck_invalid_constraint_type)RequirementSet) BaseResolverInstallRequirementProvider)compatibility_tags) get_supported)direct_url_from_link) indent_log)normalize_version_info)check_requires_pythonFdist version_infoignore_requires_pythonreturnc  t|j}n/#t$r"}t|t|d}~wwxYw t ||}n>#t j$r,}td|j |Yd}~dSd}~wwxYw|rdSd tt|}|r$t d|j ||dStd|j d|d|) a Check whether the given Python version is compatible with a distribution's "Requires-Python" value. :param version_info: A 3-tuple of ints representing the Python major-minor-micro version to check. :param ignore_requires_python: Whether to ignore the "Requires-Python" value if the given Python version isn't compatible. :raises UnsupportedPythonVersion: When the given Python version isn't compatible. N)r&z-Package %r has an invalid Requires-Python: %s.zBIgnoring failed Requires-Python check for package %r: %s not in %rzPackage z requires a different Python: z not in )strrequires_pythonFileNotFoundErrorrr$r InvalidSpecifierloggerwarningraw_namejoinmapdebugr)r%r&r'r,e is_compatibleexcversions y/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/pip/_internal/resolution/legacy/resolver.py_check_dist_requires_pythonr:7s](.d233 ...c!ff---. - %     & ;T]C      hhs3 --..G P M       " 04= 0 0  0 0+ 0 0  s* A>AAB(!BBceZdZdZhdZ d%dededeede de d e d e d e d e d e dee e dfddffd Zdeede defdZ d&dededee deee de eeeeff dZdede fdZdeddfdZdedee fdZdedeefdZdeddfd Zdedefd!Zdededeefd"Zd#edeefd$ZxZS)'ResolverzResolves which packages need to be installed/uninstalled to perform the requested operation without breaking the requirements of any package. >eageronly-if-neededto-satisfy-onlyNpreparerfinder wheel_cachemake_install_req use_user_siteignore_dependenciesignore_installedr'force_reinstallupgrade_strategypy_version_info.r(c vt| |jvsJ| tjdd} nt | } | |_||_||_||_ | |_ | |_ ||_ ||_ ||_||_||_t#t$|_dS)N)super__init___allowed_strategiessysr&r#_py_version_infor@rArBrHrGrErFr'rD_make_install_reqrlist_discovered_dependencies) selfr@rArBrCrDrErFr'rGrHrI __class__s r9rMzResolver.__init__ts 4#;;;;;  "!.rr2OO4_EEO /   & 0.#6 0&<#*!1@KD@Q@Q%%% root_reqscheck_supported_wheelsct|}|D].}|jrt||||/g}t }t |j|D]_} ||||-#t$r&}||_ | |Yd}~Xd}~wwxYw|r||S)aResolve what operations need to be done As a side-effect of this method, the packages (and their dependencies) are downloaded, unpacked and prepared for installation. This preparation is done by ``pip.operations.prepare``. Once PyPI has static dependency metadata available, it would be possible to move the preparation to become a step separated from dependency resolution. )rXN) r constraintr_add_requirement_to_setrrall_requirementsextend _resolve_onerreqappend)rTrWrXrequirement_setr_discovered_reqs hash_errorsr7s r9resolvezResolver.resolves )@VWWW ? ?C~ 3-c222  ( (# > > > > 57 ll 9?KK ( (C (&&t'8'8#'N'NOOOO ( ( (""3'''''''' (   s*)B CB??Cra install_reqparent_req_nameextras_requestedc ||s*td|j|jgdfS|jrk|jjr_t|jj}tj }|j r,| |st|jd|jr | Jd|js|||gdfS ||j}n#t"$rd}YnwxYw|duoA|o?|j o7|j|jko'|jo |jo|jj|jjk}|rtd|d|d|jd|s|||g|fS|js|jsg|fS|jo!|jo|jj|jjk } | rtd |jd d |_|jrd |_t1t3t5|jt5|jz|_td ||j|g|fS)a&Add install_req as a requirement to install. :param parent_req_name: The name of the requirement that needed this added. The name is used because when multiple unnamed requirements resolve to the same name, we could otherwise end up with dependency links that point outside the Requirements set. parent_req must already be added. Note that None implies that this is a user supplied requirement, vs an inferred one. :param extras_requested: an iterable of extras used to evaluate the environment markers. :return: Additional requirements to scan. That is either [] if the requirement is not applicable, or [install_req] if the requirement is applicable and has just been added. z6Ignoring %s: markers '%s' don't match your environmentNz+ is not a supported wheel on this platform.z+a user supplied req shouldn't have a parentzDouble requirement given: z (already in z, name=)z#Could not satisfy constraints for 'zC': installation from path or url cannot be constrained to a versionFTzSetting %s extras to: %s) match_markersr/infonamemarkerslinkis_wheelrfilenamerr rX supportedr user_suppliedadd_unnamed_requirementget_requirementKeyErrorrZextrasr_ specifieradd_named_requirementpathtuplesortedsetr4) rTrarerfrgwheeltags existing_reqhas_conflicting_requirementdoes_not_satisfy_constraints r9r[z Resolver._add_requirement_to_setsb,(()9::  KKH #    t8O    0 9 +*344E%355D5 eood>S>S '~RRR ) 9-<-D-D 8.E-D D  '  3 3K @ @ @=$& & // 0@AA L   LLL  t # H H ++ H#{'99 H  H   H  *ko.GG $ ' #J[JJ+JJ4?4DJJJ  .  1 1+ > > >=+- -  ! $)@ $|# #&1&6'   Q+"2"7<;L;Q"Q< # ' #+k6F+++ #(   $ .)-L &# 3|*++c+2D.E.EE F F    &      ~|++s'D DDr_cl|jdkrdS|jdkrdS|jdksJ|jp|jS)Nr?Fr=Tr>)rHrrrZrTr_s r9_is_upgrade_allowedzResolver._is_upgrade_allowed2sN  $5 5 55  "g - -4(,<<<<<$6 6rVcZ|jJ|jr |jjrd|_d|_dS)z4 Set a requirement to be installed. NT) satisfied_byrD in_usersiteshould_reinstallrs r9_set_req_to_reinstallzResolver._set_req_to_reinstall;sA +++! (S%5%A (#'C rVreq_to_installc|jrdS||j|jsdS|jr||dS||s|jdkrdSdS|js: |j |dn#t$rYdSt$rYnwxYw||dS)aCheck if req_to_install should be skipped. This will check if the req is installed, and whether we should upgrade or reinstall it, taking into account all the relevant user options. After calling this req_to_install will only have satisfied_by set to None if the req_to_install is to be upgraded/reinstalled etc. Any other value will be a dist recording the current thing installed that satisfies the requirement. Note that for vcs urls and the like we can't assess skipping in this routine - we simply identify that we need to pull the thing down, then later on it is pulled down and introspected to assess upgrade/ reinstalls etc. :return: A text reason for why it was skipped, or None. Nr>z#already satisfied, skipping upgradezalready satisfiedT)upgradezalready up-to-date) rFcheck_if_existsrDrrGrrrHrnrAfind_requirementrr)rTrs r9_check_skip_installedzResolver._check_skip_installedFs(   4&&t'9:::* 4     & &~ 6 6 64''77 '$(888<<&& "   ,,^T,JJJJ. , , ,+++'      "">222ts7B B-! B-,B-c||}|j||}|sdS|j}|jr+|jpd}d|d|}t ||S)Nz zDThe candidate selected for download or install is a yanked version: z Reason for being yanked: )rrArrn is_yanked yanked_reasonr/r0)rTr_rbest_candidaternreasonmsgs r9_find_requirement_linkzResolver._find_requirement_link|s**3//55c7CC 4" > '9>F 5#155,255  NN3    rVc|j|||_|j |jjrdS|j Jd|j|j|jt}|t d|j|j|j ur|j r |j|_ |j |j |_n t|j|j |_|j|_dSdS)afEnsure that if a link can be found for this, that it is found. Note that req.link may still be None - if the requirement is already installed and not needed to be upgraded based on the return value of _is_upgrade_allowed(). If preparer.require_hashes is True, don't use the wheel cache, because cached wheels, always built locally, have different hashes than the files downloaded from the index server and thus throw false hash mismatches. Furthermore, cached wheels at present have undeterministic contents due to file modification times. Nz1_find_requirement_link unexpectedly returned None)rn package_namesupported_tagszUsing cached wheel link: %s)link_is_in_wheel_cache)rnrrBr@require_hashesget_cache_entryrlr r/r4 original_link persistentcached_wheel_source_linkorigin download_infor!)rTr_ cache_entrys r9_populate_linkzResolver._populate_links 8 22377CH   #t}'C # Fx##%X###&66(??7   " LL6 8H I I Ix3,,,1G,/2x,!-$/$6!!%9H[5K%%%!#'CHHH # "rVc.|jr|j|S|jJ||}|jr|j||S|||j|}|js| |j |jr\|j dkp|j p|jp|j jdk}|r||nt d||S)zzTakes a InstallRequirement and returns a single AbstractDist representing a prepared variant of the same. Nr?filez>sKPP P C   }77<<$ 4    2 3 3 3   %)::-'-(-8?f,   **3//// R rVc jsjrgSd_}t|jjg dt dttddf fd }t5j J j s!j sJ djsjr3t d d jt't)jt)|z }|D])}t d |j|j|*t't)|t)jz}||D]}||| dddn #1swxYwY S) zxPrepare a single requirements file. :return: A list of additional InstallRequirements to also install. T)r&r'subreqrgr(Nc t|}j} |||\}}|r"|r j|||dS)N)rfrg)rQr+rlr[rSr`r]) rrgsub_install_reqrf to_scan_again add_to_parent more_reqsrrarTs r9add_reqz&Resolver._resolve_one..add_reqs#44S[[.QQO,1O+/+G+G /!1 ,H,, (M=  U= U-o>EEmTTT   ] + + + + +rV)rfz!Installing extra requirements: %r,z%%s %s does not provide the extra '%s')rg)rZpreparedrr:rPr'r rr+r"rlhas_requirementrrr[rErvr/r4r2r{r|iter_provided_extrasr0r1r8iter_dependencies) rTrarr%rmissing_requestedmissingavailable_requestedrrs ``` @r9r^zResolver._resolve_ones  $ (? I"&!!.11 $ .#'#>    /1  ,K ,8C= ,T , , , , , , , , , \\" J" J"&222"22>3FGG &3333,,#^T-+ J!(LL;!677%+-..T5N5N5P5P1Q1QQ%%! 1GNN?   '-113344s>;P7Q7QQ''##445HIIJJFGF5HIIIIIE" J" J" J" J" J" J" J" J" J" J" J" J" J" J" JHsEG++G/2G/req_setcgtdtddffd |jD] }|S)zCreate the installation order. The installation order is topological - requirements are installed before the requiring thing. We break cycles at an arbitrary point, and make no other guarantees. r_r(Nc|js|vrdS|jrdS|j|jD] }||dSN)rrZaddrSrlr`)r_deporder ordered_reqsschedulerTs r9rz1Resolver.get_installation_order..scheduleIs 3,#6#6~    S ! ! !4SX>   LL     rV)r|r requirementsvalues)rTrrerrrs` @@@r9get_installation_orderzResolver.get_installation_order:s03  ,          #/6688 " "K H[ ! ! ! ! rVr)NN) __name__ __module__ __qualname____doc__rNrrrr rboolr+r intrMrrrrdrr[rrrrrrrrr^r __classcell__)rUs@r9r<r<msIHH6:$R$R%$R$Rj) $R 5 $R  $R"$R$R!%$R$R$R"%S/2$R $R$R$R$R$R$RL#01#KO# ####R*.48 q,q,'q,(q,"# q, #8C=1 q, t&'2D)EE F q,q,q,q,f7'97d7777  );       404 #4444l*<$,%("4%(%(%(%(%(N,!3,8H,,,,\Q'Q+Q  ! QQQQf%  !rVr<)F)CrloggingrO collectionsr itertoolsrtypingrrrrr r pip._vendor.packagingr "pip._vendor.packaging.requirementsr pip._internal.cacher pip._internal.exceptionsrrrrrrr"pip._internal.index.package_finderrpip._internal.metadatarpip._internal.models.linkrpip._internal.models.wheelr pip._internal.operations.preparerpip._internal.req.req_installrrpip._internal.req.req_setrpip._internal.resolution.baserrpip._internal.utilsr&pip._internal.utils.compatibility_tagsr &pip._internal.utils.direct_url_helpersr!pip._internal.utils.loggingr"pip._internal.utils.miscr#pip._internal.utils.packagingr$ getLoggerrr/r+DiscoveredDependenciesrrr:r<rVr9rs   ######DDDDDDDDDDDDDDDD,,,,,,::::::******=<<<<<333333******,,,,,,@@@@@@544444RRRRRRRR222222@@@@@@GGGGGG222222;;;;;;??????  8 $ $$Xc]D9K4L%LM $)33 3S# &3!3 3333lhhhhh|hhhhhrV