Submit
Path:
~
/
/
proc
/
thread-self
/
root
/
opt
/
alt
/
python39
/
lib
/
python3.9
/
site-packages
/
setuptools
/
command
/
__pycache__
/
File Content:
setopt.cpython-39.pyc
a N�Re� � @ s� d dl mZ d dlmZ d dlmZ d dlZd dlZd dlZd dlm Z g d�Z ddd �Zddd�ZG d d� de �Z G dd� de �ZdS )� )�convert_path)�log)�DistutilsOptionErrorN)�Command)�config_file�edit_config�option_base�setopt�localc C sh | dkrdS | dkr,t j�t j�tj�d�S | dkrZt jdkrBdpDd}t j�td | ��S t d | ��dS )z�Get the filename of the distutils, local, global, or per-user config `kind` must be one of "local", "global", or "user" r z setup.cfg�globalz distutils.cfg�user�posix�.� z~/%spydistutils.cfgz7config_file() type must be 'local', 'global', or 'user'N) �os�path�join�dirname� distutils�__file__�name� expanduserr � ValueError)�kind�dot� r �J/opt/alt/python39/lib/python3.9/site-packages/setuptools/command/setopt.pyr s ��r Fc C sF t �d| � t�� }dd� |_|�| g� |�� D ]�\}}|du r\t �d|| � |�|� q2|� |�s~t �d|| � |� |� |�� D ]p\}}|du r�t �d||| � |�||� |�|�s�t �d|| � |�|� q�t �d |||| � |� |||� q�q2t �d | � |�sBt| d��}|�|� W d � n1 �s80 Y dS )aY Edit 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 S s | S �Nr )�xr r r �<lambda>* � zedit_config.<locals>.<lambda>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 %s�w)r �debug�configparserZRawConfigParserZoptionxform�read�items�infoZremove_sectionZhas_sectionZadd_sectionZ remove_option�options�set�open�write) �filenameZsettings�dry_runZoptsZsectionr'