o _a@sddlmZddlmZddlmZddlZddlZddlZddlm Z gdZ ddd Z dd d Z Gd dde Z Gddde ZdS)) convert_path)log)DistutilsOptionErrorN)Command) config_file edit_config option_basesetoptlocalcCsd|dkrdS|dkrtjtjtjdS|dkr-tjdkr!dp"d}tjtd |St d |) 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') ospathjoindirname distutils__file__name expanduserr ValueError)kinddotr;/usr/lib/python3/dist-packages/setuptools/command/setopt.pyr srFc CsHtd|t}dd|_||g|D]c\}}|dur.td||||q| |s?td||| ||D]8\}}|durktd|||| ||| |sjtd||||qCtd ||||| |||qCqtd ||st|d }||WddS1swYdSdS) 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 %scSs|SNr)xrrr*szedit_config..NzDeleting 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 configparserRawConfigParser optionxformreaditemsinforemove_section has_section add_section remove_optionoptionssetopenwrite) filenamesettingsdry_runoptssectionr,optionvaluefrrrr sH            "rc@s0eZdZdZgdZddgZddZddZd S) rzrrrr@s  zsetopt.initialize_optionscCsFt||jdus|jdurtd|jdur|js!tddSdS)Nz%Must specify --command *and* --optionz$Must specify --set-value or --remove)rrErQr5rrRrOr>rrrrEs zsetopt.finalize_optionscCs*t|j|j|jdd|jii|jdS)N-_)rr0rQr5replacerRr2r>rrrruns z setopt.runN) rFrGrHrI descriptionrrJrKr@rErVrrrrr ss  r )r )F)distutils.utilrrrdistutils.errorsrrr" setuptoolsr__all__rrrr rrrrs     ,'