???<!-- GIF89;a -->
123123123123
.....................................................................................................................................???<!-- GIF89;a -->
123123123123
.....................................................................................................................................3
Pf.                 @   s,  d Z ddl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m	Z	 ddl
mZ ddlmZ ddlmZ ddlmZmZmZmZ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 m!Z!m"Z"m#Z# ddl$m%Z%m&Z&m'Z' ddl(m)Z) ddl*m+Z+ dgZ,ej-e.Z/G dd de0Z1G dd de1Z2dS )z(Base Command class, and related routines    )absolute_importN)
cmdoptions)PackageFinder)running_under_virtualenv)
PipSession)
BadCommandInstallationErrorUninstallationErrorCommandErrorPreviousBuildDirError)logging_dictConfig)ConfigOptionParserUpdatingDefaultsHelpFormatter)InstallRequirementparse_requirements)SUCCESSERRORUNKNOWN_ERRORVIRTUALENV_NOT_FOUNDPREVIOUS_BUILD_DIR_ERROR)deprecationget_prognormalize_path)IndentingFormatter)pip_version_checkCommandc               @   s@   e Zd ZdZdZdZdZdddZdddZd	d
 Z	dd Z
dS )r   NFext://sys.stdoutext://sys.stderrc             C   sr   | j dt | jf t d| j| j|d}tf || _d| jj  }tj	| j|| _
tjtj| j}| jj| d S )Nz%s %sF)usageprog	formatterZadd_help_optionnamedescriptionisolatedz
%s Options)r   r   r!   r   __doc__r   parser
capitalizeoptparseZOptionGroupZcmd_optsr   Zmake_option_groupZgeneral_groupZadd_option_group)selfr#   Z	parser_kwZoptgroup_nameZgen_opts r)   !/usr/lib/python3.6/basecommand.py__init__)   s    zCommand.__init__c             C   s   t |jrttjj|jdnd |d k	r*|n|j|jd}|jrF|j|_	|j
rT|j
|_|js^|rr|d k	rj|n|j|_|jr|j|jd|_|j |j_|S )Nhttp)cacheretriesZinsecure_hosts)r,   Zhttps)r   	cache_dirr   ospathjoinr.   trusted_hostsZcertZverifyZclient_certtimeoutproxyZproxiesno_inputZauthZ	prompting)r(   optionsr.   r4   sessionr)   r)   r*   _build_sessionA   s    

zCommand._build_sessionc             C   s   | j j|S )N)r%   
parse_args)r(   argsr)   r)   r*   r:   e   s    zCommand.parse_argsc                s  | j |\}}|jr8|jdkr"d |jdkr2d qHd n|jrDd nd  }|jrVd}tddd	d
tjdidtddi d| jd d	gdddd| jd dddd|jpddddd|t	t
d dd|jrdnd gdt fddd2D d" tjd d d3krtjd$tj |jr(d%tjd&< |jrBd'j|jtjd(< |jrft sftjd) tjt z$y"| j||}t|tr|S W  n t k
r } z tjt!| tj"d*dd+ t#S d }~X n t$t%t&fk
r } z tjt!| tj"d*dd+ t'S d }~X n~ t(k
rF } ztjd,| tj"d*dd+ t'S d }~X nD t)k
rr   tjd- tj"d*dd+ t'S    tjd.dd+ t*S W d |j+ rt,|d/d r| j-|dt.d0|j/d1}t0| W d Q R X X t1S )4N   WARNING   r   ZCRITICALDEBUGINFOFZexclude_warningsz pip.utils.logging.MaxLevelFilter)z()levelindentz%(message)s)z()formatz(pip.utils.logging.ColorizedStreamHandlerr   )rA   classstreamfiltersr    )rA   rD   rE   r    z+pip.utils.logging.BetterRotatingFileHandlerz	/dev/nullT)rA   rD   filenameZdelayr    )consoleconsole_errorsuser_logrH   rI   rJ   )rA   handlersc             3   s&   | ]}|d  dkrdndifV  qdS )rA   r@   r   r=   r?   N)r@   r   r)   ).0r!   )rA   r)   r*   	<genexpr>   s   
zCommand.main.<locals>.<genexpr>pip._vendordistlibrequestsurllib3)versionZdisable_existing_loggersrF   Z
formattersrK   rootZloggers   zPython 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of pip will drop support for Python 2.61ZPIP_NO_INPUT ZPIP_EXISTS_ACTIONz2Could not find an activated virtualenv (required).zException information:)exc_infoz	ERROR: %szOperation cancelled by userz
Exception:no_index   )r.   r4   )rN   rO   rP   rQ   )r>   rT   )2r:   quietverboselogr   loggingr=   r   log_streamslistfilterdictsysversion_infowarningswarnr   ZPython26DeprecationWarningr6   r0   environZexists_actionr2   Zrequire_venvr   loggerZcriticalexitr   Zrun
isinstanceintr   strdebugr   r   r	   r   r   r
   KeyboardInterruptr   Zdisable_pip_version_checkgetattrr9   minr4   r   r   )r(   r;   r7   Z
root_levelZstatusexcr8   r)   )rA   r*   maini   s    










