Current File : //lib/python3.9/site-packages/pip/_internal/operations/__pycache__/freeze.cpython-39.pyc
a

[��f*&�
@s"ddlZddlZddlZddlmZmZmZmZmZm	Z	m
Z
mZddlm
Z
ddlmZddlmZmZddlmZmZddlmZmZddlmZdd	lmZe�e�ZGd
d�de	�Z de
ee!e"e"e
ee!e"e"ee!ee!d�dd�Z#ee!d�dd�Z$ee d�dd�Z%Gdd�d�Z&dS)�N)�	Container�Dict�Iterable�Iterator�List�
NamedTuple�Optional�Set)�canonicalize_name)�Version)�
BadCommand�InstallationError)�BaseDistribution�get_environment)�install_req_from_editable�install_req_from_line)�
COMMENT_RE)�%direct_url_as_pep440_direct_referencec@s"eZdZUeed<eeed<dS)�
_EditableInfo�requirement�commentsN)�__name__�
__module__�__qualname__�str�__annotations__r�rr�C/usr/lib/python3.9/site-packages/pip/_internal/operations/freeze.pyrs
rFr)r�
local_only�	user_only�paths�isolated�exclude_editable�skip�returnccsni}t|�j|d|d�}|D]$}	t�|	�}
|r6|
jr6q|
||
j<q|�r4t�}t�t	�}|D�]�}
t
|
���p}|D�]X}|��r�|���d�s�|�d�r�|�
�}||vrr|�|�|Vqr|�d�s�|�d��r|�d�r�|dd���}n|td�d����d�}t||d	�}ntt�d
|���|d	�}|j�sRt�d|
|���t�d�qrt|j�}||v�r�||j�s�t�d
|
t�d
|���|j�n||j�|
�qrt||��
�V||=||j�|
�qrWd�q\1�s�0Yq\|��D]4\}}t|�dk�r�t�d|d�tt|�����q�dVt|��dd�d�D] }|j|v�rHt|��
�V�qHdS)Nr)rr#r�#)z-rz
--requirementz-fz--find-linksz-iz--index-urlz--prez--trusted-hostz--process-dependency-linksz--extra-index-urlz
--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 installed�z+Requirement %s included multiple times [%s]z, z7## The following requirements were added by pip freeze:cSs
|j��S�N)�name�lower)�xrrr�<lambda>��zfreeze.<locals>.<lambda>)�key) rZiter_installed_distributions�FrozenRequirement�	from_dist�editable�canonical_name�set�collections�defaultdict�list�open�strip�
startswith�rstrip�add�len�lstriprrr�subr+�logger�infor
�warning�appendr�items�join�sorted�values)rrrr r!r"r#Z
installationsZdists�dist�reqZemitted_optionsZ	req_filesZ
req_file_pathZreq_file�lineZline_reqZline_req_canonical_namer+�filesZinstallationrrr�freezes�	�




����

����

�4�rM�rIr$cCs0t|jt�r|j�d|j��S|j�d|j��S)Nz==z===)�
isinstance�versionr�raw_name)rIrrr�_format_as_name_version�srRc
Cs�|j}|sJ�tj�tj�|��}ddlm}m}m}|�	|�}|durtt
|�}t�d||�t
|d|�d�gd�St|�j}z|�||j�}	Wn�|y�t
|�}t
|d|�d	|�d�gd�YS|�y}
z<t
|�}t
|d|�d
|�d�d|
j�d
�gd�WYd}
~
Sd}
~
0t�yHt�d||j�t
|gd�YSt�yx}zt�d|�WYd}~nd}~00t
|	gd�St�d|�t
|dgd�S)za
    Compute and return values (req, comments) for use in
    FrozenRequirement.from_dist().
    r)�RemoteNotFoundError�RemoteNotValidError�vcsNz1No 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_location�os�path�normcase�abspathZpip._internal.vcsrSrTrUZget_backend_for_dirrRrA�debugr�typerZget_src_requirementrQ�urlrrCr+r
)rIrX�locationrSrTrUZvcs_backendZdisplayZvcs_namerJ�ex�excrrr�_get_editable_info�s`
��
�
���"�rcc@sJeZdZdeeeeedd�dd�Zeedd�dd��Z	ed	�d
d�Z
dS)
r1rN)r+rJr3rr$cCs&||_t|�|_||_||_||_dSr*)r+r
r4rJr3r)�selfr+rJr3rrrr�__init__�s

zFrozenRequirement.__init__rNcCsN|j}|rt|�\}}n$g}|j}|r4t||j�}nt|�}||j|||d�S)N)r)r3rc�
direct_urlrrQrR)�clsrIr3rJrrfrrrr2�szFrozenRequirement.from_dist)r$cCs4|j}|jrd|��}d�t|j�t|�g�dS)Nz-e �
)rJr3rFr8rr)rdrJrrr�__str__�s
zFrozenRequirement.__str__)r)rrrr�boolrre�classmethodrr2rirrrrr1�s��
r1)NFFNFFr)'r6ZloggingrY�typingrrrrrrrr	Zpip._vendor.packaging.utilsr
Zpip._vendor.packaging.versionrZpip._internal.exceptionsrr
Zpip._internal.metadatarrZpip._internal.req.constructorsrrZpip._internal.req.req_filerZ&pip._internal.utils.direct_url_helpersrZ	getLoggerrrArrrjrMrRrcr1rrrr�<module>s@(
�

�yB