Your IP : 3.147.82.108


Current Path : /opt/alt/python34/lib64/python3.4/distutils/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/distutils/__pycache__/config.cpython-34.pyc

�
h f
�@sRdZddlZddlmZddlmZdZGdd�de�ZdS)z�distutils.pypirc

Provides the PyPIRCCommand class, the base class for the command classes
that uses .pypirc in the distutils.command package.
�N)�ConfigParser)�CommandzE[distutils]
index-servers =
    pypi

[pypi]
username:%s
password:%s
c@s�eZdZdZdZdZdZdZdddefdgZdgZ	d
d�Z
dd
�Zdd�Zdd�Z
dd�Zdd�ZdS)�
PyPIRCCommandz;Base command that knows how to handle the .pypirc file
    zhttps://upload.pypi.org/legacy/�pypiNzrepository=�rzurl of repository [default: %s]�
show-response�&display full response text from servercCstjjtjjd�d�S)zReturns rc file path.�~z.pypirc)�os�path�join�
expanduser)�self�r�5/opt/alt/python34/lib64/python3.4/distutils/config.py�_get_rc_file&szPyPIRCCommand._get_rc_filecCs[|j�}tjtj|tjtjBd�d��}|jt||f�WdQXdS)zCreates a default .pypirc file.i��wN)rr
�fdopen�open�O_CREAT�O_WRONLY�write�DEFAULT_PYPIRC)r�username�password�rc�frrr�
_store_pypirc*s.zPyPIRCCommand._store_pypirccCsY|j�}tjj|�rU|jd|�|jp>|j}|jpP|j}t	�}|j
|�|j�}d|kr�|jdd�}dd�|j
d�D�}|gkr�d|kr�dg}q�iSnxu|D]�}i|d6}	|j|d	�|	d	<xdd
|jfd|jfdfD]A\}
}|j||
�rc|j||
�|	|
<q,||	|
<q,W|dkr�||jdfkr�|j|	d
<|	S|	d|ks�|	d
|kr�|	Sq�WqUd|krUd}|j|d
�r|j|d
�}n	|j}i|j|d	�d	6|j|d�d6|d
6|d6|jd6SniS)zReads the .pypirc file.zUsing PyPI login from %sZ	distutilsz
index-serverscSs.g|]$}|j�dkr|j��qS)�)�strip)�.0�serverrrr�
<listcomp>>s	z.PyPIRCCommand._read_pypirc.<locals>.<listcomp>�
rr!r�
repository�realmrNzserver-login)zpasswordN)rr
r�existsZannouncer$�DEFAULT_REPOSITORYr%�
DEFAULT_REALMr�read�sections�get�splitZ
has_option)rrr$r%�configr*Z
index_serversZ_serversr!Zcurrent�key�defaultrrr�_read_pypirc0sX	
	

	
	zPyPIRCCommand._read_pypirccCsPddl}|jdd�}|j|�djdd�}|j�j|�S)z%Read and decode a PyPI HTTP response.rNzcontent-typez
text/plain��charset�ascii)�cgiZ	getheaderZparse_headerr+r)�decode)rZresponser4Zcontent_type�encodingrrr�_read_pypi_responseqsz!PyPIRCCommand._read_pypi_responsecCsd|_d|_d|_dS)zInitialize options.Nr)r$r%Z
show_response)rrrr�initialize_optionsxs		z PyPIRCCommand.initialize_optionscCs@|jdkr|j|_n|jdkr<|j|_ndS)zFinalizes options.N)r$r'r%r()rrrr�finalize_options~szPyPIRCCommand.finalize_options)rNr)�__name__�
__module__�__qualname__�__doc__r'r(r$r%Zuser_optionsZboolean_optionsrrr0r7r8r9rrrrrs"		Ar)r=r
ZconfigparserrZ
distutils.cmdrrrrrrr�<module>s



?>