U
    cUh!                     @   sP  d 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	m
Z
mZ ddlm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. ddl,m/Z/m0Z0 ddl1m2Z2 dgZ3e4e5Z6G dd deZ7dS )z(Base Command class, and related routines    N)Values)ListOptionalTuple)reconfigure)	traceback)
cmdoptions)CommandContextMixIn)ConfigOptionParserUpdatingDefaultsHelpFormatter)ERRORPREVIOUS_BUILD_DIR_ERRORUNKNOWN_ERRORVIRTUALENV_NOT_FOUND)
BadCommandCommandErrorDiagnosticPipErrorInstallationErrorNetworkConnectionErrorPreviousBuildDirError)
deprecated)check_path_owner)BrokenStdoutLoggingErrorsetup_logging)get_prognormalize_path)TempDirectoryTypeRegistry)global_tempdir_managertempdir_registry)running_under_virtualenvCommandc                       s   e Zd ZU dZeed< dZeed< deeedd fddZdd	d
dZ	e
ddddZe
ee edddZee
ee edddZee ee
ee f dddZee edddZee edddZ  ZS )r     usageFignore_require_venvN)namesummaryisolatedreturnc              	      s   t    || _|| _t| jt  d| t d|| j|d| _	d | _
| j  d}t| j	|| _ttj| j	}| j	| |   d S )N F)r"   prog	formatteradd_help_optionr$   descriptionr&   z Options)super__init__r$   r%   r
   r"   r   r   __doc__parserr   
capitalizeoptparseOptionGroupcmd_optsr   make_option_groupgeneral_groupadd_option_groupadd_options)selfr$   r%   r&   Zoptgroup_namegen_opts	__class__ ^/opt/bot/vods_filmes/script/venv/lib/python3.8/site-packages/pip/_internal/cli/base_command.pyr.   1   s*    

zCommand.__init__r'   c                 C   s   d S Nr=   )r9   r=   r=   r>   r8   O   s    zCommand.add_options)optionsr'   c                 C   s   t |drtdS )zf
        This is a no-op so that commands by default do not do the pip version
        check.
        no_indexN)hasattrAssertionError)r9   rA   r=   r=   r>   handle_pip_version_checkR   s    z Command.handle_pip_version_check)rA   argsr'   c                 C   s   t d S r@   )NotImplementedError)r9   rA   rF   r=   r=   r>   run[   s    zCommand.run)level_numberrA   rF   r'   c              
      s  t d fdd}jr.tjdd | S z| }t|t sDt|W S  tk
r } z.tjd|ddid tj	d	dd
 t
 W Y S d }~X Y nn tk
r } z(tt| tj	d	dd
 t W Y S d }~X Y n( tttfk
r( } z(tt| tj	d	dd
 t
 W Y S d }~X Y n tk
rl } z&td| tj	d	dd
 t
 W Y S d }~X Y n tk
r   tdtjd |tjkrtjtjd t
 Y S  tk
r   td tj	d	dd
 t
 Y S  tk
r   tjddd
 t Y S X d S )Nr?   c                	      s"   z W S   X d S r@   )rE   rH   r=   rF   rA   r9   r=   r>   
_inner_run_   s    z(Command._run_wrapper.<locals>._inner_runT)show_localsz%srich)extrazException information:)exc_infoz ERROR: Pipe to stdout was broken)filezOperation cancelled by userz
Exception:)int
debug_moderich_tracebackinstall
isinstancerD   r   loggererrordebugr   r   criticalstrr   r   r   r   r   r   printsysstderrloggingDEBUGr   	print_excKeyboardInterruptBaseExceptionr   )r9   rI   rA   rF   rK   statusexcr=   rJ   r>   _run_wrapper^   sP    
zCommand._run_wrapper)rF   r'   c                 C   s   | j |S r@   )r0   
parse_argsr9   rF   r=   r=   r>   rf      s    zCommand.parse_argsc              
   C   s>   z.|   | |W  5 Q R  W S Q R X W 5 t   X d S r@   )r^   shutdownZmain_context_mainrg   r=   r=   r>   main   s    
$zCommand.mainc                 C   sP  |  t | _|  t  | |\}}|j|j | _t|jd t	| j|j|j
d}t|jttj@ }|rtddt| |jrdtjkrtd tt |jrdtjd< |jrd	|jtjd
< |jr| jst std tt |j r*t!|j |_ t"|j s*td|j  d |_ |j#rBt$ddddd | %|||S )N)no_color)	verbosityrk   user_log_filez/The following features are always enabled: %s. z, _PIP_RUNNING_IN_SUBPROCESSzAThe --python option must be placed before the pip subcommand name1PIP_NO_INPUTr(   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 should use sudo's -H flag.z*--no-python-version-warning is deprecated.z"to remove the flag as it's a no-opz25.1ib3  )reasonreplacementgone_inissue)&enter_contextr   r   rf   verbosequietrl   r   rk   r   logsetfeatures_enabledr   ALWAYS_ENABLED_FEATURESrV   warningjoinsortedpythonosenvironrY   r\   exitr   no_inputexists_actionrequire_venvr#   r   r   	cache_dirr   r   no_python_version_warningr   re   )r9   rF   rA   rI   Zalways_enabled_featuresr=   r=   r>   ri      s^    





zCommand._main)F)__name__
__module____qualname__r"   rZ   __annotations__r#   boolr.   r8   r   rE   r   rQ   rH   re   r   rf   rj   ri   __classcell__r=   r=   r;   r>   r    -   s   
	9 )8r/   r^   Zlogging.configr2   r   r\   r   r   typingr   r   r   pip._vendor.richr   rS   pip._internal.clir   Z!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   Zpip._internal.utils.filesystemr   pip._internal.utils.loggingr   r   pip._internal.utils.miscr   r   pip._internal.utils.temp_dirr   ZTempDirRegistryr   r   pip._internal.utils.virtualenvr   __all__	getLoggerr   rV   r    r=   r=   r=   r>   <module>   s2    
