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

[��f�
�@s�ddlZddlmZddlmZddlmZddlmZddl	m
Z
mZddlm
Z
ddlmZdd	lmZdd
lmZmZddlmZe�e�ZGdd
�d
ee
�ZdS)�N)�Values)�List)�canonicalize_name)�Command)�SessionCommandMixin�warn_if_run_as_root)�SUCCESS)�InstallationError)�parse_requirements)�install_req_from_line�#install_req_from_parsed_requirement)�(protect_pip_from_modification_on_windowsc@s8eZdZdZdZdd�dd�Zeeee	d�dd	�Z
dS)
�UninstallCommandaB
    Uninstall packages.

    pip is able to uninstall most installed packages. Known exceptions are:

    - Pure distutils packages installed with ``python setup.py install``, which
      leave behind no metadata to determine what files were installed.
    - Script wrappers installed by ``python setup.py develop``.
    zU
      %prog [options] <package> ...
      %prog [options] -r <requirements file> ...N)�returnc	CsD|jjddddgddd�|jjdd	d
ddd
�|j�d|j�dS)Nz-rz
--requirement�requirements�append�filezjUninstall all the packages listed in the given requirements file.  This option can be used multiple times.)�dest�action�default�metavar�helpz-yz--yes�yes�
store_truez2Don't ask for confirmation of uninstall deletions.)rrrr)Zcmd_optsZ
add_option�parserZinsert_option_group)�self�r�D/usr/lib/python3.9/site-packages/pip/_internal/commands/uninstall.py�add_options$s"��zUninstallCommand.add_options)�options�argsrc
Cs�|�|�}i}|D]4}t||jd�}|jr:||t|j�<qt�d|�q|jD]:}t|||d�D]&}t	||jd�}|jr`||t|j�<q`qN|s�t
d|j�d|j�d���td|vd�|��D]&}|j
|j|jd	kd
�}	|	r�|	��q�t�tS)N)�isolatedzSInvalid requirement: %r ignored - the uninstall command expects named requirements.)r�sessionz*You must give at least one requirement to z (see "pip help z")Zpip)Z
modifying_pipr)Zauto_confirm�verbose)Zget_default_sessionrZ
isolated_mode�namer�loggerZwarningrr
rr	r
�valuesZ	uninstallr�	verbosityZcommitrr)
rrr r"Zreqs_to_uninstallr$Zreq�filenameZ
parsed_reqZuninstall_pathsetrrr�run;sP
��
�
�
����
zUninstallCommand.run)�__name__�
__module__�__qualname__�__doc__�usagerrr�str�intr)rrrrrs
r)ZloggingZoptparser�typingrZpip._vendor.packaging.utilsrZpip._internal.cli.base_commandrZpip._internal.cli.req_commandrrZpip._internal.cli.status_codesrZpip._internal.exceptionsr	Zpip._internal.reqr
Zpip._internal.req.constructorsrrZpip._internal.utils.miscr
Z	getLoggerr*r%rrrrr�<module>s