
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
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pªddddœdœ|t	t
d dd|jrÌd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+ �rÔt,|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é   z�Python 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|ƒ q°W q˜W |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.   
 _