ReH dZddlZddlZddlmZddlmZddlmZm Z m Z m Z m Z m Z ddlmZddlmZddlmZdd lmZmZmZmZmZmZdd lmZdd lmZdd lm Z dd l!m"Z"ddl#m$Z$m%Z%ddl&m'Z'ddl(m)Z)m*Z*ddl+m,Z,ddl-m.Z.ddl/m0Z0m1Z1ddl/m2Z2ddl3m4Z4ej5e6Z7ee8e e$fZ9 ddede e:e:e:fde;ddfdZ<Gdde)Z=dS)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 HashErrorsNoneMetadataErrorUnsupportedPythonVersion) PackageFinder)BaseDistribution)Link)RequirementPreparer)InstallRequirementcheck_invalid_constraint_type)RequirementSet) BaseResolverInstallRequirementProvider) get_supported) indent_log)dist_in_usersitenormalize_version_info)dist_in_install_path)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 ||)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 %rz8Package {!r} requires a different Python: {} not in {!r})strrequires_pythonFileNotFoundErrorrr"r InvalidSpecifierloggerwarningraw_namejoinmapdebugrformat)r#r$r%r*e is_compatibleexcversions /builddir/build/BUILDROOT/alt-python311-pip-21.3.1-3.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_internal/resolution/legacy/resolver.py_check_dist_requires_pythonr97sL(.d233 ...c!ff---. - %     & ;T]C      hhs3 --..G P M       "BII M7O    s* A>AAB(!BBc\eZdZdZhdZ d!dededeede de d e d e d e d e d e dee e dfddffd Zdeede defdZdede fdZdeddfdZdedee fdZdedeefdZdeddfdZdedefdZdededeefdZdedeefd 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?r@rArGrFrDrEr%rC_make_install_reqrlist_discovered_dependencies) selfr?r@rArBrCrDrEr%rFrGrH __class__s r8rLzResolver.__init__us 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. )rWN) r constraintradd_requirementrrall_requirementsextend _resolve_onerreqappend)rSrVrWrequirement_setr^discovered_reqs hash_errorsr6s r8resolvezResolver.resolves )@VWWW 1 1C~ 3-c222  + +C 0 0 0 0 57 ll 9?KK ( (C (&&t'8'8#'N'NOOOO ( ( (""3'''''''' (   s))B CB>>Cr^cl|jdkrdS|jdkrdS|jdksJ|jp|jS)Nr>Fr<Tr=)rG user_suppliedrYrSr^s r8_is_upgrade_allowedzResolver._is_upgrade_allowedsN  $5 5 55  "g - -4(,<<<<<$6 6rUc|jrt|jrt|jrd|_d|_dS)z4 Set a requirement to be installed. TN)rCr satisfied_byr!should_reinstallrfs r8_set_req_to_reinstallzResolver._set_req_to_reinstallsM # (#C$455 (()9:: ($(C rUreq_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) rEcheck_if_existsrCrirFrkrgrGlinkr@find_requirementrr)rSrls r8_check_skip_installedzResolver._check_skip_installeds(   4&&t'9:::* 4     & &~ 6 6 64''77 '$(888<<&& "   ,,^T,JJJJ. , , ,+++'      "">222ts7B B-! B-,B-c||}|j||}|sdS|j}|jr:|jpd}d||}t||S)Nz zqThe candidate selected for download or install is a yanked version: {candidate} Reason for being yanked: {reason}) candidatereason) rgr@rqrp is_yanked yanked_reasonr3r-r.)rSr^rnbest_candidaterprumsgs r8_find_requirement_linkzResolver._find_requirement_link s**3//55c7CC 4" > '9>F 4f~ff==  NN3    rUcp|j|||_|j |jjrdS|j|j|jt}|Jt d|j|j|j ur|j rd|_ |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. N)rp package_namesupported_tagszUsing cached wheel link: %sT) rprzrAr?require_hashesget_cache_entrynamerr-r2 original_link persistentoriginal_link_is_in_wheel_cache)rSr^ cache_entrys r8_populate_linkzResolver._populate_link!s 8 22377CH   #t}'C # F&66(??7   " LL6 8H I I Ix3,,,1G,6:3"'CHHH # "rUc.|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>filezsE < C===cBB B'''0055   Q=>>sKPP P C   }77<<$ 4    2 3 3 3   %)::-'-(-8?f,   **3//// R rUr`c jsjrgSd_}t|jjg dt dttddf fd }t5 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%subreqextras_requestedr&Nc t|}j}|||\}}|r"|r j|||dS)N)parent_req_namer)rPr)rrZrRr_r\) rrsub_install_reqr to_scan_again add_to_parent more_reqsrlr`rSs r8add_reqz&Resolver._resolve_one..add_reqs#44S[[.QQO,1O+:+J+J /!1,K,, (M=  U= U-o>EEmTTT   ] + + + + +rU)rz!Installing extra requirements: %r,z%%s %s does not provide the extra '%s')r)rYpreparedrr9rOr%r rr)rhas_requirementrrerZrDextrasr-r2r0sortedsetiter_provided_extrasr.r/r7iter_dependencies) rSr`rlr#rmissing_requestedmissingavailable_requestedrrs ``` @r8r]zResolver._resolve_onels  $ (? I"&!!.11 $ .#'#>    /1  ,K ,8C= ,T , , , , , , , , ,\\ J J#22>3FGG V&3333//PT/UUU+ J!(LL;!677%+-..T5N5N5P5P1Q1QQ%%! 1GNN?   '-113344s>;P7Q7QQ''##445HIIJJFGF5HIIIII? J J J J J J J J J J J J J J JBsEG!!G%(G%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)rirYaddrRrr_)r^deporder ordered_reqsschedulerSs r8rz1Resolver.get_installation_order..schedules 3,#6#6~    S ! ! !4SX>   LL     rU)rr requirementsvalues)rSr install_reqrrrs` @@@r8get_installation_orderzResolver.get_installation_orders03  ,          #/6688 " "K H[ ! ! ! ! rUr)__name__ __module__ __qualname____doc__rMrrrr rboolr)r intrLrrrrcrgrkrrrrzrrrr]r __classcell__)rTs@r8r;r;nsuIHH6:$R$R%$R$Rj) $R 5 $R  $R"$R$R!%$R$R$R"%S/2$R $R$R$R$R$R$RL#01#KO# ####J7'97d7777  );       404 #4444l*<$,("4(((((:,!3,8H,,,,\M'M+M  ! MMMM^%  !rUr;)F)>rloggingrN collectionsr itertoolsrtypingrrrrr r pip._vendor.packagingr "pip._vendor.packaging.requirementsr pip._internal.cacher pip._internal.exceptionsrrrrrr"pip._internal.index.package_finderrpip._internal.metadatarpip._internal.models.linkr pip._internal.operations.preparerpip._internal.req.req_installrrpip._internal.req.req_setrpip._internal.resolution.baserr&pip._internal.utils.compatibility_tagsrpip._internal.utils.loggingrpip._internal.utils.miscrr r!pip._internal.utils.packagingr" getLoggerrr-r)DiscoveredDependenciesrrr9r;rUr8rs   ######DDDDDDDDDDDDDDDD,,,,,,::::::******=<<<<<333333******@@@@@@544444RRRRRRRR@@@@@@222222MMMMMMMM999999??????  8 $ $$S$/A*B%BC $)44 4S# &4!4 4444nhhhhh|hhhhhrU