AlkantarClanX12

Your IP : 3.135.247.17


Current Path : /opt/alt/python34/lib/python3.4/site-packages/pip/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib/python3.4/site-packages/pip/__pycache__/basecommand.cpython-34.pyc

�
�Re��@sUdZddlZddlZddlZddlZddlZddlZddlmZddl	m
Z
ddlmZddl
mZddlmZmZmZmZmZddlmZdd	lmZmZdd
lmZmZmZmZmZddl m!Z!dgZ"Gd
d�de#�Z$ddd�Z%ddd�Z&dS)z(Base Command class, and related routines�N)�
cmdoptions)�running_under_virtualenv)�logger)�
PipSession)�
BadCommand�InstallationError�UninstallationError�CommandError�PreviousBuildDirError)�StringIO)�ConfigOptionParser�UpdatingDefaultsHelpFormatter)�SUCCESS�ERROR�
UNKNOWN_ERROR�VIRTUALENV_NOT_FOUND�PREVIOUS_BUILD_DIR_ERROR)�get_prog�Commandc@s^eZdZdZdZdZdd�Zdd�Zdd�Zd	d
�Z	dd�Z
dS)
rNFcCs�i|jd6dt�|jfd6t�d6dd6|jd6|jd6}t|�|_d	|jj�}tj	|j|�|_
tjtj
|j�}|jj|�dS)
N�usagez%s %s�prog�	formatterF�add_help_option�name�descriptionz
%s Options)rrrr
�__doc__r�parser�
capitalize�optparse�OptionGroup�cmd_optsr�make_option_group�
general_group�add_option_group)�self�	parser_kw�
optgroup_name�gen_opts�r(�*/tmp/pip-ztkk0jow-build/pip/basecommand.py�__init__s



zCommand.__init__cCsvt�}|jr!|j|_n|jr9|j|_n|jrbi|jd6|jd6|_n|j|j_|S)N�http�https)	r�cert�verify�timeout�proxy�proxies�no_input�auth�	prompting)r$�options�sessionr(r(r)�_build_session3s				
zCommand._build_sessioncCsdS)Nr()r$r(r(r)�
setup_loggingJszCommand.setup_loggingcCs|jj|�S)N)r�
parse_args)r$�argsr(r(r)r9MszCommand.parse_argscCs�|j|�\}}d}||j7}||j8}tjd|�}g}tj|tjftj|j	f�|j
r�dt_n|j�|j
r�dtjd<n|jr�dj|j�tjd<n|jrt�stjd�tjt�qn|jr6t|jd	�}tjtj|f�nd}t}d
}y.|j||�}t|t�ru|}nWn�tk
r�tj�d}	tjt|	��tj dt!��d}t"}Yn`t#t$fk
r'tj�d}	tjt|	��tj dt!��d}t%}Ynt&k
r{tj�d}	tjt|	��tj dt!��d}t%}Yn�t'k
r�tj�d}	tjd|	�tj dt!��t%}Ynft(k
rtjd
�tj dt!��d}t%}Yn(tjdt!��d}t)}YnX|r�|j*}
dj|�}yt|
d�}Wn<t+k
r�t,j-dd
�}
|
j.}
t|
d�}YnXtjd|
�|j/|�|j0�n|dk	r�|j0�n|S)N��T�1�PIP_NO_INPUT� �PIP_EXISTS_ACTIONz2Could not find an activated virtualenv (required).�aFzException information:
%sz	ERROR: %szOperation cancelled by userz
Exception:
%s�
�w�deletez#Storing debug log for failure in %s)1r9�verbose�quietr�level_for_integer�
add_consumers�sys�stdout�DEBUG�append�log_explicit_levels�explicit_levelsr8r2�os�environ�
exists_action�join�require_venvr�fatal�exitr�log�open_logfiler�run�
isinstance�intr
�exc_info�str�info�
format_excrrrrrr	�KeyboardInterruptr�log_file�IOError�tempfile�NamedTemporaryFiler�write�close)r$r:r5�level�complete_log�log_fprU�	store_log�status�e�log_file_fn�text�log_file_fp�tempr(r(r)�mainQs�

	
				
	










	
	


zCommand.main)�__name__�
__module__�__qualname__rr�hiddenr*r7r8r9rpr(r(r(r)rscCsG|dkrtj�}nt�}tj|td|��|j�S)N�file)rIr[r�	traceback�print_exception�dict�getvalue)r[�outr(r(r)r^�s
	r^rAcCs�tjj|�}tjj|�}tjj|�}tjj|�sXtj|�ntjj|�}t||�}|r�|jddd�|jdt	j
dtjd�f�n|S)z�Open the named log file in append mode.

    If the file already exists, a separator will also be printed to
    the file to separate past activity from current activity.
    z%s
�-�<z
%s run on %s
rz%c)
rO�path�
expanduser�abspath�dirname�exists�makedirs�openrdrI�argv�time�strftime)�filename�moder�r�rhr(r(r)rW�s*rW)'rrOrIrbrvr�r�pipr�
pip.locationsr�pip.logr�pip.downloadr�pip.exceptionsrrrr	r
Zpip.backwardcompatr�pip.baseparserrr
�pip.status_codesrrrrr�pip.utilr�__all__�objectrr^rWr(r(r(r)�<module>s&((	