U
    +|j=  ã                   @   s<  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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-m.Z. ddl/m0Z0 dgZ1e 2e3¡Z4G dd„ deƒZ5dS )z(Base Command class, and related routinesé    N)ÚValues)ÚAnyÚListÚOptionalÚTuple)Ú
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)ÚTempDirectoryTypeRegistry)Úglobal_tempdir_managerÚtempdir_registry)Úrunning_under_virtualenvÚ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tƒ › d|› �tƒ d|| j|d�| _	d | _
| j ¡ › d�}t | j	|¡| _t tj| j	¡}| j	 |¡ |  ¡  d S )Nú F)ÚusageÚprogÚ	formatterÚadd_help_optionÚnameÚdescriptionÚisolatedz Options)ÚsuperÚ__init__r%   Úsummaryr	   r!   r   r
   Ú__doc__Úparserr   Ú
capitalizeÚoptparseÚOptionGroupÚcmd_optsr   Úmake_option_groupÚgeneral_groupÚadd_option_groupÚadd_options)Úselfr%   r*   r'   Úoptgroup_nameÚgen_opts©Ú	__class__© úfC:\Users\snmko\Desktop\web_content\django_cbt\venv\Lib\site-packages\pip/_internal/cli/base_command.pyr)   .   s*    
ù
þzCommand.__init__c                 C   s   d S ©Nr:   )r5   r:   r:   r;   r4   M   s    zCommand.add_optionsc                 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)r5   Úoptionsr:   r:   r;   Úhandle_pip_version_checkQ   s    z Command.handle_pip_version_checkc                 C   s   t ‚d S r<   )ÚNotImplementedError)r5   r@   Úargsr:   r:   r;   Úrun[   s    zCommand.runc                 C   s   | j  |¡S r<   )r,   Ú
parse_args©r5   rC   r:   r:   r;   rE   _   s    zCommand.parse_argsc              
   C   s>   z.|  ¡ � |  |¡W  5 Q R £ W ¢S Q R X W 5 t  ¡  X d S r<   )ÚloggingÚshutdownÚmain_contextÚ_mainrF   r:   r:   r;   Úmaind   s    
$zCommand.mainc                 C   sÈ  |   tƒ ¡| _|   tƒ ¡ |  |¡\}}|j|j | _t| j|j|j	d�}|j
rZdtjd< |jrrd |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 ƒrätd	d
ddd� d|jkrøt d¡ �z¼z(|  ||¡}t |t!ƒ�st"‚|W W �¢”S  t#k
�rt } z.t t$|ƒ¡ tj%ddd� t& W Y ¢W �¢TS d }~X Y �n@ t't(t)t*fk
�rÈ } z.t t$|ƒ¡ tj%ddd� t+ W Y ¢W � ¢þS d }~X Y nì t,k
�r } z*t d|¡ tj%ddd� t+ W Y ¢W ¢¶S d }~X Y n¤ t-k
�rT   t.dtj/d� |t0j1k�rHt2j3tj/d� t+ Y W ¢fS  t4k
�rˆ   t d¡ tj%ddd� t+ Y W ¢2S  t5k
�r²   tjddd� t6 Y W ¢S X W 5 |  |¡ X d S )N)Ú	verbosityÚno_colorÚuser_log_fileÚ1ÚPIP_NO_INPUTr    ÚPIP_EXISTS_ACTIONz2Could not find an activated virtualenv (required).zêThe 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.Ú	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.3i�   )ÚreasonÚreplacementÚgone_inÚ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:)7Úenter_contextr   r   rE   ÚverboseÚquietrL   r   rM   ÚlogÚno_inputÚosÚenvironÚexists_actionÚjoinÚrequire_venvÚignore_require_venvr   ÚloggerÚcriticalÚsysÚexitr   Ú	cache_dirr   r   ÚwarningÚgetattrr   Úfeatures_enabledrA   rD   Ú
isinstanceÚintr?   r   ÚstrÚdebugr   r   r   r   r   r   r   r   ÚprintÚstderrrG   ÚDEBUGÚ	tracebackÚ	print_excÚKeyboardInterruptÚBaseExceptionr   )r5   rC   r@   Úlevel_numberÚstatusÚexcr:   r:   r;   rJ   l   sŒ    ý




úö
ÿ ü
zCommand._main)F)Ú__name__Ú
__module__Ú__qualname__r!   rc   r)   r4   rA   rD   rE   rK   rJ   Ú__classcell__r:   r:   r8   r;   r   *   s   
)6r+   rG   Úlogging.configr.   r^   rf   rs   r   Útypingr   r   r   r   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   ÚTempDirRegistryr   r   Úpip._internal.utils.virtualenvr   Ú__all__Ú	getLoggerrz   rd   r   r:   r:   r:   r;   Ú<module>   s.    
