Ë
    ˜šãjÀ-  ã                   ól   — 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
­ ddlmZ  G d„ de	«      Zy)	zhdistutils.command.register

Implements the Distutils 'register' command (register with the repository).
é    N)Úwarn)ÚPyPIRCCommand)Ú*)Úlogc                   óž   — e Zd ZdZej
                  ddgz   Zej                  g d¢z   Zdd„ fgZd„ Zd„ Z	d	„ Z
d
„ Zd„ Zd„ Zd„ Zd„ Zd„ Zdd„Zy)Ú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
   Úcheckc                  ó   — y)NT© ©Úselfs    úq/var/www/html/python-recuperauto-other/env/lib/python3.12/site-packages/setuptools/_distutils/command/register.pyú<lambda>zregister.<lambda>   s   � ó    c                 óJ   — t        j                  | «       d| _        d| _        y )Nr   )r   Úinitialize_optionsÚlist_classifiersr
   r   s    r   r   zregister.initialize_options   s   € Ü×(Ñ(¨Ô.Ø !ˆÔØˆ�r   c                 ó‚   — t        j                  | «       d| j                  fddœ}|| j                  j                  d<   y )Nr   )r   é   )r
   Úrestructuredtextr   )r   Úfinalize_optionsr
   ÚdistributionÚcommand_options)r   Úcheck_optionss     r   r   zregister.finalize_options$   s<   € Ü×&Ñ& tÔ,à$.°·±Ð#<Ø-<ñ>ˆà5Bˆ×Ñ×)Ñ)¨'Ò2r   c                 ó$  — | j                  «        | j                  «        | j                  «       D ]  }| j                  |«       Œ | j                  r| j                  «        y | j                  r| j                  «        y | j                  «        y ©N)	r   Ú_set_configÚget_sub_commandsÚrun_commandÚdry_runÚverify_metadatar   ÚclassifiersÚsend_metadata)r   Úcmd_names     r   Úrunzregister.run+   sx   € Ø×ÑÔØ×ÑÔð ×-Ñ-Ó/ò 	'ˆHØ×Ñ˜XÕ&ð	'ð �<Š<Ø× Ñ Õ"Ø×"Ò"Ø×ÑÕà×ÑÕ r   c                 óÊ   — t        dt        «       | j                  j                  d«      }|j	                  «        | j
                  |_        d|_        |j                  «        y)zDeprecated API.zddistutils.command.register.check_metadata is deprecated,               use the check command insteadr   r   N)r   ÚPendingDeprecationWarningr   Úget_command_objÚensure_finalizedr
   r   r(   )r   r   s     r   Úcheck_metadatazregister.check_metadata:   sQ   € äð -Ü.Gô	Ià×!Ñ!×1Ñ1°'Ó:ˆØ×ÑÔ Ø—{‘{ˆŒØ!"ˆÔØ�	‰	�r   c                 ó@  — | j                  «       }|i k7  r0|d   | _        |d   | _        |d   | _        |d   | _        d| _        y	| j                  d| j                  fvrt        d| j                  z  «      ‚| j                  dk(  r| j                  | _        d| _        y	)
z: Reads the configuration file and set attributes.
        ÚusernameÚpasswordÚ
