
    09oe                         d dl mZ d dlmZ d dlmZ d dlZd dlZd dlZd dlm	Z	 g dZ
ddZdd
Z G d de	          Z G d de          ZdS )    )convert_path)log)DistutilsOptionErrorN)Command)config_fileedit_configoption_basesetoptlocalc                 ^   | dk    rdS | dk    rGt           j                            t           j                            t          j                  d          S | dk    rCt           j        dk    rdpd}t           j                            t          d	|z                      S t          d
|           )zGet 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     RD:\Python Project\StaffProfile\venv\Lib\site-packages\setuptools/command/setopt.pyr   r      s    
 w{xw||GOOI.//
 
 	
 v~~g (S.Bw!!,/Ds/J"K"KLLL
A4      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 }|                    |           ddd           dS # 1 swxY w Y   dS dS )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.
    zReading configuration from %sc                     | S N )xs    r   <lambda>zedit_config.<locals>.<lambda>*   s     r   NzDeleting section [%s] from %szAdding new section [%s] to %szDeleting %s.%s from %sz#Deleting empty [%s] section from %szSetting %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IIxj$NN,, 5 5?H4gxHHH((((##G,, *	97HMMM  )))!( 5 5=I0   &&w777<<00 5!F!((4 4 4++G444I3   HHWfe4444!5$ H\8$$$ (C   	AJJqMMM	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 s   1GGGc                   .    e Zd ZdZg dZddgZd Zd Zd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=r<   z-configuration file to use (default=setup.cfg)r>   r@   c                 0    d | _         d | _        d | _        d S r!   )global_configuser_configr5   selfs    r   initialize_optionszoption_base.initialize_options\   s    !r   c                    g }| j         r"|                    t          d                     | j        r"|                    t          d                     | j        |                    | j                   |s"|                    t          d                     t          |          dk    rt          d|          |\  | _        d S )Nr   r   r      z/Must specify only one configuration file option)rC   appendr   rD   r5   lenr   )rF   	filenamess     r   finalize_optionszoption_base.finalize_optionsa   s    	 	4[22333 	2[00111=$T]+++ 	3[11222y>>A&A   #r   N)__name__
__module____qualname____doc__user_optionsboolean_optionsrG   rM   r"   r   r   r	   r	   L   sW        FF  L 	O  
# # # # #r   r	   c                   V    e Zd ZdZdZg dej        z   Zej        dgz   Zd Zd Z	d Z
dS )	r
   z#Save command-line options to a filez1set an option in setup.cfg or another config file))zcommand=czcommand to set an option for)zoption=ozoption to set)z
set-value=szvalue of the option)removerzremove (unset) the valuerX   c                 r    t                               |            d | _        d | _        d | _        d | _        d S r!   )r	   rG   commandr:   	set_valuerX   rE   s    r   rG   zsetopt.initialize_options   s6    &&t,,,r   c                     t                               |            | j        | j        t	          d          | j        | j        st	          d          d S d S )Nz%Must specify --command *and* --optionz$Must specify --set-value or --remove)r	   rM   r[   r:   r   r\   rX   rE   s    r   rM   zsetopt.finalize_options   s`    $$T***<4;#6&'NOOO>!$+!&'MNNN "!!!r   c                     t          | j        | j        | j                            dd          | j        ii| j                   d S )N-_)r   r5   r[   r:   replacer\   r7   rE   s    r   runz
setopt.run   sO    Mt{223<<dnM L		
 	
 	
 	
 	
r   N)rN   rO   rP   rQ   descriptionr	   rR   rS   rG   rM   rb   r"   r   r   r
   r
   s   s~        --EK  
 	 !L "1XJ>O  O O O
 
 
 
 
r   r
   )r   )F)distutils.utilr   r   r   distutils.errorsr   r   r'   
setuptoolsr   __all__r   r   r	   r
   r"   r   r   <module>rh      s   ' ' ' ' ' '       1 1 1 1 1 1     				          
A
A
A   &) ) ) )X$# $# $# $# $#' $# $# $#N"
 "
 "
 "
 "
[ "
 "
 "
 "
 "
r   