Viewing File: /opt/alt/python35/lib/python3.5/site-packages/setuptools/command/__pycache__/setopt.cpython-35.pyc



\@sddlmZddlmZddlmZddlZddlZddlmZddl	m
Z
ddd	d
gZdddZd
ddZ
Gdd	d	e
ZGdd
d
eZdS))convert_path)log)DistutilsOptionErrorN)configparser)Commandconfig_fileedit_configoption_basesetoptlocalcCs|dkrdS|dkr>tjjtjjtjdS|dkrtjdkr_dpbd}tjjtd	|St	d
|dS)zGet the filename of the distutils, local, global, or per-user config

    `kind` must be one of "local", "global", or "user"
    rz	setup.cfgglobalz
distutils.cfguserposix.z~/%spydistutils.cfgz7config_file() type must be 'local', 'global', or 'user'N)
ospathjoindirname	distutils__file__name
expanduserr
ValueError)kinddotr
/setopt.pyrs	Fc		Cstjd|tj}|j|gx%|jD]\}}|dkrttjd|||j|q9|j|stjd|||j	|x|jD]\}}|dkr tjd||||j
|||j|sLtjd|||j|qtjd|||||j|||qWq9Wtjd||st
|d	}|j|WdQRXdS)
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)rdebugrZRawConfigParserreaditemsinfoZremove_sectionZhas_sectionZadd_sectionZ
remove_optionoptionssetopenwrite)	filenameZsettingsdry_runZoptsZsectionr#optionvaluefrrrr!s8

	
c@sIeZdZdZdddgZddgZddZd
dZdS)r	z<Abstract base class for commands that mess with config files
global-configg0save options to the site-wide distutils.cfg fileuser-configu7save options to the current user's pydistutils.cfg file	filename=r+-configuration file to use (default=setup.cfg)cCsd|_d|_d|_dS)N)
global_configuser_configr')selfrrrinitialize_options\s		zoption_base.initialize_optionscCsg}|jr"|jtd|jr>|jtd|jdk	r]|j|j|sv|jtdt|dkrtd||\|_dS)Nrr
rz/Must specify only one configuration file option)r4appendrr5r'lenr)r6	filenamesrrrfinalize_optionsas			zoption_base.finalize_optionsN)r,r-r.)r/r0r1)r2r+r3)__name__
__module____qualname____doc__user_optionsboolean_optionsr7r<rrrrr	Ls	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)r	r7commandr)	set_valuerL)r6rrrr7s

			zsetopt.initialize_optionscCs`tj||jdks+|jdkr7td|jdkr\|jr\tddS)Nz%Must specify --command *and* --optionz$Must specify --set-value or --remove)r	r<rOr)rrPrL)r6rrrr<s

zsetopt.finalize_optionscCs;t|j|j|jjdd|jii|jdS)N-_)rr'rOr)replacerPr()r6rrrruns$z
setopt.runN)rCrDrE)rFrGrH)rIrJrK)rLrMrN)r=r>r?r@descriptionr	rArBr7r<rTrrrrr
ss
)Zdistutils.utilrrrZdistutils.errorsrrZsetuptools.extern.six.movesrZ
setuptoolsr__all__rrr	r
rrrr<module>s+'
Back to Directory File Manager