HEX
Server: LiteSpeed
System: Linux cluster02.load-balancer.x2.network 4.18.0-553.51.1.lve.1.el8.x86_64 #1 SMP Wed May 14 14:34:57 UTC 2025 x86_64
User: kbdhpghp (1098)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: //opt/alt/python34/lib64/python3.4/distutils/command/__pycache__/register.cpython-34.pyc
�
h f�-�@s�dZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZddlTddl
mZGdd�de�ZdS)	zhdistutils.command.register

Implements the Distutils 'register' command (register with the repository).
�N)�warn)�
PyPIRCCommand)�*)�logc@s�eZdZdZejdd gZejdddgZdd	d
�fgZdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zddd�ZdS)!�registerz7register the distribution with the Python package index�list-classifiersN� list the valid Trove classifiers�strict�BWill stop the registering if the meta-data are not fully compliant�verify�checkcCsdS)NT�)�selfr
r
�?/opt/alt/python34/lib64/python3.4/distutils/command/register.py�<lambda>szregister.<lambda>cCs#tj|�d|_d|_dS)Nr)r�initialize_options�list_classifiersr	)rr
r
rrs
	zregister.initialize_optionscCs>tj|�id|jfd6dd6}||jjd<dS)Nrr	��restructuredtextr)zregisterr)r�finalize_optionsr	�distributionZcommand_options)rZ
check_optionsr
r
rr$s

zregister.finalize_optionscCsr|j�|j�x!|j�D]}|j|�q!W|jrN|j�n |jrd|j�n
|j�dS)N)	r�_set_configZget_sub_commandsZrun_commandZdry_run�verify_metadatar�classifiers�
send_metadata)rZcmd_namer
r
r�run+s

	
	
zregister.runcCsLtdt�|jjd�}|j�|j|_d|_|j�dS)zDeprecated API.zddistutils.command.register.check_metadata is deprecated,               use the check command insteadrrN)r�PendingDeprecationWarningrZget_command_objZensure_finalizedr	rr)rrr
r
r�check_metadata:s

	zregister.check_metadatacCs�|j�}|ikrX|d|_|d|_|d|_|d|_d|_nU|jd|jfkr�td|j��n|jdkr�|j|_nd|_d	S)
z: Reads the configuration file and set attributes.
        �username�password�
repository�realmTZpypiz%s not found in .pypircFN)Z_read_pypircrrr r!�
has_configZDEFAULT_REPOSITORY�
ValueError)r�configr
r
rrDs



zregister._set_configcCs9|jd}tjj|�}tj|j|��dS)z8 Fetch the list of classifiers from the server.
        z?:action=list_classifiersN)r �urllib�requestZurlopenr�infoZ_read_pypi_response)rZurlZresponser
r
rrUs
zregister.classifierscCs9|j|jd��\}}tjd||f�dS)zF Send the metadata to the package index server to be checked.
        rzServer response (%s): %sN)�post_to_server�build_post_datarr')r�code�resultr
r
rr\szregister.verify_metadatac
Cs�|jr$d}|j}|j}nd}d}}dj�}xT||kr�|jdtj�t�}|szd}qC||krCtd�qCqCW|dkrx|s�td�}q�Wx|s�t	j	d�}q�Wt
jj�}t
j
j|j�d	}|j|j|||�|j|jd
�|�\}}|jd||ftj�|dkr�|jr{||j_q
|jd
tj�|jd|j�tj�d}x1|j�dkr�td�}|s�d}q�q�W|j�dkr
|j||�q
q�n�|dkridd6}	d|	d<|	d<|	d<d|	d<x|	dsmtd�|	d<qPWx�|	d|	dkrx!|	ds�t	j	d�|	d<q�Wx!|	ds�t	j	d�|	d<q�W|	d|	dkrqd|	d<d|	d<td�qqqqWx|	ds&td�|	d<q	W|j|	�\}}|dkrbtjd||f�q�tjd�tjd �ns|d!kr�id"d6}	d|	d<x|	ds�td#�|	d<q�W|j|	�\}}tjd||f�ndS)$a_ Send the metadata to the package index server.

            Well, do the following:
            1. figure who the user is, and then
            2. send the data as a Basic auth'ed POST.

            First we try to read the username/password from $HOME/.pypirc,
            which is a ConfigParser-formatted file with a section
            [distutils] containing username and password entries (both
            in clear text). Eg:

                [distutils]
                index-servers =
                    pypi

                [pypi]
                username: fred
                password: sekrit

            Otherwise, to figure who the user is, we offer the user three
            choices:

             1. use existing login,
             2. register as a new user, or
             3. set the password to a random string and email the user.

        �1�x�z1 2 3 4z�We need to know who you are, so please choose either:
 1. use your existing login,
 2. register as a new user,
 3. have the server generate a new password for you (and email it to you), or
 4. quit
