Viewing File: /usr/lib/python3.6/site-packages/setuptools/command/__pycache__/setopt.cpython-36.pyc

3

Xoh@sddlmZddlmZddlmZddlZddlZddlmZddl	m
Z
ddd	d
gZdddZdddZ
Gdd	d	e
ZGdd
d
eZdS))convert_path)log)DistutilsOptionErrorN)configparser)Commandconfig_fileedit_configoption_basesetoptlocalcCsh|dkrdS|dkr,tjjtjjtjdS|dkrZtjdkrBdpDd}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)Zkinddotr/usr/lib/python3.6/setopt.pyrsFc		Cs.tjd|tj}|j|gx|jD]\}}|dkrTtjd|||j|q*|j|svtjd|||j	|x||jD]p\}}|dkrtjd||||j
|||j|stjd|||j|qtjd|||||j|||qWq*Wtjd||s*t
|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@s2eZdZdZdddgZddgZdd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\szoption_base.initialize_optionscCsvg}|jr|jtd|jr,|jtd|jdk	rB|j|j|sT|jtdt|dkrjtd||\|_dS)Nrr
rz/Must specify only one configuration file option)r3appendrr4r&lenr)r5	filenamesrrrfinalize_optionsas
zoption_base.finalize_optionsN)r+r,r-)r.r/r0)r1r*r2)__name__
__module____qualname____doc__user_optionsboolean_optionsr6r;rrrrr	Lsc@sJeZdZdZdZddddgejZejd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 valuecCs&tj|d|_d|_d|_d|_dS)N)r	r6commandr(	set_valuerK)r5rrrr6s

zsetopt.initialize_optionscCsDtj||jdks|jdkr&td|jdkr@|jr@tddS)Nz%Must specify --command *and* --optionz$Must specify --set-value or --remove)r	r;rNr(rrOrK)r5rrrr;s

zsetopt.finalize_optionscCs*t|j|j|jjdd|jii|jdS)N-_)rr&rNr(replacerOr')r5rrrrunsz
setopt.runN)rBrCrD)rErFrG)rHrIrJ)rKrLrM)r<r=r>r?descriptionr	r@rAr6r;rSrrrrr
ss)r)F)Zdistutils.utilrrrZdistutils.errorsrrZsetuptools.extern.six.movesrZ
setuptoolsr__all__rrr	r
rrrr<module>s

+'
Back to Directory File Manager