\h] 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/ddl0m1Z1ddl2m3Z3ddl4m5Z5ddl6m7Z7ddl8m9Z9ejte;Z ddede e?e?e?fde@ddfdZAGdde,ZBy) 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_pythondist version_infoignore_requires_pythonreturnc t|j} t ||}|rydjtt|}|r#tjd|j||ytdj|j||#t$r}t|t|d}~wwxYw#t j $r+}tjd|j|Yd}~yd}~wwxYw)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 k/root/niggaflix-v3/playground/venv/lib/python3.12/site-packages/pip/_internal/resolution/legacy/resolver.py_check_dist_requires_pythonr;:s(.d223 - % hhs3 -.G P MM     "BII MM7O  5 .c!f--.  & & ;T]]C   s.B B8 B5B00B58C6 !C11C6cveZdZdZhdZ 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 Ft || |jvsJ| tjdd} n t | } | |_||_||_||_ | |_ | |_ ||_ ||_ ||_||_||_t#t$|_y)N)super__init___allowed_strategiessysr&r#_py_version_inforArBrCrIrHrFrGr'rE_make_install_reqrlist_discovered_dependencies) selfrArBrCrDrErFrGr'rHrIrJ __class__s r:rNzResolver.__init__xs 4#;#;;;;  "!..r2O4_EO /   & 0.#6 0&<#*!1@KD@Q% root_reqscheck_supported_wheelsctt|}|D]+}|jr t||j||-g}t }t |j |D]$} |j|j||&|r||S#t$r"}||_ |j|Yd}~Sd}~wwxYw)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. )rYN) r constraintr_add_requirement_to_setrrall_requirementsextend _resolve_onerreqappend)rUrXrYrequirement_setr`discovered_reqs hash_errorsr8s r:resolvezResolver.resolves)@VW ?C~~-c2  ( (# > ?57 l 99?K (C (&&t'8'8#'NO (   (""3'' (s#!B  B7B22B7rb install_reqparent_req_nameextras_requestedc|j|s/tjd|j|jgdfS|j r~|j j rht|j j}tj}|jr)|j|st|jd|jr |Jd|js|j||gdfS |j!|j}|duxrw|xrs|j$ xrd|j&|j&k(xrI|j(xr;|j(xr-|j(j*|j(j*k7}|r&tdj-|||j|s|j/||g|fS|j$s |j$sg|fS|j xr<|j xr-|j j0|j j0k( } | rtd|jdd|_|jrd |_t3t5t7|j&t7|j&z|_tj9d ||j&|g|fS#t"$rd}YwxYw) 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 parentz7Double requirement given: {} (already in {}, name={!r})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 rY supportedr user_suppliedadd_unnamed_requirementget_requirementKeyErrorr[extrasr` specifierr5add_named_requirementpathtuplesortedsetr4) rUrbrfrgrhwheeltags existing_reqhas_conflicting_requirementdoes_not_satisfy_constraints r:r\z Resolver._add_requirement_to_sets,(()9: KKH  ##  t8O    0 0 9 9+**334E%335D55eood>S'~~&&QR ))_-D 9 8 9 D   3 3K @=$& &  // 0@0@A  t # H H +++ H##{'9'99 H   H   H   **koo.G.GG $ '#IPP{/?/?   1 1+ >=+- -  ! !)@)@|# #&1&6&6'    Q+"2"2"7"7<;L;L;Q;Q"Q< # '#5k6F6F5GH++ #(   $ $)-L &# 3|**+c+2D2D.EE F   &     ~|++s L sK K-,K-r`c|jdk(ry|jdk(ry|jdk(sJ|jxs |jS)Nr@Fr>Tr?)rIrrr[rUr`s r:_is_upgrade_allowedzResolver._is_upgrade_allowed7sO  $5 5  " "g -((,<< <<$$6 6rWcd|jr|jjrd|_d|_y)z4 Set a requirement to be installed. TN)rE satisfied_by in_usersiteshould_reinstallrs r:_set_req_to_reinstallzResolver._set_req_to_reinstall@s+ !!S%5%5%A%A#'C rWreq_to_installc|jry|j|j|jsy|jr|j |y|j |s|jdk(ryy|js |jj|d|j |y#t$rYyt$rY'wxYw)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) rGcheck_if_existsrErrHrrrIrnrBfind_requirementrr)rUrs r:_check_skip_installedzResolver._check_skip_installedJs(  &&t'9'9:**     & &~ 6''7$$(88<& ""  ,,^T,J "">2/ ,+'   sB22 C=CCc|j|}|jj||}|sy|j}|jr-|j xsd}d|d|}t j||S)Nz zDThe candidate selected for download or install is a yanked version: z Reason for being yanked: )rrBrrn is_yanked yanked_reasonr/r0)rUr`rbest_candidaternreasonmsgs r:_find_requirement_linkzResolver._find_requirement_links**3/55c7C"" >>''9>F ##1"23,,285  NN3  rWc\|j|j||_|j|jjry|jj |j|j t}|tjd|j|j|jur|jr|j|_ |j|j|_n&t|j|j|_|j|_yy)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)rn package_namesupported_tagszUsing cached wheel link: %s)link_is_in_wheel_cache)rnrrCrArequire_hashesget_cache_entryrlr r/r4 original_link persistentcached_wheel_source_linkorigin download_infor!)rUr` cache_entrys r:_populate_linkzResolver._populate_links 88 2237CH    #t}}'C'C &&66(?7  " LL6 8H8H Ixx3,,,1G1G/2xx,!!-$/$6$6!%9HH[5K5K%!#''CH #rWc|jr|jj|S|jJ|j |}|jr|jj ||S|j ||jj|}|js|j|j|jrq|jdk7xs5|jxs'|jxs|jjdk(}|r|j||St j#d||S)zzTakes a InstallRequirement and returns a single AbstractDist representing a prepared variant of the same. r@filez>sKP P C }}77<$$    2 2 3   %%)::-''-((-88??f,  **3/   R rWc js jrgSd_j}t|jj g dt dttddf fd }t5jjs"jsJjdjsjr/t j#d d j%jt't)jt)|j+z }|D].}t j-d |j.|j0|0t't)|j+t)jz}|j3|D] }||| ddd S#1swY SxYw) zxPrepare a single requirements file. :return: A list of additional InstallRequirements to also install. T)r&r'subreqrhr(Nc jt|}j} j|||\}}|r |r j|j |j |y)N)rgrh)rRr+rlr\rTrar^) rrhsub_install_reqrg to_scan_again add_to_parent more_reqsrrbrUs r:add_reqz&Resolver._resolve_one..add_reqs{#44S[.QO,11O+/+G+G /!1 ,H, (M= =--o>EEmT   ] +rW)rgz!Installing extra requirements: %r,z%%s %s does not provide the extra '%s')rh)r[preparedrr;rQr'r rr+r"has_requirementrlrrr\rFrvr/r4r2r{r|iter_provided_extrasr0r1r9iter_dependencies) rUrbrr%rmissing_requestedmissingavailable_requestedrrs ``` @r:r_zResolver._resolve_ones  $ $(?(?I"&!!.1 $ ..#'#>#> /1  ,K ,8C= ,T , , \! J#22>3F3FG&3333,,#^T-++!((LL;!6!67%+--.T5N5N5P1QQ%! 1GNN?   '-1134s>;P;P7QQ'##445HIJFF5HIJA! JFG! JFs EGGreq_setcgtdtddffd |jjD] }| 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|vry|jryj|j|jD] }| j |yN)rr[addrTrlra)r`deporder ordered_reqsschedulerUs r:rz1Resolver.get_installation_order..scheduleJs_3,#6~~   S !44SXX>    LL rW)r|r requirementsvalues)rUrrfrrrs` @@@r:get_installation_orderzResolver.get_installation_order;sW03  ,   #//668 "K [ ! " rWr)NN) __name__ __module__ __qualname____doc__rOrrrr rboolr+r intrNrrrrerr\rrrrrrrrr_r __classcell__)rVs@r:r=r=qsI6:$R%$R$Rj) $R 5 $R  $R"$R$R!%$R$R$R"%S/2$R $RL#01#KO# #R*.48 r,'r,(r,"# r, #8C=1 r, t&'2D)EE F r,h7'97d7 );  404 #4l*<$,#("4#(#(J,!3,8H,\P'P+P  ! Pd%  !rWr=)F)CrloggingrP 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=rWr:rs  #DD,:*=3*,@5R2@G2;?   8 $$S$/A*B%BC $)4 4S# &4!4 4ne|erW