U e@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)kinddotrG/opt/hc_python/lib/python3.8/site-packages/setuptools/command/setopt.pyr s Fc Cs0td|t}dd|_||g|D]\}}|dkr\td||||q2| |s~td||| ||D]p\}}|dkrtd|||| ||| |std||||qtd ||||| |||qq2td ||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 %scSs|SNr)xrrr*zedit_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 sL           c@s2eZdZdZdddgZddgZddZd d Zd S) rzr1lenr)r@ filenamesrrrfinalize_optionsas   zoption_base.finalize_optionsN)__name__ __module__ __qualname____doc__ user_optionsboolean_optionsrArFrrrrrLs c@sJeZdZdZdZddddgejZejdgZdd Zd d Z d d Z dS)r z#Save command-line options to a filez1set an option in setup.cfg or another config file)zcommand=czcommand to set an option for)zoption=oz option to set)z set-value=szvalue of the option)removerzremove (unset) the valuerPcCs&t|d|_d|_d|_d|_dSr)rrAcommandr6 set_valuerPr?rrrrAs  zsetopt.initialize_optionscCsBt||jdks|jdkr&td|jdkr>|js>tddS)Nz%Must specify --command *and* --optionz$Must specify --set-value or --remove)rrFrRr6rrSrPr?rrrrFs  zsetopt.finalize_optionscCs*t|j|j|jdd|jii|jdS)N-_)rr1rRr6replacerSr3r?rrrrunsz setopt.runN) rGrHrIrJ descriptionrrKrLrArFrWrrrrr ss )r )F)distutils.utilrrrdistutils.errorsrrr# setuptoolsr__all__rrrr rrrrs       ,'