f-rdZddlZddlZddlZddlZddlmZddlm Z ddl Tddl m Z Gdde Z dS) zhdistutils.command.register Implements the Distutils 'register' command (register with the repository). N)warn) PyPIRCCommand)*)logceZdZdZejddgzZejgdzZddfgZdZdZ d Z d Z d Z d Z d ZdZdZddZdS)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)verifyr r checkcdS)NTselfs A/opt/alt/python311/lib64/python3.11/distutils/command/register.pyzregister.s4cJtj|d|_d|_dS)Nr)rinitialize_optionslist_classifiersr rs rrzregister.initialize_optionss&(... ! rcdtj|d|jfdd}||jjd<dS)Nr)r)r restructuredtextr )rfinalize_optionsr distributioncommand_options)r check_optionss rrzregister.finalize_options$sB&t,,,$. #<-<>> 5B)'222rcJ|||D]}|||jr|dS|jr|dS|dSN) r _set_configget_sub_commands run_commanddry_runverify_metadatar classifiers send_metadata)rcmd_names rrunz register.run+s  --// ' 'H   X & & & & < !  " " " " "  " !            rctdt|jd}||j|_d|_|dS)zDeprecated API.zddistutils.command.register.check_metadata is deprecated, use the check command insteadr rN)rPendingDeprecationWarningrget_command_objensure_finalizedr rr()rr s rcheck_metadatazregister.check_metadata:si -.G I I I!11'::    { !" rc>|}|ikr=|d|_|d|_|d|_|d|_d|_d S|jd|jfvrtd|jz|jdkr |j|_d|_d S) z: Reads the configuration file and set attributes. usernamepassword repositoryrealmTpypiz%s not found in .pypircFN) _read_pypircr/r0r1r2 has_configDEFAULT_REPOSITORY ValueError)rconfigs rr zregister._set_configDs""$$ R<<":.DM":.DM$\2DODJ"DOOOvt/F&GGG !:T_!LMMM&(("&"9#DOOOrc|jdz}tj|}t j||dS)z8 Fetch the list of classifiers from the server. z?:action=list_classifiersN)r1urllibrequesturlopenrinfo_read_pypi_response)rurlresponses rr%zregister.classifiersUsJo99>))#.. ))(3344444rc||d\}}tjd||dS)zF Send the metadata to the package index server to be checked. r Server response (%s): %sN)post_to_serverbuild_post_datarr=)rcoderesults rr$zregister.verify_metadata\sD,,T-A-A(-K-KLLv +T6:::::rc$|jrd}|j}|j}nd}dx}}d}||vrJ|dt jt}|sd}n||vrtd||vJ|dkr|std}||stj d}|tj }tj |jd }||j|||||d |\}}|d |d |t j|d kr|jr||j_dS|dt j|d|zt jd}|dvr)td}|sd}|dv)|dkr|||dSdSdS|dkrYddi} dx| d<x| d<| d<d| d<| dstd| d<| d| d| dkr| dstj d| d<| d| dstj d| d<| d| d| dkrd| d<d| d<td| d| dk| dstd| d<| d|| \}}|d krt jd ||dSt jd!t jd"dS|d#kr[dd$i} d| d<| dstd%| d<| d|| \}}t jd ||dSdS)&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. 1xz1 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: rsubmitzServer response (z): zAI can store your PyPI login so future submissions will be faster.z (the login will be stored in %s)XynzSave your login (y/N)?ny2:actionusernamer0emailNconfirmz Confirm: z!Password and confirm don't match!z EMail: rBz"You will receive an email shortly.z7Follow the instructions in it to complete registration.3password_resetzYour email address: )r5r/r0splitannouncerINFOinputprintgetpassr:r;HTTPPasswordMgrparseurlparser1 add_passwordr2rCrDr _get_rc_filelower _store_pypircr=) rchoicer/r0choicesauthhostrErFdatas rr&zregister.send_metadatacs< ? %F}H}HHF"$ $Hx//##G## MM "%  + + +WWF @w&&>???G## S== / .. / 9"?<88 9>1133D<((99!>>>>!{-,s]]v&D>@ @DL @4 +d7m"DO6l 3$\22V 6l 3z"d9o55z*E'.|'D'DD$z*Ey/D&-ol&C&CDOy/D #tI66')D$&*DO=>>>z"d9o557m 4 %l 3 3W 7m 4..t44LD&s{{3T6BBBBB=>>>355555 s]]/0DDM7m > %&< = =W 7m >..t44LD& H/v > > > > > ]rc|jj}id|ddd|d|d|d|d|d |d |d | d | d | d| d| d|d|d|}|ds|ds|drd|d<|S)NrRmetadata_versionz1.0rTversionsummary home_pageauthor author_emaillicense descriptionkeywordsplatformr% download_urlprovidesrequires obsoletesz1.1)rmetadataget_name get_versionget_descriptionget_url get_contactget_contact_email get_licenceget_long_description get_keywords get_platformsget_classifiersget_download_url get_provides get_requires get_obsoletes)ractionmetarjs rrDzregister.build_post_datas ) v   DMMOO  t''))  t++--     d&&((  D2244  t''))  44466  ))++  **,,  4//11  D1133 ))++! " ))++# $ ++--% (   -tJ/ -4 3D -',D# $ rNcd|vr1|d|dd|jtjd}d|z}|dz}t j}|D]\}}t|tgtdfvr|g}|D]}t|}| || d|z| d | ||r!|d d kr| d | || d | d }d|ztt|d} tj|j|| } tjtj|} d} | | } |jr|| }d} n|#tjj$r8} |jr| j}| j| jf} Yd} ~ n5d} ~ wtjj$r} dt| f} Yd} ~ nd} ~ wwxYw|jr8d d|df}||tj| S)zC Post a query to the server, and return a string response. rTz Registering z to z3--------------GHSKFJDLGDS7543FJKLFHRE75642756743254z --z--rz* Content-Disposition: form-data; name="%s"z   zutf-8z/multipart/form-data; boundary=%s; charset=utf-8)z Content-typezContent-length) password_mgrrJ)rLOKNizK---------------------------------------------------------------------------)rZr1rr[ioStringIOitemstypestrwritegetvalueencodelenr:r;Request build_openerHTTPBasicAuthHandleropen show_responser>error HTTPErrorfpreadrEmsgURLErrorjoin)rrjrhboundary sep_boundary end_boundarybodykeyvalueheadersreqopenerrFers rrCzregister.post_to_servers T>> MMMDLLL48OOE47H > > >I( #d* {}}**,, % %JCE{{488T2ZZ"888 % %E  <((( HLMMM 6""" 5!!!%U2Y$..JJt$$$ % <    4}}%%g..NhV!#d))nn  n$$T_dGDD,, N / /T / B B   [[%%F! 8//77FF|% # # #! #tyy{{VQU]FFFFFF|$ ! ! !#a&&[FFFFFF !   )))XtX677C MM#sx ( ( ( s$H::J3.JJ3J..J3r)__name__ __module__ __qualname__rsr user_optionsboolean_options sub_commandsrrr(r-r r%r$r&rDrCrrrrrs LK - - O1  L $37070700O//01L CCC ! ! !$$$"555;;;x?x?x?t8777777rr)__doc__r^r urllib.parser:urllib.requestwarningsrdistutils.corerdistutils.errors distutilsrrrrrrs ########((((((_____}_____r