a
    e0hy$                     @   sr  d Z ddlmZmZ ddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZ ddlmZ ddlmZ ddlmZmZ ddlmZmZmZmZ dd	lmZmZmZmZmZmZ dd
l m!Z! ddl"m#Z# ddl$m%Z%m&Z& ddl'm(Z(m)Z) ddl*m+Z+m,Z, ddl-m.Z. ddl/m0Z0 e.rNddlm1Z1 ddl2m3Z3m4Z4m5Z5m6Z6 ddl*m7Z8 dgZ9e:e;Z<G dd deZ=dS )z(Base Command class, and related routines    )absolute_importprint_functionN)PY2)
cmdoptions)CommandContextMixIn)ConfigOptionParserUpdatingDefaultsHelpFormatter)ERRORPREVIOUS_BUILD_DIR_ERRORUNKNOWN_ERRORVIRTUALENV_NOT_FOUND)
BadCommandCommandErrorInstallationErrorNetworkConnectionErrorPreviousBuildDirErrorUninstallationError)
deprecated)check_path_owner)BrokenStdoutLoggingErrorsetup_logging)get_prognormalize_path)global_tempdir_managertempdir_registry)MYPY_CHECK_RUNNING)running_under_virtualenv)Values)AnyListOptionalTuple)TempDirectoryTypeRegistryCommandc                       sV   e Zd ZdZdZd fdd	Zdd Zdd Zd	d
 Zdd Z	dd Z
dd Z  ZS )r#   NFc                    s   t t|   | jdt |t d|| j|d}|| _|| _	t
f i || _d | _d| j }t| j|| _ttj| j}| j| |   d S )Nz{} {}F)usageprog	formatteradd_help_optionnamedescriptionisolatedz
{} Options)superr#   __init__r$   formatr   r   __doc__r(   summaryr   parserr   
capitalizeoptparseOptionGroupcmd_optsr   make_option_groupgeneral_groupadd_option_groupadd_options)selfr(   r/   r*   	parser_kwoptgroup_namegen_opts	__class__ L/var/www/auris/lib/python3.9/site-packages/pip/_internal/cli/base_command.pyr,   9   s*    
zCommand.__init__c                 C   s   d S Nr?   )r9   r?   r?   r@   r8   Y   s    zCommand.add_optionsc                 C   s   t |drJ dS )zf
        This is a no-op so that commands by default do not do the pip version
        check.
        no_indexN)hasattr)r9   optionsr?   r?   r@   handle_pip_version_check]   s    z Command.handle_pip_version_checkc                 C   s   t d S rA   )NotImplementedError)r9   rD   argsr?   r?   r@   rung   s    zCommand.runc                 C   s   | j |S rA   )r0   
parse_argsr9   rG   r?   r?   r@   rI   k   s    zCommand.parse_argsc                 C   sX   zH|   $ | |W  d    W t  S 1 s40    Y  W t  n
t  0 d S rA   )main_context_mainloggingshutdownrJ   r?   r?   r@   mainp   s    
zCommand.mainc                 C   sr  |  t | _|  t  | |\}}|j|j | _t| j|j|j	d}t
jd d dkr|jsd}t dkrzd| }t|d dd t
jd d d	kr|jsd
}t|d dd |jrdtjd< |jrd|jtjd< |jr| jst std t
t |jr:t|j|_t|js:td|j d |_t |dd rXtddddd d|j!v rtt"sttd zz.| #||}t$|t%sJ |W W | &| S  t'y } z8tt(| tj)ddd t*W  Y d }~W | &| S d }~0  t+t,t-t.fyP } z8tt(| tj)ddd t/W  Y d }~W | &| S d }~0  t0y } z6td| tj)ddd t/W  Y d }~W | &| S d }~0  t1y   t2dt
j3d |t4j5krt6j7t
j3d t/ Y W | &| S  t8y"   td tj)ddd t/ Y W | &| S  t9yR   tjd dd t: Y W | &| S 0 W | &| n| &| 0 d S )!N)	verbosityno_coloruser_log_file   )rS      zpip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-supportCPythonzPython 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. z21.0)replacementgone_in)      zPython 3.5 reached the end of its life on September 13th, 2020. Please upgrade your Python as Python 3.5 is no longer maintained. pip 21.0 will drop support for Python 3.5 in January 2021.1PIP_NO_INPUT PIP_EXISTS_ACTIONz2Could not find an activated virtualenv (required).zThe directory '%s' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.	build_dirz\The -b/--build/--build-dir/--build-directory option is deprecated and has no effect anymore.zOuse the TMPDIR/TEMP/TMP environment variable, possibly combined with --no-cleanz21.1i   )reasonrV   rW   issuez2020-resolverz--use-feature=2020-resolver no longer has any effect, since it is now the default dependency resolver in pip. This will become an error in pip 21.0.zException information:T)exc_infoz%sz ERROR: Pipe to stdout was broken)filezOperation cancelled by userz
Exception:);enter_contextr   r   rI   verbosequietrP   r   rQ   logsysversion_infono_python_version_warningplatformpython_implementationr   no_inputosenvironexists_actionjoinrequire_venvignore_require_venvr   loggercriticalexitr   	cache_dirr   r   warninggetattrfeatures_enabledr   rH   
isinstanceintrE   r   strdebugr
   r   r   r   r   r	   r   r   printstderrrM   DEBUG	traceback	print_excKeyboardInterruptBaseExceptionr   )r9   rG   rD   level_numbermessagestatusexcr?   r?   r@   rL   x   s    

#










zCommand._main)F)__name__
__module____qualname__r$   rr   r,   r8   rE   rH   rI   rO   rL   __classcell__r?   r?   r=   r@   r#   5   s    
)>r.   
__future__r   r   rM   logging.configr2   rm   rj   rg   r   Zpip._vendor.sixr   Zpip._internal.clir   !pip._internal.cli.command_contextr   pip._internal.cli.parserr   r   pip._internal.cli.status_codesr	   r
   r   r   pip._internal.exceptionsr   r   r   r   r   r   pip._internal.utils.deprecationr   pip._internal.utils.filesystemr   pip._internal.utils.loggingr   r   pip._internal.utils.miscr   r   pip._internal.utils.temp_dirr   r   pip._internal.utils.typingr   pip._internal.utils.virtualenvr   r   typingr   r   r    r!   r"   ZTempDirRegistry__all__	getLoggerr   rs   r#   r?   r?   r?   r@   <module>   s8    
