ó vÆ_c@s dZddlZddlZddlmZddlmZddlmZddl m Z m Z m Z m Z mZddlmZddlmZdd lmZdd lmZdd lmZdd lmZmZdd lmZddlmZmZddl m!Z!e!r×ddl"m#Z#m$Z$m%Z%m&Z&m'Z'ddl(m)Z)ddl*m+Z+ddl,m-Z-ddl.m/Z/ddl0m1Z1ddl2m3Z3ddlm4Z4ddlm5Z5e#e6e$e4fZ7nej8e9ƒZ:e;d„Z<defd„ƒYZ=dS(syDependency 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) iÿÿÿÿN(t defaultdict(tchain(t specifiers(tBestVersionAlreadyInstalledtDistributionNotFoundt HashErrort HashErrorstUnsupportedPythonVersion(tcheck_invalid_constraint_type(tRequirementSet(t BaseResolver(t get_supported(t indent_log(tdist_in_usersitetnormalize_version_info(tdist_in_install_path(tcheck_requires_pythontget_requires_python(tMYPY_CHECK_RUNNING(t DefaultDicttListtOptionaltSettTuple(t pkg_resources(t WheelCache(tAbstractDistribution(t PackageFinder(tLink(tRequirementPreparer(tInstallRequirement(tInstallRequirementProvidercCs¹t|ƒ}yt|d|ƒ}Wn-tjk rQ}tjd|j|ƒdSX|r\dSdjtt |ƒƒ}|r—tj d|j||ƒdSt dj |j||ƒƒ‚dS(sÇ 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. t version_infos-Package %r has an invalid Requires-Python: %sNt.sBIgnoring failed Requires-Python check for package %r: %s not in %rs8Package {!r} requires a different Python: {} not in {!r}( RRRtInvalidSpecifiertloggertwarningt project_nametjointmaptstrtdebugRtformat(tdistR tignore_requires_pythontrequires_pythont is_compatibletexctversion((sY/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.pyt_check_dist_requires_python=s(  tResolvercBszeZdZdddhZdd„Zd„Zd„Zd„Zd„Z d „Z d „Z d „Z d „Z d „ZRS(s–Resolves which packages need to be installed/uninstalled to perform the requested operation without breaking the requirements of any package. teagersonly-if-neededsto-satisfy-onlyc CsÆtt|ƒjƒ| |jks(t‚| dkrDtjd } n t| ƒ} | |_ ||_ ||_ ||_ | |_ | |_||_||_||_||_||_ttƒ|_dS(Ni(tsuperR2t__init__t_allowed_strategiestAssertionErrortNonetsysR Rt_py_version_infotpreparertfindert wheel_cachetupgrade_strategytforce_reinstalltignore_dependenciestignore_installedR,t use_user_sitet_make_install_reqRtlistt_discovered_dependencies( tselfR;R<R=tmake_install_reqRBR@RAR,R?R>tpy_version_info((sY/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.pyR5ts"             cCsËtd|ƒ}x1|D])}|jr2t|ƒn|j|ƒqWg}tƒ}xct|j|ƒD]O}y|j|j||ƒƒWqet k r³}||_ |j |ƒqeXqeW|rÇ|‚n|S(s±Resolve 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. tcheck_supported_wheels( R t constraintRtadd_requirementRRtall_requirementstextendt _resolve_oneRtreqtappend(RFt root_reqsRItrequirement_setROtdiscovered_reqst hash_errorsR/((sY/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.pytresolveœs"        cCsO|jdkrtS|jdkr&tS|jdks;t‚|jpJ|jSdS(Nsto-satisfy-onlyR3sonly-if-needed(R>tFalsetTrueR7t user_suppliedRJ(RFRO((sY/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.pyt_is_upgrade_allowedÂs cCsA|j st|jƒr4t|jƒr4t|_nd|_dS(s4 Set a requirement to be installed. N(RBR t satisfied_byRRWtshould_reinstallR8(RFRO((sY/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.pyt_set_req_to_reinstallÌs   cCsÆ|jr dS|j|jƒ|js*dS|jrD|j|ƒdS|j|ƒsj|jdkrfdSdS|j sµy|j j |dt ƒWqµt k r¡dStk r±qµXn|j|ƒdS(sCheck 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. sonly-if-neededs#already satisfied, skipping upgradesalready satisfiedtupgradesalready up-to-dateN(RAR8tcheck_if_existsRBRZR?R\RYR>tlinkR<tfind_requirementRWRR(RFtreq_to_install((sY/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.pyt_check_skip_installedÙs*        cCs{|j|ƒ}|jj||ƒ}|s.dS|j}|jrw|jpLd}djd|d|ƒ}tj |ƒn|S(Ns uqThe candidate selected for download or install is a yanked version: {candidate} Reason for being yanked: {reason}t candidatetreason( RYR<R`R8R_t is_yankedt yanked_reasonR*R#R$(RFROR]tbest_candidateR_Rdtmsg((sY/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.pyt_find_requirement_links   cCsÆ|jdkr$|j|ƒ|_n|jdks?|jjrCdS|jjd|jd|jdtƒƒ}|dk rÂt j d|jƒ|j|j kr³|j r³t |_n|j|_ndS(sfEnsure 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. NR_t package_nametsupported_tagssUsing cached wheel link: %s(R_R8RiR=R;trequire_hashestget_cache_entrytnameR R#R)t original_linkt persistentRWtoriginal_link_is_in_wheel_cache(RFROt cache_entry((sY/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.pyt_populate_link%s      cCsý|jr|jj|ƒS|jdks.t‚|j|ƒ}|jrY|jj||ƒS|j|ƒ|jj |ƒ}|j s”|j |j ƒn|jrù|j dkpÍ|jpÍ|j pÍ|jjdk}|ræ|j|ƒqùtjd|ƒn|S(szTakes a InstallRequirement and returns a single AbstractDist representing a prepared variant of the same. sto-satisfy-onlytfiles<Requirement already satisfied (use --upgrade to upgrade): %sN(teditableR;tprepare_editable_requirementRZR8R7Rbtprepare_installed_requirementRstprepare_linked_requirementRAR^RBR>R?R_tschemeR\R#tinfo(RFROt skip_reasont abstract_distt should_modify((sY/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.pyt_get_abstract_dist_forCs,          c s¥ˆjsˆjrgStˆ_ˆjˆƒ}|jƒ}t|dˆjdˆjƒg‰‡‡‡‡fd†}tƒ"ˆj ˆj ƒsµˆj sŸt ‚ˆj ˆdd ƒnˆjs{ˆjrætjddjˆjƒƒnttˆjƒt|jƒƒ}x!|D]}tjd||ƒqWtt|jƒtˆjƒ@ƒ}x*|j|ƒD]} || d|ƒq^Wnˆj r›ˆj r›tˆ_nWd QXˆS( sxPrepare a single requirements file. :return: A list of additional InstallRequirements to also install. R R,csvˆjt|ƒˆƒ}ˆj}ˆj|d|d|ƒ\}}|re|reˆj|j|ƒnˆj|ƒdS(Ntparent_req_nametextras_requested(RCR(RnRKRERPRM(tsubreqR€tsub_install_reqRt to_scan_againt add_to_parent(t more_reqsRaRRRF(sY/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.pytadd_req”s      Rs!Installing extra requirements: %rt,s"%s does not provide the extra '%s'R€N(RJtpreparedRWR~tget_pkg_resources_distributionR1R:R,R thas_requirementRnRXR7RKR8R@textrasR#R)R&tsortedtsetR$trequiresRuRZtsuccessfully_downloaded( RFRRRaR|R+R†tmissing_requestedtmissingtavailable_requestedR((R…RaRRRFsY/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.pyRNusB        csOg‰tƒ‰‡‡‡‡fd†‰x!|jjƒD]}ˆ|ƒq7WˆS(säCreate 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. csi|js|ˆkrdS|jr&dSˆj|ƒx"ˆj|jD]}ˆ|ƒqDWˆj|ƒdS(N(RZRJtaddRERnRP(ROtdep(tordert ordered_reqstscheduleRF(sY/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.pyR—Üs  (Rt requirementstvalues(RFtreq_sett install_req((R•R–R—RFsY/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.pytget_installation_orderÎs   N(t__name__t __module__t__doc__R6R8R5RURYR\RbRiRsR~RNRœ(((sY/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.pyR2ms  & 5   2 Y(>RŸtloggingR9t collectionsRt itertoolsRtpip._vendor.packagingRtpip._internal.exceptionsRRRRRtpip._internal.req.req_installRtpip._internal.req.req_setR tpip._internal.resolution.baseR t&pip._internal.utils.compatibility_tagsR tpip._internal.utils.loggingR tpip._internal.utils.miscR RRtpip._internal.utils.packagingRRtpip._internal.utils.typingRttypingRRRRRt pip._vendorRtpip._internal.cacheRtpip._internal.distributionsRt"pip._internal.index.package_finderRtpip._internal.models.linkRt pip._internal.operations.prepareRRRR(tDiscoveredDependenciest getLoggerRR#RVR1R2(((sY/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.pyt s:  (( -