a „oe).ã@sddZddlZddlZddlZddlZddlZddlmZddl m Z ddl m Z Gdd„de ƒZ dS) zhdistutils.command.register Implements the Distutils 'register' command (register with the repository). éN)Úwarné)Ú PyPIRCCommand)Úlogc@sŒeZdZdZejddgZejgd¢Zddd„fgZdd „Zd d „Z d d „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 úGC:\Program Files\Certbot\pkgs\setuptools\_distutils\command\register.pyÚ#ózregister.cCst |¡d|_d|_dS)Nr)rÚinitialize_optionsÚlist_classifiersrr r r rr%s zregister.initialize_optionscCs*t |¡d|jfddœ}||jjd<dS)Nr)ré)rÚrestructuredtextr )rÚfinalize_optionsrÚ distributionZcommand_options)r Z check_optionsr r rr*s  þzregister.finalize_optionscCsT| ¡| ¡| ¡D]}| |¡q|jr8| ¡n|jrH| ¡n| ¡dS)N) rÚ _set_configZget_sub_commandsZ run_commandÚdry_runÚverify_metadatarÚ classifiersÚ send_metadata)r Zcmd_namer r rÚrun3s    z register.runcCs8tdtƒ|j d¡}| ¡|j|_d|_| ¡dS)zDeprecated API.zVdistutils.command.register.check_metadata is deprecated; use the check command insteadr rN)rÚDeprecationWarningrZget_command_objZensure_finalizedrrr)r r r r rÚcheck_metadataBsý zregister.check_metadatacCsz| ¡}|ikr@|d|_|d|_|d|_|d|_d|_n6|jd|jfvr^td|jƒ‚|jdkrp|j|_d|_d S) z0Reads the configuration file and set attributes.ÚusernameÚpasswordÚ repositoryÚrealmTZpypiz%s not found in .pypircFN)Z _read_pypircrr r!r"Ú has_configZDEFAULT_REPOSITORYÚ ValueError)r Zconfigr r rrOs     zregister._set_configcCs*|jd}tj |¡}t | |¡¡dS)z.Fetch the list of classifiers from the server.z?:action=list_classifiersN)r!ÚurllibÚrequestZurlopenrÚinfoÚ_read_pypi_response)r ÚurlZresponser r rr_s  zregister.classifierscCs&| | d¡¡\}}t d||¡dS)zÚioÚStringIOÚitemsÚtypeÚstrÚwriteÚgetvalueÚencodeÚlenr%r&ZRequestZ build_openerZHTTPBasicAuthHandlerÚopenÚerrorZ HTTPErrorZ show_responseÚfpÚreadr-ÚmsgZURLErrorr(Újoin)r rJrHÚboundaryZ sep_boundaryZ end_boundaryÚbodyÚkeyÚvalueZheadersZreqÚopenerr.Úergr r rr+s`þ     ÿ ý ÿ  " zregister.post_to_server)N)Ú__name__Ú __module__Ú __qualname__rNrZ user_optionsZboolean_optionsZ sub_commandsrrrrrrrrr,r+r r r rrs$þ  r)Ú__doc__rArZr=Ú urllib.parser%Zurllib.requestÚwarningsrZcorerZdistutils._logrrr r r rÚs