ruạṛ
a �u:j� � @ s� d dl Z d dlZddlmZ ddlmZ d dlZd dlmZ d dlm Z d dl mZ g d�Zdd d�Z ddd �dd�ZG dd� de�ZG dd� de�ZdS )� N� )�Command)�_cfg_read_utf8_with_fallback)�log)�DistutilsOptionError)�convert_path)�config_file�edit_config�option_base�setopt�localc C sl | dkrdS | dkr,t j�t j�tj�d�S | dkr^t jdkrBdpDd}t j�td |� d ���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~/zpydistutils.cfgz7config_file() type must be 'local', 'global', or 'user'N) �os�path�join�dirname� distutils�__file__�name� expanduserr � ValueError)�kind�dot� r �L/opt/bart/bart_venv/lib/python3.9/site-packages/setuptools/command/setopt.pyr s r F��returnc C sH t �d| � t�� }dd� |_t|| � |�� D ]�\}}|du rZt �d|| � |�|� q0|� |�s|t �d|| � |� |� |�� D ]p\}}|du r�t �d||| � |�||� |�|�s�t �d|| � |�|� q�t �d |||| � |� |||� q�q0t �d | � |�sDt| ddd ��}|�|� W d � n1 �s:0 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 )� optionstrr 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�wzutf-8)�encoding)r �debug�configparser�RawConfigParser�optionxformr �items�info�remove_section�has_section�add_section� remove_option�options�set�open�write) �filename�settings�dry_run�opts�sectionr1 �option�value�fr r r r s8 � �r c @ s6 e Zd ZdZg d�ZddgZdd� Zdd�d d �ZdS )r z<Abstract base class for commands that mess with config files))� global-config�gz0save options to the site-wide distutils.cfg file)�user-config�uz7save options to the current user's pydistutils.cfg file)z filename=r<