3
Q'ícÝ ã @ s d dl mZ d dlmZ d dlmZ d dlZd dlZd dlmZ d dl m
Z
ddd d
gZdddZdddZ
G dd d e
ZG dd
d
eZdS )é )Úconvert_path)Úlog)ÚDistutilsOptionErrorN)Úconfigparser)ÚCommandÚconfig_fileÚedit_configÚoption_baseÚsetoptÚlocalc C sh | dkrdS | dkr,t jjt jjtjdS | dkrZt jdkrBdpDd}t jjtd | S t d
| dS )zGet 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 ú?/tmp/pip-build-l_bcah40/setuptools/setuptools/command/setopt.pyr s Fc C s. t jd| tj }|j| g xÖ|j D ]Ê\}}|dkrTt jd|| |j| q*|j|svt jd|| |j | x||j D ]p\}}|dkrÐt jd||| |j
|| |j|sðt jd|| |j| qt jd|||| |j||| qW q*W t jd| |s*t
| d }|j| W dQ R X dS )
aY Edit 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.
zReading 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)r Údebugr ÚRawConfigParserÚreadÚitemsÚinfoÚremove_sectionÚhas_sectionÚadd_sectionÚ
remove_optionÚoptionsÚsetÚopenÚwrite) ÚfilenameÚsettingsÚdry_runÚoptsÚsectionr( ÚoptionÚvalueÚfr r r r ! s8
c @ s2 e Zd ZdZdddgZddgZdd Zd
d ZdS )r z<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)c C s d | _ d | _d | _d S )N)Ú
global_configÚuser_configr, )Úselfr r r Úinitialize_options\ s zoption_base.initialize_optionsc C sv g }| j r|jtd | jr,|jtd | jd k rB|j| j |sT|jtd t|dkrjtd||\| _d S )Nr r