Your selection [default 1]: z&Please choose one of the four options!z
Username: z
Password: rZsubmitzServer response (%s): %s��zAI can store your PyPI login so future submissions will be faster.z (the login will be stored in %s)�XZynzSave your login (y/N)?�n�y�2�userz:action�namerZemailNZconfirmz
 Confirm: z!Password and confirm don't match!z
   EMail: z"You will receive an email shortly.z7Follow the instructions in it to complete registration.�3Zpassword_resetzYour email address: )r"rr�split�announcer�INFO�input�print�getpassr%r&ZHTTPPasswordMgr�parseZurlparser Zadd_passwordr!r(r)rZ_get_rc_file�lowerZ
_store_pypircr')
rZchoicerr�choices�auth�hostr*r+�datar
r
rrcs�		

				
		
	












zregister.send_metadatacCs|jj}i|d6dd6|j�d6|j�d6|j�d6|j�d6|j�d6|j�d	6|j�d
6|j	�d6|j
�d6|j�d
6|j�d6|j
�d6|j�d6|j�d6|j�d6}|ds|ds|drd|d<n|S)Nz:actionz1.0Zmetadata_versionr5�versionZsummaryZ	home_pageZauthorZauthor_email�license�description�keywords�platformrZdownload_urlZprovidesZrequiresZ	obsoletesz1.1)rZmetadataZget_nameZget_versionZget_descriptionZget_urlZget_contactZget_contact_emailZget_licenceZget_long_descriptionZget_keywordsZ
get_platformsZget_classifiersZget_download_urlZget_providesZget_requiresZ
get_obsoletes)r�action�metarBr
r
rr)�s,














zregister.build_post_datacCs�d|kr3|jd|d|jftj�nd}d|}|d}tj�}x�|j�D]�\}}t|�tg�tf�fkr�|g}nxx|D]p}t|�}|j	|�|j	d|�|j	d�|j	|�|r�|dd	kr�|j	d
�q�q�WqfW|j	|�|j	d
�|j
�jd�}id|d
6tt|��d6}	t
jj|j||	�}
t
jjt
jjd|��}d}y|j|
�}Wn�t
jjk
r#}
z2|jr�|
jj�}n|
j|
jf}WYdd}
~
Xn[t
jjk
r_}
zdt|
�f}WYdd}
~
XnX|jrx|j�}nd}|jr�dd}|jd|||f�n|S)zC Post a query to the server, and return a string response.
        r5zRegistering %s to %sz3--------------GHSKFJDLGDS7543FJKLFHRE75642756743254z
--z--z*
Content-Disposition: form-data; name="%s"z

r�
�
zutf-8z/multipart/form-data; boundary=%s; charset=utf-8zContent-typezContent-lengthZpassword_mgrr.Ni�r/�OK�-�Kz%s%r%s���)r/rL)r8r rr9�io�StringIO�items�type�str�write�getvalue�encode�lenr%r&ZRequestZbuild_openerZHTTPBasicAuthHandler�open�errorZ	HTTPErrorZ
show_response�fp�readr*�msgZURLError)rrBr@�boundaryZsep_boundaryZend_boundaryZbody�key�valueZheadersZreqZopenerr+�eZdashesr
r
rr(�sX



$





		$%		
zregister.post_to_server)rNr)zstrictNr
)�__name__�
__module__�__qualname__rErZuser_optionsZboolean_optionsZsub_commandsrrrrrrrrr)r(r
r
r
rrs&

zr)�__doc__�os�stringr<rPZurllib.parser%Zurllib.request�warningsrZdistutils.corerZdistutils.errorsZ	distutilsrrr
r
r
r�<module>s$