%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /snap/core/17212/usr/lib/python3.5/distutils/command/__pycache__/
Upload File :
Create Path :
Current File : //snap/core/17212/usr/lib/python3.5/distutils/command/__pycache__/register.cpython-35.pyc



|�g�-�@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
�0/usr/lib/python3.5/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|�dd|jfddi}||jjd<dS)Nr	r�restructuredtext�r)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|_nO|jd|jfkr�td|j��|jdkr�|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)rZconfigr
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�info�_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�}xQ||kr�|jdtj�t�}|szd}qC||krCtd�qCW|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�|jrx||j_q�|jd
tj�|jd|j�tj�d}x.|j�dkr�td�}|s�d}q�W|j�dkr�|j||�n�|dkroddi}	d|	d<|	d<|	d<d|	d<x|	ds`td�|	d<qCWx�|	d|	dkr�x!|	ds�t	j	d�|	d<q{Wx!|	ds�t	j	d�|	d<q�W|	d|	dkrdd|	d<d|	d<td�qdWx|	dstd�|	d<q�W|j|	�\}}|dkrRtjd||f�q�tjd�tjd �no|d!kr�dd"i}	d|	d<x|	ds�td#�|	d<q�W|j|	�\}}tjd||f�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: 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�2z: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&)
rZchoicerr�choices�authZhostr*r+�datar
r
rrcs�		

				
		
	










zregister.send_metadatac"Cs�|jj}d|ddd|j�d|j�d|j�d|j�d|j�d	|j�d
|j�d|j	�d|j
�d
|j�d|j�d|j
�d|j�d|j�d|j�i}|ds�|ds�|dr�d|d<|S)Nz:actionZmetadata_versionz1.0r5�versionZsummaryZ	home_pageZauthorZauthor_emailZlicense�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�metarAr
r
rr)�s*
zregister.build_post_datacCs�d|kr0|jd|d|jftj�d}d|}|d}tj�}x�|j�D]�\}}t|�tg�tf�fkr�|g}xu|D]m}t|�}|j	|�|j	d|�|j	d�|j	|�|r�|dd	kr�|j	d
�q�WqcW|j	|�|j	d
�|j
�jd�}dd
|dtt|��i}	t
jj|j||	�}
t
jjt
jjd|��}d}y|j|
�}Wn�t
jjk
r}
z/|jr�|
jj�}|
j|
jf}WYdd}
~
Xn[t
jjk
rQ}
zdt|
�f}WYdd}
~
XnX|jrj|j|�}d}|jr�d
jdd|ddf�}|j|tj�|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Content-typez/multipart/form-data; boundary=%s; charset=utf-8zContent-lengthZpassword_mgrr.Ni�r/�OK�-�K���)r/rJ)r8r rr9�io�StringIO�items�type�str�write�getvalue�encode�lenr$r%ZRequestZbuild_openerZHTTPBasicAuthHandler�open�errorZ	HTTPErrorZ
show_response�fp�readr*�msgZURLErrorr'�join)rrAr@�boundaryZsep_boundaryZend_boundaryZbody�key�valueZheadersZreqZopenerr+�er[r
r
rr(�sV



$	






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


Zerion Mini Shell 1.0