�
���c� � � � d dl mZ d dlmZ d dlmZ d dlZd dlZd dlZd dlm Z g d�Z
dd�Zdd
�Z G d� de � � Z
G d
� de
� � ZdS )� )�convert_path)�log)�DistutilsOptionErrorN)�Command)�config_file�edit_config�option_base�setopt�localc �^ � | dk rdS | dk rGt j � t j � t j � � d� � S | dk rCt j dk rdpd}t j � t d |z � � � � S t d
| � � �)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')
�os�path�join�dirname� distutils�__file__�name�
expanduserr �
ValueError)�kind�dots �;/usr/lib/python3/dist-packages/setuptools/command/setopt.pyr r
s� � �
�w����{��x����w�|�|��G�O�O�I�.�/�/��
�
�
� �v�~�~��g�� �(�S�.�B���w�!�!�,�/D�s�/J�"K�"K�L�L�L�
�A�4�� � � Fc �� � t j d| � � t j � � }d� |_ |� | g� � |� � � D �]-\ }}|�,t j d|| � � |� |� � �4|� |� � s+t j d|| � � |�
|� � |� � � D ]�\ }}|�nt j d||| � � |� ||� � |� |� � s+t j d|| � � |� |� � �ut j d|||| � � |�
|||� � ����/t j d | � � |s@t | d
� � 5 }|� |� � ddd� � dS # 1 swxY w Y dS 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 �N� )�xs r �<lambda>zedit_config.<locals>.<lambda>* s � �� r 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�sectionr1 �option�value�fs r r r sR � � �I�-�x�8�8�8��'�)�)�D�"�{�D���I�I�x�j����$�N�N�,�,� 5� 5�����?��H�4�g�x�H�H�H�����(�(�(�(��#�#�G�,�,�
*�� �9�7�H�M�M�M�� � ��)�)�)�!(�����
5�
5�
����=��I�0����� � � �&�&�w��7�7�7��<�<��0�0� 5���!F�!(�(�4� 4� 4��+�+�G�4�4�4���I�3������ � � �H�H�W�f�e�4�4�4�4�!
5�$ �H�\�8�$�$�$�� �
�(�C�
�
� �A��J�J�q�M�M�M� � � � � � � � � � � � ���� � � � � � �� s �1G�G�Gc �. � e Zd ZdZg d�ZddgZd� Zd� 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< |