
    vKg                         S SK r S SKrSSKJr  SSKJr  S SKrS SKJr  S SKJ	r	  S SK
Jr  / SQrSS	 jrSS
 jr " S S\5      r " S S\5      rg)    N   )Command)_cfg_read_utf8_with_fallback)log)DistutilsOptionError)convert_path)config_fileedit_configoption_basesetoptc                 v   U S:X  a  gU S:X  aK  [         R                  R                  [         R                  R                  [        R
                  5      S5      $ U S:X  aP  [         R                  S:H  =(       a    S=(       d    Sn[         R                  R                  [        S	U-  5      5      $ [        S
U 5      e)zyGet the filename of the distutils, local, global, or per-user config

`kind` must be one of "local", "global", or "user"
localz	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     Y/var/www/highfloat_scraper/venv/lib/python3.13/site-packages/setuptools/command/setopt.pyr	   r	      s    
 wxww||BGGOOI,>,>?QQv~gg (S.Bww!!,/Ds/J"KLL
NPT
UU    c           	         [         R                  " SU 5        [        R                  " 5       nS Ul        [        X05        UR                  5        GH"  u  pEUc*  [         R                  " SX@5        UR                  U5        M3  UR                  U5      (       d(  [         R                  " SX@5        UR                  U5        UR                  5        H  u  pgUck  [         R                  " SXFU 5        UR                  XF5        UR                  U5      (       d*  [         R                  " SX@5        UR                  U5        Mq  Ms  [         R                  " SXFXp5        UR                  XFU5        M     GM%     [         R                  " S	U 5        U(       d&  [        U S
SS9 nUR                  U5        SSS5        gg! , (       d  f       g= f)aE  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                     U $ N )	optionstrs    r   <lambda>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wzutf-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sectionr4   optionvaluefs	            r   r
   r
      se    II-x8'')D2D 0$NN,?HH4gH(##G,,		97M  )!(=II6R&&w7<<00A7 ++G4	 1 II3We HHWe4 "1 -. HH\8$(C'2aJJqM 32 22s    F<<
G
c                   4    \ rS rSrSr/ SQrSS/rS rS rSr	g	)
r   H   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)rB   rD   c                 .    S U l         S U l        S U l        g r#   )global_configuser_configr8   selfs    r   initialize_optionsoption_base.initialize_optionsV   s    !r    c                    / nU R                   (       a  UR                  [        S5      5        U R                  (       a  UR                  [        S5      5        U R                  b  UR                  U R                  5        U(       d  UR                  [        S5      5        [        U5      S:  a  [        SU5      eUu  U l        g )Nr   r   r      z/Must specify only one configuration file option)rG   appendr	   rH   r8   lenr   )rJ   	filenamess     r   finalize_optionsoption_base.finalize_options[   s    	[23[01==$T]]+[12y>A&A9  %r    )r8   rG   rH   N)
__name__
__module____qualname____firstlineno____doc__user_optionsboolean_optionsrK   rR   __static_attributes__r$   r    r   r   r   H   s%    FL 	O

%r    r   c                   x    \ rS rSrSrSr/ SQ\R                  -   r\R                  S/-   rS r	SS jr
SS	 jrS
rg)r   l   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 valuera   c                 f    [         R                  U 5        S U l        S U l        S U l        S U l        g r#   )r   rK   commandr=   	set_valuera   rI   s    r   rK   setopt.initialize_optionsz   s,    &&t,r    Nc                     [         R                  U 5        U R                  b  U R                  c  [	        S5      eU R
                  c  U R                  (       d  [	        S5      eg g )Nz%Must specify --command *and* --optionz$Must specify --set-value or --remove)r   rR   rd   r=   r   re   ra   rI   s    r   rR   setopt.finalize_options   sS    $$T*<<4;;#6&'NOO>>!$++&'MNN +6!r    c                     [        U R                  U R                  U R                  R	                  SS5      U R
                  00U R                  5        g )N-_)r
   r8   rd   r=   replacere   r:   rI   s    r   run
setopt.run   s>    MM\\DKK//S94>>JKLL	
r    )rd   r=   ra   re   )returnN)rT   rU   rV   rW   rX   descriptionr   rY   rZ   rK   rR   rm   r[   r$   r    r   r   r   l   sE    -EK
 	  !L "11XJ>OO
r    r   )r   )F)r+   r   r   r   unicode_utilsr   r   r   distutils.errorsr   distutils.utilr   __all__r	   r
   r   r   r$   r    r   <module>ru      sG     	  8   1 '
AV'T!%' !%H!
[ !
r    