1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
U
G=®dÀ-ã@sddZddlZddlZddlZddlZddlmZddlm    Z    ddl
Tddl m 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„Z dd„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©©Úselfr r ú]D:\z\workplace\VsCode\pyvenv\venv\Lib\site-packages\setuptools/_distutils/command/register.pyÚ<lambda>ózregister.<lambda>cCst |¡d|_d|_dS)Nr)rÚinitialize_optionsÚlist_classifiersrr r r rrs
zregister.initialize_optionscCs*t |¡d|jfddœ}||jjd<dS)Nr)ré)rÚrestructuredtextr
)rÚfinalize_optionsrÚ distributionÚcommand_options)r Ú check_optionsr r rr$s
 
ÿzregister.finalize_optionscCsT| ¡| ¡| ¡D]}| |¡q|jr8| ¡n|jrH| ¡n| ¡dS)N)    rÚ _set_configÚget_sub_commandsÚ run_commandÚdry_runÚverify_metadatarÚ classifiersÚ send_metadata)r Úcmd_namer r rÚ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ÚPendingDeprecationWarningrÚget_command_objÚensure_finalizedrrr!)r r
r r rÚ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ÚrealmTÚpypiz%s not found in .pypircFN)Ú _read_pypircr&r'r(r)Ú
has_configÚDEFAULT_REPOSITORYÚ
ValueError)r Úconfigr r rrDs
 
 
 
 
zregister._set_configcCs*|jd}tj |¡}t | |¡¡dS)z8 Fetch the list of classifiers from the server.
        z?:action=list_classifiersN)r(ÚurllibÚrequestÚurlopenrÚinfoÚ_read_pypi_response)r ÚurlÚresponser r rrUs
 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_datarr3)r ÚcodeÚresultr r rr\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: rZsubmitr7éÈ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Únamer'ÚemailNZconfirmz
 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,r&r'ÚsplitÚannouncerÚINFOÚinputÚprintÚgetpassr0r1ÚHTTPPasswordMgrÚparseÚurlparser(Ú add_passwordr)r8r9rÚ _get_rc_fileÚlowerÚ _store_pypircr3)
r Úchoicer&r'ÚchoicesÚauthÚhostr:r;Údatar r rrcsšú
 
 
 
 ÿÿ
 
ÿÿÿ
 
 
 
 
 
 
 
 
zregister.send_metadatacCs|jj}|d| ¡| ¡| ¡| ¡| ¡| ¡| ¡|     ¡| 
¡|  ¡|  ¡|  ¡| ¡| ¡| ¡dœ}|ds„|ds„|drŒd|d<|S)Nz1.0)rDÚmetadata_versionrFÚversionÚsummaryZ    home_pageÚauthorÚ author_emailÚlicenseÚ descriptionÚkeywordsÚplatformrÚ download_urlÚprovidesÚrequiresÚ    obsoletesrerfrgz1.1r[)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ÚmetarZr r rr9Ý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.
        rFzRegistering %s to %sz3--------------GHSKFJDLGDS7543FJKLFHRE75642756743254z
--z--r z*
Content-Disposition: form-data; name="%s"z
 
éÿÿÿÿú Ú
zutf-8z/multipart/form-data; boundary=%s; charset=utf-8)z Content-typezContent-length)Ú password_mgrr>Niô)r?ÚOKzK---------------------------------------------------------------------------)rJr(rrKÚioÚStringIOÚitemsÚtypeÚstrÚwriteÚgetvalueÚencodeÚlenr0r1ÚRequestÚ build_openerÚHTTPBasicAuthHandlerÚopenÚerrorÚ    HTTPErrorÚ show_responseÚfpÚreadr:ÚmsgÚURLErrorr4Újoin)r rZrXÚboundaryZ sep_boundaryZ end_boundaryÚbodyÚkeyÚvalueÚheadersÚreqÚopenerr;Úer‘r r rr8ùs^ ÿþ
 
 
 
 
 
þ ÿ
 
zregister.post_to_server)N)Ú__name__Ú
__module__Ú __qualname__rarÚ user_optionsÚboolean_optionsÚ sub_commandsrrr!r%rrrrr9r8r r r rrs*ýÿ
zr)Ú__doc__rNrÚ urllib.parser0Úurllib.requestÚwarningsrÚdistutils.corerÚdistutils.errorsÚ    distutilsrrr r r rÚ<module>s