_d?ddlmZddlmZddlmZddlZddlZddlZddlm Z gdZ d dZ ddZ Gd d e Z Gd d e Zy)) convert_path)log)DistutilsOptionErrorN)Command) config_file edit_config option_basesetoptc\|dk(ry|dk(rKtjjtjjtj dS|dk(rFtj dk(xrdxsd}tjjtd |zStd |) zGet the filename of the distutils, local, global, or per-user config `kind` must be one of "local", "global", or "user" localz setup.cfgglobalz distutils.cfguserposix.z~/%spydistutils.cfgz7config_file() type must be 'local', 'global', or 'user') ospathjoindirname distutils__file__name expanduserr ValueError)kinddots ;/usr/lib/python3/dist-packages/setuptools/command/setopt.pyrr s  w xww||BGGOOI,>,>?QQ v~gg (S.Bww!!,/Ds/J"KLL NPT UUc ttjd|tj}d|_|j |g|j D]\}}|)tjd|||j|2|j|s(tjd|||j||j D]\}}|etjd||||j|||j|rDtjd|||j|mtjd|||||j|||tjd ||s't|d 5}|j|dddyy#1swYyxYw) 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 %sc|SN)xs rzedit_config..&srNzDeleting 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_runoptssectionr1optionvaluefs rrrsII-x8  ' ' )D"DIIxj$NN,5 ? HH4gx H    (##G, 97HM  )!( 5 =II6R&&w7<<0A7H++G4II3WfeXHHWfe4 55.HH\8$  (C  A JJqM     s F..F7c,eZdZdZgdZddgZdZdZy)r zr@c.d|_d|_d|_yr!) global_config user_configr5selfs rinitialize_optionszoption_base.initialize_optionsSs! rclg}|jr|jtd|jr|jtd|j|j|j|s|jtdt |dkDr t d||\|_y)Nr rr z/Must specify only one configuration file option)rCappendrrDr5lenr)rF filenamess rfinalize_optionszoption_base.finalize_optionsXs      [2 3      [0 1 == $   T]] +   [1 2 y>A &A9 %rN)__name__ __module__ __qualname____doc__ user_optionsboolean_optionsrGrMr"rrr r Es%FL O  %rr cheZdZdZdZgdej zZejdgzZdZdZ dZ y) 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 valuerXcftj|d|_d|_d|_d|_yr!)r rGcommandr: set_valuerXrEs rrGzsetopt.initialize_optionsws,&&t,   rctj||j |j t d|j |j s t dyy)Nz%Must specify --command *and* --optionz$Must specify --set-value or --remove)r rMr[r:rr\rXrEs rrMzsetopt.finalize_options~sS$$T* << 4;;#6&'NO O >> !$++&'MN N+6 !rct|j|j|jj dd|j ii|j y)N-_)rr5r[r:replacer\r7rEs rrunz setopt.runs> MM \\DKK//S94>>J K LL rN) rNrOrPrQ descriptionr rRrSrGrMrbr"rrr r isE-EK   !L"11XJ>OO rr )r )F)distutils.utilrrrdistutils.errorsrrr' setuptoolsr__all__rrr r r"rrrhsD'1  A V&R!%'!%H! [! r