Hacked By AnonymousFox

Current Path : /opt/alt/python38/lib64/python3.8/distutils/command/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/distutils/command/__pycache__/register.cpython-38.opt-1.pyc

U

@��d�-�@sddZddlZddlZddlZddlZddlmZddlm	Z	ddl
TddlmZGdd�de	�Z
dS)	zhdistutils.command.register

Implements the Distutils 'register' command (register with the repository).
�N)�warn)�
PyPIRCCommand)�*)�logc@s�eZdZdZejddgZejdddgZddd	�fgZd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zddd�ZdS) �registerz7register the distribution with the Python package index)�list-classifiersNz list the valid Trove classifiers)�strictNzBWill stop the registering if the meta-data are not fully compliant�verifyrr�checkcCsdS)NT���selfrr�?/opt/alt/python38/lib64/python3.8/distutils/command/register.py�<lambda>�zregister.<lambda>cCst�|�d|_d|_dS)Nr)r�initialize_options�list_classifiersrrrrrrs
zregister.initialize_optionscCs*t�|�d|jfdd�}||jjd<dS)Nr)r�)r�restructuredtextr
)r�finalize_optionsr�distributionZcommand_options)r
Z
check_optionsrrrr$s

�zregister.finalize_optionscCsT|��|��|��D]}|�|�q|jr8|��n|jrH|��n|��dS)N)	r�_set_configZget_sub_commandsZrun_commandZdry_run�verify_metadatar�classifiers�
send_metadata)r
Zcmd_namerrr�run+s

zregister.runcCs8tdt�|j�d�}|��|j|_d|_|��dS)zDeprecated API.zddistutils.command.register.check_metadata is deprecated,               use the check command insteadr
rN)r�PendingDeprecationWarningrZget_command_objZensure_finalizedrrr)r
r
rrr�check_metadata:s�zregister.check_metadatacCsz|��}|ikr@|d|_|d|_|d|_|d|_d|_n6|jd|jfkr^td|j��|jdkrp|j|_d|_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
ZconfigrrrrDs




zregister._set_configcCs*|jd}tj�|�}t�|�|��dS)z8 Fetch the list of classifiers from the server.
        z?:action=list_classifiersN)r �urllib�requestZurlopenr�info�_read_pypi_response)r
ZurlZresponserrrrUs
zregister.classifierscCs&|�|�d��\}}t�d||�dS)zF Send the metadata to the package index server to be checked.
        r	�Server response (%s): %sN)�post_to_server�build_post_datarr&)r
�code�resultrrrr\szregister.verify_metadatac
Cs�|jrd}|j}|j}nd}d}}d��}||krd|�dtj�t�}|sRd}q,||kr,td�q,|dk�rl|s|td�}qn|s�t	�	d�}q|t
j��}t
j
�|j�d	}|�|j|||�|�|�d
�|�\}}|�d||ftj�|dk�r�|j�r||j_nf|�d
tj�|�d|��tj�d}|��dk�rNtd�}|�s*d}�q*|��dk�r�|�||��nl|dk�r�ddi}	d|	d<|	d<|	d<d|	d<|	d�s�td�|	d<�q�|	d|	dk�r0|	d�s�t	�	d�|	d<�q�|	d�st	�	d�|	d<�q�|	d|	dk�r�d|	d<d|	d<td��q�|	d�sJtd�|	d<�q0|�|	�\}}|dk�rrt�d||�nt�d�t�d �nP|d!k�r�dd"i}	d|	d<|	d�s�td#�|	d<�q�|�|	�\}}t�d||�dS)$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: rZsubmitr(��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�:action�user�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&)
r
Zchoicerr�choices�authZhostr+r,�datarrrrcs��



��

���








zregister.send_metadatacCs�|jj}|d|��|��|��|��|��|��|��|�	�|�
�|��|��|�
�|��|��|��d�}|ds�|ds�|dr�d|d<|S)Nz1.0)r5�metadata_versionr7�versionZsummaryZ	home_pageZauthorZauthor_email�license�description�keywords�platformrZdownload_url�provides�requires�	obsoletesrJrKrLz1.1rD)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�metarCrrrr*�s,�zregister.build_post_dataNc
Cs�d|kr$|�d|d|jftj�d}d|}|d}t��}|��D]~\}}t|�tg�td�fkrn|g}|D]R}t|�}|�	|�|�	d|�|�	d�|�	|�|rr|d	d
krr|�	d�qrqH|�	|�|�	d�|�
��d�}d
|tt|��d�}	t
j�|j||	�}
t
j�t
jj|d��}d}z|�|
�}Wnxt
jjk
�r�}
z"|j�rd|
j��}|
j|
jf}W5d}
~
XYnJt
jjk
�r�}
zdt|
�f}W5d}
~
XYnX|j�r�|�|�}d}|j�r�d�d|df�}|�|tj�|S)zC Post a query to the server, and return a string response.
        r7zRegistering %s to %sz3--------------GHSKFJDLGDS7543FJKLFHRE75642756743254z
--z--rz*
Content-Disposition: form-data; name="%s"z

����
�
zutf-8z/multipart/form-data; boundary=%s; charset=utf-8)zContent-typezContent-length)Zpassword_mgrr/Ni�)r0ZOKzK---------------------------------------------------------------------------)r:r rr;�io�StringIO�items�type�str�write�getvalue�encode�lenr$r%ZRequestZbuild_openerZHTTPBasicAuthHandler�open�errorZ	HTTPErrorZ
show_response�fp�readr+�msgZURLErrorr'�join)r
rCrB�boundaryZsep_boundaryZend_boundaryZbody�key�valueZheadersZreqZopenerr,�er_rrrr)�s^��





��

zregister.post_to_server)N)�__name__�
__module__�__qualname__rGrZuser_optionsZboolean_optionsZsub_commandsrrrrrrrrr*r)rrrrrs*��
zr)�__doc__r>rRZurllib.parser$Zurllib.request�warningsrZdistutils.corerZdistutils.errorsZ	distutilsrrrrrr�<module>s

Hacked By AnonymousFox1.0, Coded By AnonymousFox