U .eb& @s4ddlmZddlZddlZddlZddlZddlmZddlm Z ddl m Z ddl m Z mZddlmZmZddlmZdd lmZmZdd lmZerdd lmZmZmZmZmZmZm Z m!Z!m"Z"dd l#m$Z$dd l m%Z%m&Z&e ee"e'e&fe(ee'fZ)e*e+Z,dddZ-ddZ.Gddde/Z0dS))absolute_importN)six)canonicalize_name)RequirementParseError) BadCommandInstallationError)install_req_from_editableinstall_req_from_line) COMMENT_RE)dist_is_editableget_installed_distributions)MYPY_CHECK_RUNNING) IteratorOptionalList ContainerSetDictTupleIterableUnion) WheelCache) Distribution RequirementFc  cs|pg}d} |rt|j} |D]} d| Vq i} t|d||dD]b} zt| }Wn8tk r}ztd| |WYqDW5d}~XYnX|r|j rqD|| |j <qD|rt }t t}|D]}t|}|D]r}|r|ds| r| |s|dr6|}||kr|||Vq|dsN|dr|drl|d d}n|tddd }t|||d }nttd |||d }|j std ||tdq|j | kr ||j std|td ||j n||j |qt| |j V| |j =||j |qW5QRXqt|D]4\}}t|dkrdtd|dt t |qddVt | !dddD]$}t"|j | krt|VqdS)Nz-f %sr) local_onlyskip user_onlypathsz6Could not generate requirement for distribution %r: %s#) z-rz --requirementz-Zz--always-unzipz-fz --find-linksz-iz --index-urlz--prez--trusted-hostz--process-dependency-linksz--extra-index-urlz-ez --editable=)isolated wheel_cachezWSkipping line in requirement file [%s] because it's not clear what it would install: %sz9 (add #egg=PackageName to the URL to avoid this warning)zBRequirement file [%s] contains %s, but package %r is not installedz+Requirement %s included multiple times [%s]z, z7## The following requirements were added by pip freeze:cSs |jSN)namelower)xrrC/usr/lib/python3.8/site-packages/pip/_internal/operations/freeze.pyzfreeze..)key)#recompilesearchr FrozenRequirement from_distrloggerwarningeditabler'set collections defaultdictlistopenstrip startswithrstripaddlenlstriprr r subinfoappendstrrZ iteritemsjoinsortedvaluesr)Z requirementZ find_linksrrrZ skip_regexr"r#Zexclude_editablerZ skip_matchlinkZ installationsdistreqexcZemitted_optionsZ req_filesZ req_file_pathZreq_filelineZline_reqr'filesZ installationrrr*freeze+s                  rNc CsNt|sddgfStjtj|j}ddlm}m}| |}|dkrv| }t d||d |g}|d|fSz|||j}Wn|k r| }d t|j|g}|d|fYStk rt d ||jddgfYStk r}zt d |W5d}~XYnX|dk r2|dgfSt d |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 ospathnormcaseabspathlocationZpip._internal.vcsrOrPZget_backend_for_diras_requirementr3debugformatZget_src_requirement project_nametype__name__rr4r'r)rIrUrOrPZ vcs_backendrJcommentsrKrrr*get_requirement_infosZ     r]c@s*eZdZd ddZeddZddZdS) r1rcCs||_||_||_||_dSr&)r'rJr5r\)selfr'rJr5r\rrr*__init__szFrozenRequirement.__init__cCs0t|\}}}|dkr|}||j|||dS)N)r\)r]rVrY)clsrIrJr5r\rrr*r2szFrozenRequirement.from_distcCs2|j}|jrd|}dt|jt|gdS)Nz-e %s )rJr5rEr9r\rD)r^rJrrr*__str__szFrozenRequirement.__str__N)r)r[ __module__ __qualname__r_ classmethodr2rbrrrr*r1s  r1) NNNNNNFNFr)1Z __future__rr7ZloggingrQr.Z pip._vendorrZpip._vendor.packaging.utilsrZpip._vendor.pkg_resourcesrZpip._internal.exceptionsrrZpip._internal.req.constructorsrr Zpip._internal.req.req_filer Zpip._internal.utils.miscr r Zpip._internal.utils.typingr typingrrrrrrrrrZpip._internal.cacherrrrDboolZRequirementInfoZ getLoggerr[r3rNr]objectr1rrrr*s@      ,   >