Your IP : 3.22.74.192
a
(�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 ��/builddir/build/BUILDROOT/alt-python39-setuptools-58.3.0-2.el8.x86_64/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�configparser�RawConfigParser�optionxform�read�items�info�remove_section�has_section�add_section�
remove_option�options�set�open�write) �filename�settings�dry_run�opts�sectionr- �option�value�fr r r r s@
�
��r c @ s0 e Zd ZdZg d�ZddgZdd� Zdd� Zd S )
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=r8 z-configuration file to use (default=setup.cfg)r9 r; c C s d | _ d | _d | _d S r )�
global_config�user_configr1 ��selfr r r �initialize_options\ s zoption_base.initialize_optionsc C sv g }| j r|�td�� | jr,|�td�� | jd urB|�| j� |sT|�td�� t|�dkrjtd|��|\| _d S )Nr r r
� z/Must specify only one configuration file option)r= �appendr r>