3
ÄvhÝ ã @ s� d dl mZ d dlmZ d dlmZ d dlZd dlZd dlmZ d dl m
Z
ddd d
gZddd„Zddd„Z
G dd „ d e
ƒZG dd
„ d
eƒZdS )é )Úconvert_path)Úlog)ÚDistutilsOptionErrorN)Úconfigparser)ÚCommandÚconfig_fileÚedit_configÚoption_baseÚsetoptÚlocalc C sh | dkrdS | dkr,t jjt jjtjƒdƒS | dkrZt jdkrBdpDd}t jjtd | ƒƒS t 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)ZkindÚdot© r ú/usr/lib/python3.6/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|ƒ q€t jd|||| ƒ |j|||ƒ q€W 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 ZRawConfigParserÚreadÚitemsÚinfoZremove_sectionZhas_sectionZadd_sectionZ
remove_optionÚoptionsÚsetÚopenÚwrite) ÚfilenameZsettingsÚdry_runZoptsZsectionr" ÚoptionÚvalueÚfr r r r ! s8
c @ s2 e Zd ZdZdddgZddgZdd„ Zd
d„ ZdS )r z