£Á°èZ¨Ä…–K§‚«“ô4“ÒÙ´dîfUÙÃÅ WKbyÊ¦•êŽ…È®FÒ¿ÊÎóCozá¬S@6{Í:›œêZÌ:Š•_%:¢¾¾~;‘Ã~èŠ©ÊÇí`ÔÑ©úë™µ'5I¿fš×WO%ø9¾«¾DK|€ùÍD”Ýs]nHÕ¶ê×Ó¼ãžªéUWŸÈË%DÒÕ¬ï‘]/Åcx  ‰ï2ß]ä6G[]S£ÔÏ¯rs{úëóµmÒï#UQxo·õÞCe]"±/aÙ&Eã4ú9Jé_ÞåëdãöKë)AÞ                  ¯¹ægƒÛowÐø^d™ý½ßB7áyMä9ÜÖUã
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
<html>
B
     f-                 @   sd   d Z ddlZddlZddlZddlZddlmZ ddlm	Z	 ddl
T ddlmZ G dd de	ZdS )	zhdistutils.command.register

Implements the Distutils 'register' command (register with the repository).
    N)warn)PyPIRCCommand)*)logc               @   s   e Zd ZdZejddg Zejdddg Zddd	 fgZd
d Zdd Z	dd Z
dd Zdd Zdd Zdd Zdd Zdd ZdddZdS ) registerz7register the distribution with the Python package index)zlist-classifiersNz list the valid Trove classifiers)strictNzBWill stop the registering if the meta-data are not fully compliantverifyzlist-classifiersr   checkc             C   s   dS )NT )selfr
   r
   ?/opt/alt/python37/lib64/python3.7/distutils/command/register.py<lambda>       zregister.<lambda>c             C   s   t |  d| _d| _d S )Nr   )r   initialize_optionslist_classifiersr   )r   r
   r
   r   r      s    
zregister.initialize_optionsc             C   s*   t |  d| jfdd}|| jjd< d S )Nr   )r      )r   restructuredtextr	   )r   finalize_optionsr   distributionZcommand_options)r   Zcheck_optionsr
   r
   r   r   $   s    
zregister.finalize_optionsc             C   sX   |    |   x|  D ]}| | qW | jr<|   n| jrL|   n|   d S )N)	r   _set_configZget_sub_commandsZrun_commandZdry_runverify_metadatar   classifierssend_metadata)r   Zcmd_namer
   r
   r   run+   s    

zregister.runc             C   s8   t dt | jd}|  | j|_d|_|  dS )zDeprecated API.zddistutils.command.register.check_metadata is deprecated,               use the check command insteadr	   r   N)r   PendingDeprecationWarningr   Zget_command_objZensure_finalizedr   r   r   )r   r	   r
   r
   r   check_metadata:   s    zregister.check_metadatac             C   sz   |   }|i kr@|d | _|d | _|d | _|d | _d| _n6| jd| jfkr^td| j | jdkrp| j| _d| _d	S )
z: Reads the configuration file and set attributes.
        usernamepassword
repositoryrealmTZpypiz%s not found in .pypircFN)Z_read_pypircr   r   r   r   
has_configZDEFAULT_REPOSITORY
ValueError)r   Zconfigr
   r
   r   r   D   s    




zregister._set_configc             C   s*   | j d }tj|}t| | dS )z8 Fetch the list of classifiers from the server.
        z?:action=list_classifiersN)r   urllibrequestZurlopenr   info_read_pypi_response)r   ZurlZresponser
   r
   r   r   U   s    
zregister.classifiersc             C   s&   |  | d\}}td|| dS )zF Send the metadata to the package index server to be checked.
        r   zServer response (%s): %sN)post_to_serverbuild_post_datar   r$   )r   coderesultr
   r
   r   r   \   s    zregister.verify_metadatac       
      C   s  | j rd}| j}| j}nd}d }}d }x:||krf| dtj t }|sTd}q.||kr.td q.W |dkr|x|std}qtW x|st		d}qW t
j }t
j| jd	 }|| j||| | | d
|\}}| d||f tj |dkr | j r|| j_nj| dtj | d|   tj d}x&| dkr\td}|s8d}q8W | dkr | || n|dkrddi}	d |	d<  |	d< |	d< d|	d< x|	d std|	d< qW x|	d |	d krNx|	d st		d|	d< qW x|	d st		d|	d< qW |	d |	d krd|	d< d|	d< td qW x|	d sltd|	d< qRW | |	\}}|dkrtd|| ntd td  nT|d!kr dd"i}	d|	d< x|	d std#|	d< qW | |	\}}td|| dS )$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 z1 2 3 4zWe 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: r   ZsubmitzServer response (%s): %s   zAI can store your PyPI login so future submissions will be faster.z (the login will be stored in %s)XZynzSave your login (y/N)?ny2z:actionusernamer   ZemailNZconfirmz
 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.3Zpassword_resetzYour email address: )r    r   r   splitannouncer   INFOinputprintgetpassr"   r#   ZHTTPPasswordMgrparseZurlparser   Zadd_passwordr   r&   r'   r   Z_get_rc_filelowerZ_store_pypircr$   )
r   Zchoicer   r   choicesauthZhostr(   r)   datar
   r
   r   r   c   s    











zregister.send_metadatac             C   s   | j j}|d| | | | | | | |	 |
 | | | | | | d}|d s|d s|d rd|d< |S )Nz1.0)z:actionmetadata_versionr3   versionZsummaryZ	home_pageZauthorZauthor_emaillicensedescriptionkeywordsplatformr   Zdownload_urlprovidesrequires	obsoletesrF   rG   rH   z1.1r@   )r   ZmetadataZget_nameZget_versionZget_descriptionZget_urlZget_contactZget_contact_emailZget_licenceZget_long_descriptionZget_keywordsZget_platformsZget_classifiersZget_download_urlZget_providesZget_requiresZget_obsoletes)r   actionmetar?   r
   r
   r   r'      s*    zregister.build_post_dataNc          
   C   s  d|kr$|  d|d | jf tj d}d| }|d }t }x| D ]\}}t|tg tdfkrp|g}xZ|D ]R}t|}|	| |	d|  |	d |	| |rv|d	 d
krv|	d qvW qJW |	| |	d |
 d}d| tt|d}	tj| j||	}
tjtjj|d}d}y||
}W nx tjjk
r } z"| jrl|j }|j|jf}W dd}~X Y nJ tjjk
r } zdt|f}W dd}~X Y nX | jr| |}d}| jrdd|df}|  |tj |S )zC Post a query to the server, and return a string response.
        r3   zRegistering %s to %sz3--------------GHSKFJDLGDS7543FJKLFHRE75642756743254z
--z--r
   z*
Content-Disposition: form-data; name="%s"z


zutf-8z/multipart/form-data; boundary=%s; charset=utf-8)zContent-typezContent-length)Zpassword_mgrr,   Ni  )r-   ZOKzK---------------------------------------------------------------------------)r6   r   r   r7   ioStringIOitemstypestrwritegetvalueencodelenr"   r#   ZRequestZbuild_openerZHTTPBasicAuthHandleropenerrorZ	HTTPErrorZshow_responsefpreadr(   msgZURLErrorr%   join)r   r?   r>   boundaryZsep_boundaryZend_boundaryZbodykeyvalueZheadersZreqopenerr)   er[   r
   r
   r   r&      sV    







zregister.post_to_server)N)__name__
__module____qualname__rC   r   Zuser_optionsZboolean_optionsZsub_commandsr   r   r   r   r   r   r   r   r'   r&   r
   r
   r
   r   r      s"   
zr   )__doc__r:   rN   Zurllib.parser"   Zurllib.requestwarningsr   Zdistutils.corer   Zdistutils.errorsZ	distutilsr   r   r
   r
   r
   r   <module>   s   