repositoryÚrealmTÚpypiz%s not found in .pypircFN)Ú_read_pypircr/   r0   r1   r2   Ú
has_configÚDEFAULT_REPOSITORYÚ
ValueError)r   Úconfigs     r   r    zregister._set_configD   s›   € ð ×"Ñ"Ó$ˆØ�RŠ<Ø" :Ñ.ˆDŒMØ" :Ñ.ˆDŒMØ$ \Ñ2ˆDŒOØ ™ˆDŒJØ"ˆD�Oà�‰ v¨t×/FÑ/FÐ&GÑGÜ Ð!:¸T¿_¹_Ñ!LÓMÐMØ�‰ &Ò(Ø"&×"9Ñ"9�”Ø#ˆD�Or   c                 ó¨   — | j                   dz   }t        j                  j                  |«      }t	        j
                  | j                  |«      «       y)z8 Fetch the list of classifiers from the server.
        z?:action=list_classifiersN)r1   ÚurllibÚrequestÚurlopenr   ÚinfoÚ_read_pypi_response)r   ÚurlÚresponses      r   r%   zregister.classifiersU   s>   € ð �o‰oÐ9Ñ9ˆÜ—>‘>×)Ñ)¨#Ó.ˆÜ�‰�×)Ñ)¨(Ó3Õ4r   c                 óx   — | j                  | j                  d«      «      \  }}t        j                  d||«       y)zF Send the metadata to the package index server to be checked.
        r   úServer response (%s): %sN)Úpost_to_serverÚbuild_post_datar   r=   )r   ÚcodeÚresults      r   r$   zregister.verify_metadata\   s4   € ð ×,Ñ,¨T×-AÑ-AÀ(Ó-KÓL‰ˆˆvÜ�‰Ð+¨T°6Õ:r   c                 ól  — | j                   rd}| j                  }| j                  }nd}dx}}dj                  «       }||vrC| j	                  dt
        j                  «       t        «       }|sd}n||vrt        d«       ||vrŒC|dk(  �r®|st        d«      }|sŒ|st        j                  d«      }|sŒt        j                  j                  «       }t        j                  j                  | j                  «      d	   }|j!                  | j"                  |||«       | j%                  | j'                  d
«      |«      \  }}| j	                  d|›d|›�t
        j                  «       |dk(  rÌ| j                   r|| j(                  _        y| j	                  dt
        j                  «       | j	                  d| j+                  «       z  t
        j                  «       d}|j-                  «       dvr"t        d«      }|sd}|j-                  «       dvrŒ"|j-                  «       dk(  r| j/                  ||«       yyy|dk(  �r#ddi}	dx|	d<   x|	d<   |	d<   d|	d<   |	d   st        d«      |	d<   |	d   sŒ|	d   |	d   k7  rr|	d   st        j                  d«      |	d<   |	d   sŒ|	d   st        j                  d«      |	d<   |	d   sŒ|	d   |	d   k7  rd|	d<   d|	d<   t        d«       |	d   |	d   k7  rŒr|	d   st        d«      |	d<   |	d   sŒ| j%                  |	«      \  }}|dk7  rt        j0                  d ||«       yt        j0                  d!«       t        j0                  d"«       y|d#k(  rNdd$i}	d|	d<   |	d   st        d%«      |	d<   |	d   sŒ| j%                  |	«      \  }}t        j0                  d ||«       yy)&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 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: r   ÚsubmitzServer response (z): éÈ   zAI can store your PyPI login so future submissions will be faster.z (the login will be stored in %s)ÚXÚynzSave your login (y/N)?ÚnÚyÚ2ú:actionÚuserÚnamer0   ÚemailNÚconfirmz
 Confirm: z!Password and confirm don't match!z
   EMail: rB   z"You will receive an email shortly.z7Follow the instructions in it to complete registration.Ú3Úpassword_resetzYour email address: )r5   r/   r0   ÚsplitÚannouncer   ÚINFOÚinputÚprintÚgetpassr:   r;   ÚHTTPPasswordMgrÚparseÚurlparser1   Úadd_passwordr2   rC   rD   r   Ú_get_rc_fileÚlowerÚ_store_pypircr=   )
r   Úchoicer/   r0   ÚchoicesÚauthÚhostrE   rF   Údatas
             r   r&   zregister.send_metadatac   sÃ  € ð< �?Š?ØˆFØ—}‘}ˆHØ—}‘}‰HàˆFØ"$Ð$ˆH�xð —/‘/Ó#ˆØ˜GÑ#Ø�M‰Mð  ô "%§¡ô+ô “WˆFÙØ‘Ø˜wÑ&ÜÐ>Ô?ð ˜GÒ#ð �S‹=áÜ  Ó.�ò áÜ"Ÿ?™?¨<Ó8�ò ô —>‘>×1Ñ1Ó3ˆDÜ—<‘<×(Ñ(¨¯©Ó9¸!Ñ<ˆDØ×Ñ˜dŸj™j¨$°¸(ÔCà×.Ñ.¨t×/CÑ/CÀHÓ/MØó‰LˆD�&à�MŠMº¹fÐEÜŸ(™(ô$ð �sŠ{Ø—?’?ð 2:�D×%Ñ%Õ.à—M‘Mð $AÜCFÇ8Á8ôMà—M‘MÐ"DØ"&×"3Ñ"3Ó"5ñ#6Ü7:·x±xôAà �FØ Ÿ,™,›.°Ñ4Ü!&Ð'?Ó!@˜Ù%Ø%(˜Fð !Ÿ,™,›.°Ò4ð —|‘|“~¨Ò,Ø×*Ñ*¨8°XÕ>ð -ð ð$ �s‹]Ø˜vÐ&ˆDØ>@Ð@ˆD�‰LÐ@˜4 
