U n aE;@sddlZddlZddlmZmZddlmZddlmZddl m Z m Z ddl m Z ddlmZddlmZdd lmZd d lmZmZerdd lmZmZmZmZmZmZdd lmZddlm Z ddl!m"Z"ddl#m$Z$d dlm%Z%d dl&m'Z'edZ(e)e*Z+ddZ,ddZ-ddZ.GdddeZ/Gddde/Z0Gddde/Z1Gd d!d!eZ2Gd"d#d#eZ3Gd$d%d%eZ4dS)&N)InvalidSpecifier SpecifierSet)canonicalize_name)Version)install_req_from_editableinstall_req_from_line)InstallRequirement)normalize_version_info)get_requires_python)MYPY_CHECK_RUNNING) Candidate format_name)AnyOptionalSequenceSetTupleUnion) _BaseVersion) Distribution)AbstractDistribution)Link) Requirement)Factory)AlreadyInstalledCandidateEditableCandidate LinkCandidatec Cs<|jrtdt|j|j|j|j|jt|j |j |j ddS)Nzparent is editableinstall_optionsglobal_optionshashes comes_from use_pep517isolated constraintoptions) editableAssertionErrorrurlr#r$r%r&dictrr hash_optionslinkparentr0oC:\Users\vtejo\AppData\Local\Temp\pip-unpacked-wheel-6mt8ur68\pip\_internal\resolution\resolvelib\candidates.pymake_install_req_from_link)sr2c Cs<|jstdt|j|j|j|j|jt|j |j |j ddS)Nzparent not editablerr") r(r)rr*r#r$r%r&r+rr r,r-r0r0r1make_install_req_from_editable:sr3c CsFtdt|j|j|j|j|j|jt |j |j |j dd}||_ |S)N{}=={}rr")rformatr project_nameparsed_versionr#r$r%r&r+rr r, satisfied_by)distr/ireqr0r0r1make_install_req_from_distKs"r;c@szeZdZdddZddZddZdd Zed d Zed d Z ddZ ddZ eddZ ddZ ddZddZdS)"_InstallRequirementBackedCandidateNcCs(||_||_||_||_||_d|_dSN)r._factory_ireq_name_version_dist)selfr.r:factorynameversionr0r0r1__init__as z+_InstallRequirementBackedCandidate.__init__cCsdj|jjt|jdS)Nz{class_name}({link!r})) class_namer.)r5 __class____name__strr.rCr0r0r1__repr__qsz+_InstallRequirementBackedCandidate.__repr__cCst||jr|j|jkSdSNF) isinstancerIr.rCotherr0r0r1__eq__xs  z)_InstallRequirementBackedCandidate.__eq__cCs || Sr=rRrPr0r0r1__ne__sz)_InstallRequirementBackedCandidate.__ne__cCs|jdkrt|jj|_|jS):The normalised name of the project the candidate refers toN)r@rr9r6rLr0r0r1rEs z'_InstallRequirementBackedCandidate.namecCs|jdkr|jj|_|jSr=)rAr9r7rLr0r0r1rFs  z*_InstallRequirementBackedCandidate.versioncCs tddS)NzOverride in subclass)NotImplementedErrorrLr0r0r1_prepare_abstract_distributionszA_InstallRequirementBackedCandidate._prepare_abstract_distributioncCs|jdk rdS|}||_|jdk s2td|jdksh|jt|jjkshtd|jt|jj|jdks|j|jj kstd|j|jj dS)NzDistribution already installedzName mismatch: {!r} vs {!r}zVersion mismatch: {!r} vs {!r}) rBrWget_pkg_resources_distributionr)r@rr6r5rAr7)rC abstract_distr0r0r1_prepares.     z+_InstallRequirementBackedCandidate._preparecCs||jSr=)rZrBrLr0r0r1r9sz'_InstallRequirementBackedCandidate.distc Cs`t|j}|dkrdSz t|}Wn8tk rZ}ztd|j|WYdSd}~XYnX|S)Nz-Package %r has an invalid Requires-Python: %s)r r9rrloggerwarningrE)rCrequires_pythonspecer0r0r1_get_requires_python_specifiers  zA_InstallRequirementBackedCandidate._get_requires_python_specifiercs:fddjD}j}|r6|||S)Ncs g|]}jt|jqSr0r>make_requirement_from_specrKr?.0rrLr0r1 szG_InstallRequirementBackedCandidate.get_dependencies..)r9requiresr>Z make_requires_python_requirementr`append)rCdepsZ python_depr0rLr1get_dependenciess  z3_InstallRequirementBackedCandidate.get_dependenciescCs||jSr=)rZr?rLr0r0r1get_install_requirementsz:_InstallRequirementBackedCandidate.get_install_requirement)NN)rJ __module__ __qualname__rGrMrRrTpropertyrErFrWrZr9r`rjrkr0r0r0r1r<`s"     r<cs&eZdZdfdd ZddZZS)rNcs$tt|j|t|||||ddSN)r.r:rDrErF)superrrGr2rCr.r/rDrErFrIr0r1rGs zLinkCandidate.__init__cCs|jj|jSr=)r>preparerprepare_linked_requirementr?rLr0r0r1rWsz,LinkCandidate._prepare_abstract_distribution)NNrJrlrmrGrW __classcell__r0r0rrr1rsrcs&eZdZdfdd ZddZZS)rNcs$tt|j|t|||||ddSro)rprrGr3rqrrr0r1rGs zEditableCandidate.__init__cCs|jj|jSr=)r>rsprepare_editable_requirementr?rLr0r0r1rWsz0EditableCandidate._prepare_abstract_distribution)NNrur0r0rrr1rsrc@sTeZdZddZddZddZddZed d Zed d Z d dZ ddZ dS)rcCs0||_t|||_||_d}|j|j|dS)Nzalready satisfied)r9r;r?r>rsprepare_installed_requirement)rCr9r/rD skip_reasonr0r0r1rG s  z"AlreadyInstalledCandidate.__init__cCsdj|jj|jdS)Nz{class_name}({distribution!r}))rH distribution)r5rIrJr9rLr0r0r1rMsz"AlreadyInstalledCandidate.__repr__cCs(t||jr$|j|jko"|j|jkSdSrN)rOrIrErFrPr0r0r1rR#s z AlreadyInstalledCandidate.__eq__cCs || Sr=rSrPr0r0r1rT*sz AlreadyInstalledCandidate.__ne__cCs t|jjSr=)rr9r6rLr0r0r1rE.szAlreadyInstalledCandidate.namecCs|jjSr=)r9r7rLr0r0r1rF3sz!AlreadyInstalledCandidate.versioncsfddjDS)Ncs g|]}jt|jqSr0rarcrLr0r1rf:sz>AlreadyInstalledCandidate.get_dependencies..)r9rgrLr0rLr1rj8s z*AlreadyInstalledCandidate.get_dependenciescCsdSr=r0rLr0r0r1rk?sz1AlreadyInstalledCandidate.get_install_requirementN) rJrlrmrGrMrRrTrnrErFrjrkr0r0r0r1r s  rc@sXeZdZdZddZddZddZdd Zed d Z ed d Z ddZ ddZ dS)ExtrasCandidateaA candidate that has 'extras', indicating additional dependencies. Requirements can be for a project with dependencies, something like foo[extra]. The extras don't affect the project/version being installed directly, but indicate that we need additional dependencies. We model that by having an artificial ExtrasCandidate that wraps the "base" candidate. The ExtrasCandidate differs from the base in the following ways: 1. It has a unique name, of the form foo[extra]. This causes the resolver to treat it as a separate node in the dependency graph. 2. When we're getting the candidate's dependencies, a) We specify that we want the extra dependencies as well. b) We add a dependency on the base candidate (matching the name and version). See below for why this is needed. 3. We return None for the underlying InstallRequirement, as the base candidate will provide it, and we don't want to end up with duplicates. The dependency on the base candidate is needed so that the resolver can't decide that it should recommend foo[extra1] version 1.0 and foo[extra2] version 2.0. Having those candidates depend on foo=1.0 and foo=2.0 respectively forces the resolver to recognise that this is a conflict. cCs||_||_dSr=)baseextras)rCr|r}r0r0r1rG\szExtrasCandidate.__init__cCsdj|jj|j|jdS)Nz.{class_name}(base={base!r}, extras={extras!r}))rHr|r})r5rIrJr|r}rLr0r0r1rMes zExtrasCandidate.__repr__cCs(t||jr$|j|jko"|j|jkSdSrN)rOrIr|r}rPr0r0r1rRms zExtrasCandidate.__eq__cCs || Sr=rSrPr0r0r1rTtszExtrasCandidate.__ne__cCst|jj|jS)rU)rr|rEr}rLr0r0r1rExszExtrasCandidate.namecCs|jjSr=)r|rFrLr0r0r1rF~szExtrasCandidate.versioncsjjjjjj}jjjj}|rJtdjd t |fddjj |D}d jjjj }||jj|S)Nz"Invalid extras specified in %s: %s,cs g|]}t|jjqSr0)rbrKr|r?rcrDrCr0r1rfsz4ExtrasCandidate.get_dependencies..r4)r|r>r} intersectionr9 differencer[r\rEjoinsortedrgr5rFrhrbr?)rCZ valid_extrasZinvalid_extrasrir^r0rr1rjs   z ExtrasCandidate.get_dependenciescCsdSr=r0rLr0r0r1rksz'ExtrasCandidate.get_install_requirementN) rJrlrm__doc__rGrMrRrTrnrErFrjrkr0r0r0r1r{Ds   r{c@s<eZdZddZeddZeddZddZd d Zd S) RequiresPythonCandidatecCs>|dk rt|}ntjdd}tddd|D|_dS)N.css|]}t|VqdSr=)rK)rdcr0r0r1 sz3RequiresPythonCandidate.__init__..)r sys version_inforrrA)rCpy_version_inforr0r0r1rGs z RequiresPythonCandidate.__init__cCsdS)Nzr0rLr0r0r1rEszRequiresPythonCandidate.namecCs|jSr=)rArLr0r0r1rFszRequiresPythonCandidate.versioncCsgSr=r0rLr0r0r1rjsz(RequiresPythonCandidate.get_dependenciescCsdSr=r0rLr0r0r1rksz/RequiresPythonCandidate.get_install_requirementN) rJrlrmrGrnrErFrjrkr0r0r0r1rs   r)5loggingrZ pip._vendor.packaging.specifiersrrpip._vendor.packaging.utilsrpip._vendor.packaging.versionrpip._internal.req.constructorsrrZpip._internal.req.req_installrpip._internal.utils.miscr pip._internal.utils.packagingr pip._internal.utils.typingr r|r rtypingrrrrrrrZpip._vendor.pkg_resourcesrpip._internal.distributionsrpip._internal.models.linkrrrDrZ BaseCandidate getLoggerrJr[r2r3r;r<rrrr{rr0r0r0r1s>              {;`