Re( @sddlmZddlZddlZddlZddlmZddlmZddl m Z ddl m Z m Z ddlmZmZddlmZdd lmZmZdd lmZmZdd lmZermdd lmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$dd l%m&Z&ddl m'Z'm(Z(e"ee$e)e(fe*ee)fZ+ej,e-Z.ddddddddfdd Z/ddZ0Gddde1Z2dS))absolute_importN)six)canonicalize_name)RequirementParseError) BadCommandInstallationError)install_req_from_editableinstall_req_from_line) COMMENT_RE)%direct_url_as_pep440_direct_referencedist_get_direct_url)dist_is_editableget_installed_distributions)MYPY_CHECK_RUNNING) IteratorOptionalList ContainerSetDictTupleIterableUnion) WheelCache) Distribution RequirementFc cs|p g}x|D]} dj| VqWi} xtd|dfd|d|D]v} ytj| } Wn;tk r} ztjd| | wSWYdd} ~ XnX|r| jrqS| | | jszfreeze..) r!r"r#r$r%r&r'r(r)r*r+)"formatrFrozenRequirement from_distrloggerwarningeditablecanonical_nameset collections defaultdictlistopenstrip startswithrstripaddlenlstriprr r subr2inforappendstrr iteritemsjoinsortedvalues) requirement find_linksrrrr. wheel_cacheZexclude_editablerlinkZ installationsdistreqexcZemitted_optionsZ req_filesZ req_file_pathreq_filelineZline_reqZline_req_canonical_namer2filesZ installationr5r5r6freeze*s             %        # #r\cCst|sddgfStjjtjj|j}ddlm}m}|j |}|dkr|j }t j d||dj |g}|d|fSy|j||j}Wn|k r |j }dj t|j|g}|d|fSYntk rAt jd ||jddgfSYnNtk ru}zt jd |WYdd}~XnX|dk r|dgfSt jd |d g}dd|fS) zk Compute and return values (req, editable, comments) for use in FrozenRequirement.from_dist(). NFr)vcsRemoteNotFoundErrorz1No VCS found for editable requirement "%s" in: %rz/# Editable install with no version control ({})Tz)# Editable {} install with no remote ({})zPcannot determine version of editable source in %s (%s command not found in path)zYError when trying to get requirement for VCS system %s, falling back to uneditable formatz-Could not determine repository location of %sz-## !! Could not determine repository location)r ospathnormcaseabspathlocationpip._internal.vcsr]r^get_backend_for_diras_requirementr;debugr8get_src_requirement project_nametype__name__rr<r2r)rVrcr]r^ vcs_backendrWcommentsrXr5r5r6get_requirement_infosF  !           rnc@s=eZdZfddZeddZddZdS)r9cCs7||_t||_||_||_||_dS)N)r2rr>rWr=rm)selfr2rWr=rmr5r5r6__init__s    zFrozenRequirement.__init__cCst|\}}}|dkrR| rRt|}|rRt||j}g}|dkrj|j}||j||d|S)Nrm)rnr r rirf)clsrVrWr=rm direct_urlr5r5r6r:s   zFrozenRequirement.from_distcCsH|j}|jr!dj|}djt|jt|gdS)Nz-e {} )rWr=r8rOrBrmrM)rorWr5r5r6__str__ s  zFrozenRequirement.__str__N)rk __module__ __qualname__rp classmethodr:rtr5r5r5r6r9s r9)3 __future__rr@loggingr_ pip._vendorrZpip._vendor.packaging.utilsrZpip._vendor.pkg_resourcesrpip._internal.exceptionsrrpip._internal.req.constructorsrr Zpip._internal.req.req_filer &pip._internal.utils.direct_url_helpersr r pip._internal.utils.miscr rpip._internal.utils.typingrtypingrrrrrrrrrpip._internal.cacherrrrMboolZRequirementInfo getLoggerrkr;r\rnobjectr9r5r5r5r6s:   @%| >