o
    c                     @   s6  U d Z ddlZddlZddlmZmZmZmZmZ ddl	m
Z
 ddlmZ dZG dd deZdaeed	< 		d+d
eeef dee dededee dee ddfddZd,ddZddddedee dee dee dee ddfddZG dd dZedd d!d"d#d$Zed%d&d!d'd#d(Zed)d&d!d*d#d(ZdS )-zN
A module that implements tooling to enable easy warnings about deprecations.
    N)AnyOptionalTextIOTypeUnion)parse)__version__zDEPRECATION: c                   @   s   e Zd ZdS )PipDeprecationWarningN)__name__
__module____qualname__ r   r   L/opt/certbot/lib/python3.10/site-packages/pip/_internal/utils/deprecation.pyr	      s    r	   _original_showwarningmessagecategoryfilenamelinenofilelinereturnc                 C   sb   |d urt d urt | ||||| d S d S t|tr&td}||  d S t | ||||| d S )Nzpip._internal.deprecations)r   
issubclassr	   logging	getLoggerwarning)r   r   r   r   r   r   loggerr   r   r   _showwarning   s   

r   c                   C   s,   t jdtdd td u rt jatt _d S d S )NdefaultT)append)warningssimplefilterr	   r   showwarningr   r   r   r   r   install_warning_logger,   s
   
r"   )feature_flagissuereasonreplacementgone_inr#   r$   c                 C   s   |duot tt |k}| t df||sdndf|df||s!dndf|dfg}dd	d
 |D }|r8t|tj|tdd dS )a   Helper to deprecate existing functionality.

    reason:
        Textual reason shown to the user about why this functionality has
        been deprecated. Should be a complete sentence.
    replacement:
        Textual suggestion shown to the user about what alternative
        functionality they can use.
    gone_in:
        The version of pip does this functionality should get removed in.
        Raises an error if pip's current version is greater than or equal to
        this.
    feature_flag:
        Command-line flag of the form --use-feature={feature_flag} for testing
        upcoming functionality.
    issue:
        Issue number on the tracker that would serve as a useful place for
        users to find related discussion and provide feedback.
    Nz{}z*pip {} will enforce this behaviour change.z*Since pip {}, this is no longer supported.zA possible replacement is {}.zEYou can use the flag --use-feature={} to test the upcoming behaviour.z@Discussion can be found at https://github.com/pypa/pip/issues/{} c                 s   s.    | ]\}}|d ur|d ur| |V  qd S N)format).0value
format_strr   r   r   	<genexpr>n   s    
zdeprecated.<locals>.<genexpr>   )r   
stacklevel)r   current_versionDEPRECATION_MSG_PREFIXjoinr	   r   warn)r%   r&   r'   r#   r$   is_gonemessage_partsr   r   r   r   
deprecated7   s2   
r7   c                   @   sb   e Zd Z						ddedee dee dee dee ded	efd
dZdeddfddZdS )LegacyInstallReasonNFr%   r&   r'   r#   r$   emit_after_successemit_before_installc                 C   s.   || _ || _|| _|| _|| _|| _|| _d S r)   )_reason_replacement_gone_in_feature_flag_issuer9   r:   )selfr%   r&   r'   r#   r$   r9   r:   r   r   r   __init__|   s   

zLegacyInstallReason.__init__namer   c                 C   s(   t | jj|d| j| j| j| jd d S )N)rB   )r%   r&   r'   r#   r$   )r7   r;   r*   r<   r=   r>   r?   )r@   rB   r   r   r   emit_deprecation   s   
z$LegacyInstallReason.emit_deprecation)NNNNFF)	r
   r   r   strr   intboolrA   rC   r   r   r   r   r8   {   s.    
r8   zk{name} was installed using the legacy 'setup.py install' method, because a wheel could not be built for it.z+to fix the wheel build issue reported abovez23.1i   T)r%   r&   r'   r$   r9   z{name} is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed.z#to enable the '--use-pep517' optionio!  )r%   r&   r'   r$   r:   z{name} is being installed using the legacy 'setup.py install' method, because the '--no-binary' option was enabled for it and this currently disables local wheel building for projects that don't have a 'pyproject.toml' file.i,  )NN)r   N)__doc__r   r   typingr   r   r   r   r   pip._vendor.packaging.versionr   pipr   r1   r2   Warningr	   r   __annotations__rD   rE   r   r"   r7   r8   #LegacyInstallReasonFailedBdistWheel&LegacyInstallReasonMissingWheelPackage2LegacyInstallReasonNoBinaryForcesSetuptoolsInstallr   r   r   r   <module>   s    	



D
