HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/setuptools/command/__pycache__/setopt.cpython-310.pyc
o

��h��@s�ddlZddlZddlmZddlmZddlZddlmZddlm	Z	ddl
mZgd�Zdd
d�Z
dd
d�ZGdd�de�ZGdd�de�ZdS)�N�)�Command)�_cfg_read_utf8_with_fallback)�log)�DistutilsOptionError)�convert_path)�config_file�edit_config�option_base�setopt�localcCsh|dkrdS|dkrtj�tj�tj�d�S|dkr/tjdkr!dp"d}tj�td	|�d
���St	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~/zpydistutils.cfgz7config_file() type must be 'local', 'global', or 'user')
�os�path�join�dirname�	distutils�__file__�name�
expanduserr�
ValueError)�kind�dot�r�D/usr/local/lib/python3.10/dist-packages/setuptools/command/setopt.pyrs
rFc		CsJt�d|�t��}dd�|_t||�|��D]c\}}|dur-t�d||�|�|�q|�	|�s>t�d||�|�
|�|��D]8\}}|durjt�d|||�|�||�|�|�sit�d||�|�|�qBt�d	||||�|�
|||�qBqt�d
|�|s�t|ddd
��}|�|�Wd�dS1s�wYdSdS)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 %scSs|S�Nr)�	optionstrrrr�<lambda>(szedit_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�sectionr.�option�value�frrrr	s@




�
�
��"��r	c@s0eZdZdZgd�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=r9z-configuration file to use (default=setup.cfg)r:r<cCsd|_d|_d|_dSr)�
global_config�user_configr2��selfrrr�initialize_optionsVs
zoption_base.initialize_optionscCsvg}|jr|�td��|jr|�td��|jdur!|�|j�|s*|�td��t|�dkr5td|��|\|_dS)Nr
rr�z/Must specify only one configuration file option)r>�appendrr?r2�lenr)rA�	filenamesrrr�finalize_options[s
�zoption_base.finalize_optionsN)�__name__�
__module__�__qualname__�__doc__�user_options�boolean_optionsrBrGrrrrr
Hs�r
c@sJeZdZdZdZgd�ejZejdgZdd�Zd
d	d
�Z	d
dd�Z
dS)rz#Save command-line options to a filez1set an option in setup.cfg or another config file))zcommand=�czcommand to set an option for)zoption=�oz
option to set)z
set-value=�szvalue of the option)�remove�rzremove (unset) the valuerQcCs&t�|�d|_d|_d|_d|_dSr)r
rB�commandr7�	set_valuerQr@rrrrBzs


zsetopt.initialize_options�returnNcCsFt�|�|jdus|jdurtd��|jdur|js!td��dSdS)Nz%Must specify --command *and* --optionz$Must specify --set-value or --remove)r
rGrSr7rrTrQr@rrrrG�s
�zsetopt.finalize_optionscCs*t|j|j|j�dd�|jii|j�dS)N�-�_)r	r2rSr7�replacerTr4r@rrr�run�s
�z
setopt.run)rUN)rHrIrJrK�descriptionr
rLrMrBrGrYrrrrrls�
r)r)F)r%rrr�
unicode_utilsrrr�distutils.errorsr�distutils.utilr�__all__rr	r
rrrrr�<module>s

*$