Ñ+¨d°7©mØ"ˆD�‰OØ˜6’lÜ$ \Ó2��V‘ð ˜6“là�zÑ" d¨9¡oÒ5Ø˜zÒ*Ü'.§¡°|Ó'D�D˜Ñ$ð ˜zÓ*à˜yš/Ü&-§o¡o°lÓ&C�D˜‘Oð ˜y›/à˜
Ñ# t¨I¡Ò6Ø')�D˜Ñ$Ø&*�D˜‘OÜÐ=Ô>ð �zÑ" d¨9¡oÓ5ð ˜7’mÜ % lÓ 3��W‘ð ˜7“mà×.Ñ.¨tÓ4‰LˆD�&Ø�sŠ{Ü—‘Ð3°T¸6ÕBä—‘Ð=Ô>Ü—‘ð 3õ 5à�sŠ]ØÐ/Ð0ˆDØˆD�‰MØ˜7’mÜ %Ð&<Ó =��W‘ð ˜7“mà×.Ñ.¨tÓ4‰LˆD�&Ü�H‰HÐ/°°vÕ>ð r   c                 óh  — | j                   j                  }i d|“dd“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                  «       “d|j!                  «       “}|d   s
|d   s|d   rd|d<   |S )NrR   Úmetadata_versionz1.0rT   ÚversionÚsummaryÚ	home_pageÚauthorÚauthor_emailÚlicenseÚdescriptionÚkeywordsÚplatformr%   Údownload_urlÚprovidesÚrequiresÚ	obsoletesz1.1)r   ÚmetadataÚget_nameÚget_versionÚget_descriptionÚget_urlÚget_contactÚget_contact_emailÚget_licenceÚget_long_descriptionÚget_keywordsÚget_platformsÚget_classifiersÚget_download_urlÚget_providesÚget_requiresÚget_obsoletes)r   ÚactionÚmetarj   s       r   rD   zregister.build_post_dataÝ   s�  € ð × Ñ ×)Ñ)ˆð
Ø�vð
à ð
ð �D—M‘M“Oð
ð �t×'Ñ'Ó)ð	
ð
 �t×+Ñ+Ó-ð
ð ˜Ÿ™›ð
ð �d×&Ñ&Ó(ð
ð ˜D×2Ñ2Ó4ð
ð �t×'Ñ'Ó)ð
ð ˜4×4Ñ4Ó6ð
ð ˜×)Ñ)Ó+ð
ð ˜×*Ñ*Ó,ð
ð ˜4×/Ñ/Ó1ð
ð ˜D×1Ñ1Ó3ð
ð  ˜×)Ñ)Ó+ð!
ð" ˜×)Ñ)Ó+ð#
ð$ ˜×+Ñ+Ó-ð%
ˆð( �
Ò˜t JÒ/°4¸Ò3DØ',ˆDÐ#Ñ$Øˆr   Nc                 ó¸  — d|v r3| j                  d|d   ›d| j                  ›�t        j                  «       d}d|z   }|dz   }t	        j
                  «       }|j                  «       D ]Ÿ  \  }}t        |«      t        g «      t        d«      fvr|g}|D ]q  }t        |«      }|j                  |«       |j                  d|z  «       |j                  d	«       |j                  |«       |sŒX|d
   dk(  sŒa|j                  d«       Œs Œ¡ |j                  |«       |j                  d«       |j                  «       j                  d«      }d|z  t        t        |«      «      dœ}	t        j                  j                  | j                  ||	«      }
