Your IP : 18.220.134.161


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

�
M�Re��@s�ddlZddlZddlmZddlmZddlmZddlTdddd	gZd
dd�Z	dd
d�Z
Gdd�de�ZGdd	�d	e�ZdS)�N)�Command)�convert_path)�log)�*�config_file�edit_config�option_base�setopt�localcCs�|dkrdS|dkr>tjjtjjtj�d�S|dkrtjdkr_dpbd}tjjtd	|��St	d
|��dS)z�Get the filename of the distutils, local, global, or per-user config

    `kind` must be one of "local", "global", or "user"
    r
z	setup.cfg�globalz
distutils.cfg�user�posix�.�z~/%spydistutils.cfgz7config_file() type must be 'local', 'global', or 'user'N)
�os�path�join�dirname�	distutils�__file__�name�
expanduserr�
ValueError)�kind�dot�r�4/tmp/pip-l4uy7dan-build/setuptools/command/setopt.pyr
s	Fc
Cs�ddlm}tjd|�|j�}|j|g�x+|j�D]\}}|dkr�tjd||�|j|�qI|j	|�s�tjd||�|j
|�nx�|j�D]�\}}|dkr6tjd|||�|j||�|j|�sbtjd||�|j|�qbq�tjd	||||�|j
|||�q�WqIWtjd
|�|s�t|d�}	|j|	�|	j�ndS)aYEdit a configuration file to include `settings`

    `settings` is a dictionary of dictionaries or ``None`` values, keyed by
    command/section name.  A ``None`` value means to delete the entire section,
    while a dictionary lists settings to be changed or deleted in that section.
    A setting of ``None`` means to delete that setting.
    r)�ConfigParserzReading configuration from %sNzDeleting section [%s] from %szAdding new section [%s] to %szDeleting %s.%s from %sz#Deleting empty [%s] section from %szSetting %s.%s to %r in %sz
Writing %s�w)Zsetuptools.compatrr�debug�RawConfigParser�read�items�info�remove_section�has_section�add_section�
remove_option�options�set�open�write�close)
�filenameZsettings�dry_runr�opts�sectionr(�option�value�frrrr*s:	
	

c@sIeZdZdZdddgZddgZdd�Zd
d�ZdS)rz<Abstract base class for commands that mess with config files�
global-config�g�0save options to the site-wide distutils.cfg file�user-config�u�7save options to the current user's pydistutils.cfg file�	filename=r3�-configuration file to use (default=setup.cfg)cCsd|_d|_d|_dS)N)�
global_config�user_configr-)�selfrrr�initialize_optionscs		zoption_base.initialize_optionscCs�g}|jr%|jtd��n|jrD|jtd��n|jdk	rf|j|j�n|s�|jtd��nt|�dkr�td|��n|\|_dS)Nrrr
�z/Must specify only one configuration file option)r<�appendrr=r-�len�DistutilsOptionError)r>�	filenamesrrr�finalize_optionshs		zoption_base.finalize_optionsN)r4r5r6)r7r8r9)r:r3r;)�__name__�
__module__�__qualname__�__doc__�user_options�boolean_optionsr?rErrrrrSs	c@sieZdZdZdZddddgejZejdgZdd�Zdd�Z	dd�Z
dS)r	z#Save command-line options to a filez1set an option in setup.cfg or another config file�command=�c�command to set an option for�option=�o�
option to set�
set-value=�s�value of the option�remove�r�remove (unset) the valuecCs5tj|�d|_d|_d|_d|_dS)N)rr?�commandr1�	set_valuerU)r>rrrr?�s

			zsetopt.initialize_optionscCsftj|�|jdks+|jdkr:td��n|jdkrb|jrbtd��ndS)Nz%Must specify --command *and* --optionz$Must specify --set-value or --remove)rrErXr1rCrYrU)r>rrrrE�s

zsetopt.finalize_optionscCs=t|jii|j|jjdd�6|j6|j�dS)N�-�_)rr-rYr1�replacerXr.)r>rrr�run�s	#z
setopt.runN)rLrMrN)rOrPrQ)rRrSrT)zremoverVrW)rFrGrHrI�descriptionrrJrKr?rEr]rrrrr	|s
)
rr�
setuptoolsr�distutils.utilrr�distutils.errors�__all__rrrr	rrrr�<module>s
 ))

?>