
    dW                     R    d Z ddlZddlmZ ddl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 )PyPIRCCommandz;Base command that knows how to handle the .pypirc file
    z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    "  /croot/python-split_1694437901252/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_plac/lib/python3.11/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<     5 5 5v%||~~33 #LLNN333r   
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+   configr1   index_servers_serversr(   currentkeydefaults              r   _read_pypirczPyPIRCCommand._read_pypirc1   s     7>>" 9	5MM4r9:::CD,CJ$&&FKKOOO((Hh&& &

; H H5 5)//555 5 5 r>>))$*8  "	& ' 'F'0G*0**VZ*H*HGJ' +7*.*A*C*143E)F);)= 3 3W ",,VS99 3+1::fc+B+BGCLL+2GCLL
 &(("t'>&GGG040G-&)Z77-;;& </'2  8++'$$V\:: 9!'FL!A!AJJ!%!8J$*JJvz$B$B$*JJvz$B$B&0"(!%!3	5 5 5 	r   c                 l   t          j                    5  t          j        dt                     ddl}ddd           n# 1 swxY w Y   |                    dd          }|                    |          d                             dd          }|                                	                    |          S )	z%Read and decode a PyPI HTTP response.ignorer   Nzcontent-typez
text/plain   charsetascii)
warningscatch_warningssimplefilterDeprecationWarningcgi	getheaderparse_headerr2   r0   decode)r   responserF   content_typeencodings        r   _read_pypi_responsez!PyPIRCCommand._read_pypi_responseq   s    $&& 	 	!(,>???JJJ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	  )).,GG##L11!488GLL}}%%h///s   ?AAc                 0    d| _         d| _        d| _        dS )zInitialize options.Nr   )r+   r,   show_responser   s    r   initialize_optionsz PyPIRCCommand.initialize_optionsz   s    
r   c                 V    | j         | j        | _         | j        | j        | _        dS dS )zFinalizes options.N)r+   r/   r,   r4   r   s    r   finalize_optionszPyPIRCCommand.finalize_options   s2    ?""5DO:+DJJJ r   )__name__
__module____qualname____doc__r/   r4   r+   r,   user_optionsboolean_optionsr   r!   r<   rM   rP   rR    r   r   r   r      s         :MJE 
	*
	 	3	4L ''O@ @ @; ; ;> > >@0 0 0  , , , , ,r   r   )	rV   r   configparserr   rB   distutils.cmdr   r   r   rY   r   r   <module>r\      s    
 
			 ( ( ( ( ( (  ! ! ! ! ! !o, o, o, o, o,G o, o, o, o, o,r   