U +a@sddlmZddlmZddlmZddlZddlZddlZddlm Z dddd gZ dd dZ dd dZ Gddde Z Gdd d e ZdS)) convert_path)log)DistutilsOptionErrorN)Command config_file edit_config option_basesetoptlocalcCsh|dkr dS|dkr,tjtjtjdS|dkrZtjdkrBdpDd}tjtd |St d |d S) zGet the filename of the distutils, local, global, or per-user config `kind` must be one of "local", "global", or "user" r z setup.cfgglobalz distutils.cfguserposix.z~/%spydistutils.cfgz7config_file() type must be 'local', 'global', or 'user'N) ospathjoindirname distutils__file__name expanduserr ValueError)kinddotrA/tmp/pip-install-1bd_1mtk/setuptools/setuptools/command/setopt.pyr s Fc Cs&td|t}||g|D]\}}|dkrRtd||||q(||sttd||| ||D]p\}}|dkrtd|||| ||| |std||||q|td||||| |||q|q(td||s"t |d }||W5QRXdS) 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. 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 %sw)rdebug configparserRawConfigParserreaditemsinforemove_section has_section add_section remove_optionoptionssetopenwrite) filenamesettingsdry_runoptssectionr(optionvaluefrrrr sJ          c@s2eZdZdZdddgZddgZddZd d Zd S) rz|js>tddS)Nz%Must specify --command *and* --optionz$Must specify --set-value or --remove)rrBrNr1rrOrLr;rrrrBs  zsetopt.finalize_optionscCs*t|j|j|jdd|jii|jdS)N-_)rr,rNr1replacerOr.r;rrrrunsz setopt.runN) rCrDrErF descriptionrrGrHr=rBrSrrrrr rs )r )F)distutils.utilrrrdistutils.errorsrrr setuptoolsr__all__rrrr rrrrs       +'