
    /h/                     J    d Z ddlZddlmZ ddlmZ dZ G d de          ZdS )	zdistutils.pypirc

Provides the PyPIRCCommand class, the base class for the command classes
that uses .pypirc in the distutils.command package.
    N)RawConfigParser   )CommandzE[distutils]
index-servers =
    pypi

[pypi]
username:%s
password:%s
c                   `    e Zd ZdZdZdZdZdZdddez  fdgZd	gZ	d
 Z
d Zd Zd Zd Zd ZdS )PyPIRCCommandz6Base command that knows how to handle the .pypirc filezhttps://upload.pypi.org/legacy/pypiNzrepository=rzurl of repository [default: %s])show-responseNz&display full response text from serverr
   c                 |    t           j                            t           j                            d          d          S )zReturns rc file path.~z.pypirc)ospathjoin
expanduserselfs    O/var/www/html/venv/lib/python3.11/site-packages/setuptools/_distutils/config.py_get_rc_filezPyPIRCCommand._get_rc_file%   s(    w||BG..s33Y???    c                    |                                  }t          j        t          j        |t          j        t          j        z  d          d          5 }|                    t          ||fz             ddd           dS # 1 swxY w Y   dS )zCreates a default .pypirc file.i  wN)r   r   fdopenopenO_CREATO_WRONLYwriteDEFAULT_PYPIRC)r   usernamepasswordrcfs        r   _store_pypirczPyPIRCCommand._store_pypirc)   s      Yrwr2:#;UCCSII 	;QGGNh%99:::	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	;s    BB	Bc                    |                                  }t          j                            |          r|                     d|z             | j        p| j        }t                      }|                    |           |	                                }d|v r|
                    dd          }d |                    d          D             }|g k    r
d|v rdg}ni S |D ]}d|i}|
                    |d          |d<   d	| j        fd
| j        fdfD ]:\  }	}
|                    ||	          r|
                    ||	          ||	<   5|
||	<   ;|dk    r|| j        dfv r| j        |d	<   |c S |d         |k    s|d	         |k    r|c S nod|v rkd}|                    |d	          r|
                    |d	          }n| j        }|
                    |d          |
                    |d          ||| j        dS i S )zReads the .pypirc file.zUsing PyPI login from %s	distutilszindex-serversc                 f    g | ].}|                                 d k    |                                 /S ) )strip).0servers     r   
<listcomp>z.PyPIRCCommand._read_pypirc.<locals>.<listcomp><   s=       ||~~++ LLNN+++r   
r   r)   r   
repositoryrealm)r   Nzserver-loginr   )r   r   r,   r)   r-   )r   r   r   existsannouncer,   DEFAULT_REPOSITORYr   readsectionsgetsplitDEFAULT_REALM
has_option)r   r    r,   configr2   index_servers_serversr)   currentkeydefaults              r   _read_pypirczPyPIRCCommand._read_pypirc/   s     7>>" B	MM4r9:::CD,CJ$&&FKKOOO((Hh&& &

; H H "/"5"5d";";  
 r>>))$*8  "	& ' 'F'0G*0**VZ*H*HGJ' &t'>? $"45*) 3 3W
 ",,VS99 3+1::fc+B+BGCLL+2GCLL
 ''J/; - - 150G-&  )Z77"<0J>>& ?7'<  8++'$$V\:: 9!'FL!A!AJJ!%!8J &

6: > > &

6: > >",$!/   	r   c                     ddl }|                    dd          }|                    |          d                             dd          }|                                                    |          S )z%Read and decode a PyPI HTTP response.r   Nzcontent-typez
text/plainr   charsetascii)cgi	getheaderparse_headerr3   r1   decode)r   responserA   content_typeencodings        r   _read_pypi_responsez!PyPIRCCommand._read_pypi_responsex   sd    


)).,GG##L11!488GLL}}%%h///r   c                 0    d| _         d| _        d| _        dS )zInitialize options.Nr   )r,   r-   show_responser   s    r   initialize_optionsz PyPIRCCommand.initialize_options   s    
r   c                 V    | j         | j        | _         | j        | j        | _        dS dS )zFinalizes options.N)r,   r0   r-   r5   r   s    r   finalize_optionszPyPIRCCommand.finalize_options   s2    ?""5DO:+DJJJ r   )__name__
__module____qualname____doc__r0   r5   r,   r-   user_optionsboolean_optionsr   r"   r=   rH   rK   rM    r   r   r   r      s        @@:MJE 
>ASSTIL
 ''O@ @ @; ; ;G G GR0 0 0  , , , , ,r   r   )rQ   r   configparserr   cmdr   r   r   rT   r   r   <module>rW      s    
 
			 ( ( ( ( ( (      u, u, u, u, u,G u, u, u, u, u,r   