U n a@sddlZddlZddlmZddlmZddlmZmZddlm Z ddl m Z ddl mZddlmZdd lmZdd lmZd d lmZerdd lmZmZmZmZddlmZddlmZddl m!Z!ddl"m#Z#ddl$m%Z%ddlm&Z&e'e(Z)GdddeZ ddZ*dS)N)sixcanonicalize_name) BaseReporterResolutionImpossible)Resolver)InstallationError)RequirementSet) BaseResolver) PipProvider)MYPY_CHECK_RUNNING)Factory)DictListOptionalTuple)Result) WheelCache) PackageFinder)RequirementPreparer)InstallRequirement)InstallRequirementProvidercs.eZdZdfdd ZddZddZZS) rNc s6tt|t|||| ||| d|_||_d|_dS)N)finderpreparermake_install_reqforce_reinstallignore_installedignore_requires_pythonpy_version_info)superr__init__rfactoryignore_dependencies_result) selfrr wheel_cacher use_user_siter#rrrupgrade_strategyr __class__mC:\Users\vtejo\AppData\Local\Temp\pip-unpacked-wheel-6mt8ur68\pip\_internal\resolution\resolvelib\resolver.pyr!!s zResolver.__init__c sHtdd|Drtdtjjd}t}t||}fdd|D}z||_Wnt k r}zzj |}|s|j D]2\} } t dt| | dkrdn d | jqtd d d d|j Dt||W5d}~XYnXt|d } jjD]6} || } | dkr(q j| | _| | q | S)Ncss|] }|jVqdSN) constraint.0rr+r+r, @sz#Resolver.resolve..z"Constraints are not yet supported.)r"r#csg|]}j|qSr+)r"Z!make_requirement_from_install_reqr/r%r+r, Jsz$Resolver.resolve..z8Could not find a version that satisfies the requirement z (from {})z#No matching distribution found for z, cSsg|]\}}|jqSr+)name)r0r1_r+r+r,r4ds)check_supported_wheels)anyrr r"r#r RLResolverresolver$rZget_installation_errorZcausesloggercriticalstrformatr6joinr raise_fromr mappingvaluesZget_install_requirementshould_reinstalladd_named_requirement)r% root_reqsr8ZproviderZreporterresolver requirementseerrorreqparentreq_set candidateireqr+r3r,r;<sR      zResolver.resolvec s|jdk stdi|jj}t|jjd}t|krd}|D]d}|krPqBt||}tfdd|DsvqB|rtfdd|Dd}nd}||<d }qB|s.t d q.t |j t jtd d d }d d|DS)aCreate a list that orders given requirements for installation. The returned list should contain all requirements in ``req_set``, so the caller can loop through it and have a requirement installed before the requiring thing. The current implementation walks the resolved dependency graph, and make sure every node has a greater "weight" than all its parents. Nzmust call resolve() firstr Fc3s|]}|kVqdSr-r+r0pweightsr+r,r2sz2Resolver.get_installation_order..c3s|]}|VqdSr-r+rPrRr+r,r2srTzACould not determine installation order due to cicular dependency.rR)keyreversecSsg|] \}}|qSr+r+)r0r7rOr+r+r,r4sz3Resolver.get_installation_order..)r$AssertionErrorgraphlenrBlistZ iter_parentsallmaxrsortedrHitems functoolspartial_req_set_item_sorter) r%rMrWZ key_countZ progressedrTparentsZweightZ sorted_itemsr+rRr,get_installation_orderss6   zResolver.get_installation_order)N)__name__ __module__ __qualname__r!r;rb __classcell__r+r+r)r,r s 7rcCst|d}|||fS)a)Key function used to sort install requirements for installation. Based on the "weight" mapping calculated in ``get_installation_order()``. The canonical package name is returned as the second member as a tie- breaker to ensure the result is predictable, which is useful in tests. rr)itemrSr6r+r+r,r`s r`)+r^logging pip._vendorrpip._vendor.packaging.utilsrZpip._vendor.resolvelibrrrr:pip._internal.exceptionsrZpip._internal.req.req_setr pip._internal.resolution.baser Z,pip._internal.resolution.resolvelib.providerr pip._internal.utils.typingr r"rtypingrrrrZ pip._vendor.resolvelib.resolversrpip._internal.cacher"pip._internal.index.package_finderr pip._internal.operations.preparerZpip._internal.req.req_installrr getLoggerrcr<r`r+r+r+r,s.