zCommand.main)r   r   )F)NN)__name__
__module____qualname__r!   r   Zhiddenr^   r+   r9   r:   rq   r)   r)   r)   r*   r   #   s   

$c               @   s"   e Zd Zedd ZdddZdS )RequirementCommandc          	   C   s"  x6|j D ],}x&t|d||||dD ]}| j| q"W qW x&|D ]}| jtj|d|j|d q>W x*|jD ] }| jtj||j|j|d qhW d}	x8|j	D ].}x(t|||||dD ]}d}	| j| qW qW |j
| _
|p|jp|	sd|i}
|jrd	t|
d
j|jd }nd|
 }tj| dS )z?
        Marshal cmd line args into a requirement set.
        T)Z
constraintfinderr7   r8   wheel_cacheN)r#   rw   )default_vcsr#   rw   F)rv   r7   r8   rw   r!   z^You must give at least one requirement to %(name)s (maybe you meant "pip %(name)s %(links)s"?)rV   )ZlinkszLYou must give at least one requirement to %(name)s (see "pip help %(name)s"))Zconstraintsr   Zadd_requirementr   Z	from_lineZisolated_modeZ	editablesZfrom_editablerx   ZrequirementsZrequire_hashes
find_linksra   r2   rg   Zwarning)Zrequirement_setr;   r7   rv   r8   r!   rw   rG   ZreqZfound_req_in_fileZoptsmsgr)   r)   r*   populate_requirement_set  sF    
z+RequirementCommand.populate_requirement_setNc             C   sR   |j g|j }|jr*tjddj| g }t|j|j||j	|j
|j|||||dS )zR
        Create a package finder appropriate to this requirement command.
        zIgnoring indexes: %s,)ry   format_control
index_urlsr3   Zallow_all_prereleasesprocess_dependency_linksr8   platformZversionsabiimplementation)Z	index_urlZextra_index_urlsrX   rg   rl   r2   r   ry   r}   r3   Zprer   )r(   r7   r8   r   Zpython_versionsr   r   r~   r)   r)   r*   _build_package_finder:  s     z(RequirementCommand._build_package_finder)NNNN)rr   rs   rt   staticmethodr{   r   r)   r)   r)   r*   ru     s   8 ru   )3r$   Z
__future__r   r]   r0   rb   r'   rd   Zpipr   Z	pip.indexr   Zpip.locationsr   Zpip.downloadr   Zpip.exceptionsr   r   r	   r
   r   Z
pip.compatr   Zpip.baseparserr   r   Zpip.reqr   r   Zpip.status_codesr   r   r   r   r   Z	pip.utilsr   r   r   Zpip.utils.loggingr   Zpip.utils.outdatedr   __all__Z	getLoggerrr   rg   objectr   ru   r)   r)   r)   r*   <module>   s.   
 _