t        j                  j!                  t        j                  j#                  |¬«      «      }d}	 |j%                  |
«      }| j&                  r| j)                  |«      }d}| j&                  r4dj9                  d|df«      }| j                  |t        j                  «       |S # t        j*                  j,                  $ rH}| j&                  r|j.                  j1                  «       }|j2                  |j4                  f}Y d}~Œ¢d}~wt        j*                  j6                  $ r}dt        |«      f}Y d}~ŒÔd}~ww xY w)zC Post a query to the server, and return a string response.
        rT   zRegistering z to z3--------------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)Úpassword_mgrrJ   )rL   ÚOKNiô  zK---------------------------------------------------------------------------)rZ   r1   r   r[   ÚioÚStringIOÚitemsÚtypeÚstrÚwriteÚgetvalueÚencodeÚlenr:   r;   ÚRequestÚbuild_openerÚHTTPBasicAuthHandlerÚopenÚshow_responser>   ÚerrorÚ	HTTPErrorÚfpÚreadrE   ÚmsgÚURLErrorÚjoin)r   rj   rh   ÚboundaryÚsep_boundaryÚend_boundaryÚbodyÚkeyÚvalueÚheadersÚreqÚopenerrF   Úer¤   s                  r   rC   zregister.post_to_serverù   sc  € ð �T‰>Ø�MŠM°D¸³LØ48·O²OðEä47·H±Hô>ð IˆØ Ñ(ˆØ# dÑ*ˆÜ�{‰{‹}ˆØŸ*™*›,ò 	%‰JˆC�ä�E‹{¤4¨£8¬T°2«ZÐ"8Ñ8Ø˜�Øò %�Ü˜E›
�Ø—
‘
˜<Ô(Ø—
‘
ÐHÈÑLÔMØ—
‘
˜6Ô"Ø—
‘
˜5Ô!Ú˜U 2™Y¨$Ó.Ø—J‘J˜tÕ$ñ%ð		%ð 	�
‰
�<Ô Ø�
‰
�4ÔØ�}‰}‹×%Ñ% gÓ.ˆð NÈhÑVÜ!¤# d£)›nñ
ˆô �n‰n×$Ñ$ T§_¡_°d¸GÓDˆô —‘×,Ñ,Ü�N‰N×/Ñ/¸TÐ/ÓBó
ˆð ˆð	Ø—[‘[ Ó%ˆFð ×!Ò!Ø×/Ñ/°Ó7�ØˆFØ×ÒØ—)‘)˜X t¨XÐ6Ó7ˆCØ�M‰M˜#œsŸx™xÔ(Øˆøô �|‰|×%Ñ%ò 	#Ø×!Ò!Ø—t‘t—y‘y“{�Ø—V‘V˜QŸU™U�]�FûÜ�|‰|×$Ñ$ò 	!Øœ#˜a›&�[�Fûð	!ús$   ÇI ÉKÉ>J"Ê" KËKËKr   )Ú__name__Ú
__module__Ú__qualname__rs   r   Úuser_optionsÚboolean_optionsÚsub_commandsr   r   r(   r-   r    r%   r$   r&   rD   rC   r   r   r   r   r      sƒ   „ àL€KØ ×-Ñ-ð	-ð	Oð1
ñ 
€Lð $×3Ñ3ò 70ñ 0€Oð Ñ/Ð0Ð1€Lòò
Cò!òò$ò"5ò;òx?òtô87r   r   )Ú__doc__r^   r’   Úurllib.parser:   Úurllib.requestÚwarningsr   Údistutils.corer   Údistutils.errorsÚ	distutilsr   r   r   r   r   ú<module>r¾      s/   ðñó Û 	ß #Ý å (Ü Ý ô_ˆ}õ _r   