3 ig*& @s0ddlZddlZddlZddlmZmZmZmZmZm Z m Z m Z ddl m Z ddlmZddlmZmZddlmZmZddlmZmZddlmZdd lmZejeZGd d d e Z dd d dd d ffe ee!e"e"e ee!e"e"ee!ee!d ddZ#ee!dddZ$ee dddZ%GdddZ&dS)N) ContainerDictIterableIteratorList NamedTupleOptionalSet)canonicalize_name)Version) BadCommandInstallationError)BaseDistributionget_environment)install_req_from_editableinstall_req_from_line) COMMENT_RE)%direct_url_as_pep440_direct_referencec@seZdZUeeedS) _EditableInfoN)__name__ __module__ __qualname__str requirementrcommentsrr>/tmp/pip-build-88gy_88q/pip/pip/_internal/operations/freeze.pyrs rF)r local_only user_onlypathsisolatedexclude_editableskipreturnccsti}t|j|f|d}x,|D]$} tj| } |r8| jr8q| || j<qW|r6t} tjt } x|D]} t | p}xf|D]\}|j s|j j ds|j dr|j }|| kr~| j||Vq~|j ds|j dr$|j dr|ddj }n|tddj jd}t||d}nttjd|j |d}|jsbtjd| |j tjdq~t|j}||kr| |jstjd| tjd|j |jn| |jj| q~t||j V||=| |jj| q~WWdQRXqdWx@| jD]4\}}t|dkrtjd|djtt|qWdVx8t|jdddD] }|j|krLt|j VqLWdS)N)rr"r#-r --requirement-f --find-links-i --index-url--pre--trusted-host--process-dependency-links--extra-index-url --use-featurez-ez --editable=)r zWSkipping 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 |jjS)N)namelower)xrrrszfreeze..)key) r%r&r'r(r)r*r+r,r-r.r/) rZiter_installed_distributionsFrozenRequirement from_disteditablecanonical_nameset collections defaultdictlistopenstrip startswithrstripaddlenlstriprrrsubr4loggerinfor warningappendritemsjoinsortedvalues)rrrrr r!r" installationsdistsdistreqemitted_optionsZ req_files req_file_pathreq_filelineline_reqZline_req_canonical_namer4files installationrrrfreezes               " r\)rSr#cCs0t|jtr|jd|jS|jd|jS)Nz==z===) isinstanceversionr raw_name)rSrrr_format_as_name_versions r`c Cs|j}|sttjjtjj|}ddlm}m}m }|j |}|dkrtt |}t j d||t|d|dgdSt|j}y|j||j} Wn|k rt |}t|d|d |dgdS|k r} z0t |}t|d|d |d d | jd gdSd} ~ Xnhtk r<t jd||jt|gdStk rj} zt jd| WYdd} ~ XnXt| gdSt jd|t|dgdS)za Compute and return values (req, comments) for use in FrozenRequirement.from_dist(). r)RemoteNotFoundErrorRemoteNotValidErrorvcsNz1No VCS found for editable requirement "%s" in: %rz,# Editable install with no version control ())rrz # Editable z install with no remote (z install (z4) with either a deleted local remote or invalid URI:z# ''zPcannot determine version of editable source in %s (%s command not found in path)z6Error when trying to get requirement for VCS system %sz-Could not determine repository location of %sz-## !! Could not determine repository location)editable_project_locationAssertionErrorospathnormcaseabspathZpip._internal.vcsrarbrcZget_backend_for_dirr`rIdebugrtyperget_src_requirementr_urlr rKr4r ) rSrflocationrarbrc vcs_backenddisplayZvcs_namerTexexcrrr_get_editable_infosR     ruc@sLeZdZffeeeeeddddZeeddddZ edd d Z dS) r9N)r4rTr;rr#cCs&||_t||_||_||_||_dS)N)r4r r<rTr;r)selfr4rTr;rrrr__init__s  zFrozenRequirement.__init__)rSr#cCsN|j}|rt|\}}n$g}|j}|r4t||j}nt|}||j|||dS)N)r)r;ru direct_urlrr_r`)clsrSr;rTrrxrrrr:szFrozenRequirement.from_dist)r#cCs4|j}|jrd|}djt|jt|gdS)Nz-e  )rTr;rNr@rr)rvrTrrr__str__s zFrozenRequirement.__str__) rrrrboolrrw classmethodrr:r{rrrrr9s r9)'r>loggingrhZtypingrrrrrrrr pip._vendor.packaging.utilsr Zpip._vendor.packaging.versionr Zpip._internal.exceptionsr r Zpip._internal.metadatarrZpip._internal.req.constructorsrrZpip._internal.req.req_filerZ&pip._internal.utils.direct_url_helpersr getLoggerrrIrrr|r\r`rur9rrrrs.(     &qB