a [f@sddlZddlmZddlmZmZmZmZmZddl m Z ddl m Z ddl mZddlmZddlmZeeZGd d d ZdS) N) OrderedDict)DictIterableListOptionalTuple)canonicalize_name)InstallationError)Wheel)InstallRequirement)compatibility_tagsc@seZdZdeddddZedddZedd d Zedd d d Z edd ddZ dee ee e ee eee efdddZeedddZeedddZeeedddZdS)RequirementSetTN)check_supported_wheelsreturncCst|_||_g|_dS)zCreate a RequirementSet.N)r requirementsrunnamed_requirements)selfrr=/usr/lib/python3.9/site-packages/pip/_internal/req/req_set.py__init__szRequirementSet.__init__)rcCs4tdd|jDddd}ddd|DS)Ncss|]}|js|VqdSN)Z comes_from.0reqrrr z)RequirementSet.__str__..cSst|jp dSNrnamerrrrrz(RequirementSet.__str__..key css|]}t|jVqdSrstrrrrrrrr)sortedrvaluesjoin)rrrrr__str__s zRequirementSet.__str__cCsBt|jddd}d}|j|jjt|ddd|DdS) NcSst|jp dSrrr rrrr!"rz)RequirementSet.__repr__..r"z4<{classname} object; {count} requirement(s): {reqs}>z, css|]}t|jVqdSrr%rrrrr)rz*RequirementSet.__repr__..)Z classnamecountZreqs)r'rr(format __class____name__lenr))rr format_stringrrr__repr__szRequirementSet.__repr__) install_reqrcCs|jr J|j|dSr)rrappend)rr2rrradd_unnamed_requirement,s z&RequirementSet.add_unnamed_requirementcCs"|js Jt|j}||j|<dSr)rrr)rr2 project_namerrradd_named_requirement0s  z$RequirementSet.add_named_requirement)r2parent_req_nameextras_requestedrc Cs||s$td|j|jgdfS|jrf|jjrft|jj}t }|j rf| |sft d|j|jr||dus|Jd|js|||gdfSz||j}Wntyd}Yn0|duo|o|j o|j|jko|jo|jo|jj|jjk}|rt d|||j|s.|||g|fS|js>|jsFg|fS|jof|jod|jj|jjk }|r~t d|jd|_|jrd|_ttt|jt|jB|_td ||j|g|fS) 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})zhCould not satisfy constraints for '{}': installation from path or url cannot be constrained to a versionFTzSetting %s extras to: %s)Z match_markersloggerinforZmarkerslinkZis_wheelr filenamer Z get_supportedrZ supportedr r,Z user_suppliedr4get_requirementKeyError constraintextrasrZ specifierr6pathtupler'setdebug) rr2r7r8ZwheeltagsZ existing_reqZhas_conflicting_requirementZdoes_not_satisfy_constraintrrradd_requirement6s          zRequirementSet.add_requirement)rrcCs t|}||jvo|j|j Sr)rrr?rrr5rrrhas_requirements  zRequirementSet.has_requirementcCs.t|}||jvr|j|Std|dS)NzNo project with the name )rrr>rGrrrr=s  zRequirementSet.get_requirementcCs|jt|jSr)rlistrr()rrrrall_requirementsszRequirementSet.all_requirements)T)NN)r. __module__ __qualname__boolrr&r*r1r r4r6rrrrrFrHr=propertyrJrrrrr s"    ur )Zlogging collectionsrtypingrrrrrZpip._vendor.packaging.utilsrZpip._internal.exceptionsr Zpip._internal.models.wheelr Zpip._internal.req.req_installr Zpip._internal.utilsr Z getLoggerr.r9r rrrrs