MRe@sddlZddlZddlmZddlmZddlmZddlTdddd gZd d dZ d d dZ GdddeZ Gdd d e Z dS)N)Command) convert_path)log)* config_file edit_config option_basesetoptlocalcCs|dkrdS|dkr>tjjtjjtjdS|dkrtjdkr_dpbd}tjjtd |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)kinddotr4/tmp/pip-l4uy7dan-build/setuptools/command/setopt.pyr s    Fc Csddlm}tjd||j}|j|gx+|jD]\}}|dkrtjd|||j|qI|j |stjd|||j |nx|jD]\}}|dkr6tjd||||j |||j |sbtjd|||j|qbqtjd |||||j |||qWqIWtjd ||st|d } |j| | jndS) 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 %sw)Zsetuptools.compatrrdebugRawConfigParserreaditemsinforemove_section has_section add_section remove_optionoptionssetopenwriteclose) filenameZsettingsdry_runroptssectionr(optionvaluefrrrr*s:        c@sIeZdZdZdddgZddgZd d Zd dZdS)rz filenamesrrrfinalize_optionshs   zoption_base.finalize_optionsN)r4r5r6)r7r8r9)r:r3r;)__name__ __module__ __qualname____doc__ user_optionsboolean_optionsr?rErrrrrSs    c@sieZdZdZdZddddgejZejd gZddZddZ ddZ dS)r z#Save command-line options to a filez1set an option in setup.cfg or another config filecommand=ccommand to set an option foroption=o option to set set-value=svalue of the optionremoverremove (unset) the valuecCs5tj|d|_d|_d|_d|_dS)N)rr?commandr1 set_valuerU)r>rrrr?s     zsetopt.initialize_optionscCsftj||jdks+|jdkr:tdn|jdkrb|j rbtdndS)Nz%Must specify --command *and* --optionz$Must specify --set-value or --remove)rrErXr1rCrYrU)r>rrrrEs  zsetopt.finalize_optionscCs=t|jii|j|jjdd6|j6|jdS)N-_)rr-rYr1replacerXr.)r>rrrruns #z setopt.runN)rLrMrN)rOrPrQ)rRrSrT)zremoverVrW) rFrGrHrI descriptionrrJrKr?rEr]rrrrr |s    ) rr setuptoolsrdistutils.utilrrdistutils.errors__all__rrrr rrrrs  ))