a „oe/ã@s<dZddlZddlmZddlmZdZGdd„deƒZdS) zdistutils.pypirc Provides the PyPIRCCommand class, the base class for the command classes that uses .pypirc in the distutils.command package. éN)ÚRawConfigParseré)ÚCommandzE[distutils] index-servers = pypi [pypi] username:%s password:%s c@sheZdZdZdZdZdZdZdddefdgZd gZ d d „Z d d „Z dd„Z dd„Z dd„Zdd„ZdS)Ú PyPIRCCommandz6Base command that knows how to handle the .pypirc filezhttps://upload.pypi.org/legacy/ÚpypiNz repository=Úrzurl of repository [default: %s])ú show-responseNz&display full response text from serverrcCstj tj d¡d¡S)zReturns rc file path.ú~z.pypirc)ÚosÚpathÚjoinÚ expanduser©Úself©rú=C:\Program Files\Certbot\pkgs\setuptools\_distutils\config.pyÚ _get_rc_file%szPyPIRCCommand._get_rc_filecCs\| ¡}t t |tjtjBd¡d¡"}| t||f¡Wdƒn1sN0YdS)zCreates a default .pypirc file.i€ÚwN)rr ÚfdopenÚopenÚO_CREATÚO_WRONLYÚwriteÚDEFAULT_PYPIRC)rÚusernameÚpasswordÚrcÚfrrrÚ _store_pypirc)s zPyPIRCCommand._store_pypircc Csœ| ¡}tj |¡r˜| d|¡|jp.|j}tƒ}| |¡|  ¡}d|vrF|  dd¡}dd„|  d¡Dƒ}|gkrŽd|vrŠdg}niS|D]°}d|i}|  |d ¡|d <d |jfd |j fd fD].\} } |  || ¡rê|  || ¡|| <qÄ| || <qÄ|dkr ||jdfvr |j|d <|S|d|ks:|d |kr’|Sq’nRd |vr˜d }|  |d ¡rp|  |d ¡}n|j}|  |d ¡|  |d¡|||j dœSiS)zReads the .pypirc file.zUsing PyPI login from %sZ distutilsz index-serverscSs g|]}| ¡dkr| ¡‘qS)Ú)Ústrip)Ú.0ÚserverrrrÚ <s þz.PyPIRCCommand._read_pypirc..Ú rr"rÚ repositoryÚrealm)rNz server-loginr)rrr%r"r&)rr r ÚexistsZannouncer%ÚDEFAULT_REPOSITORYrÚreadÚsectionsÚgetÚsplitÚ DEFAULT_REALMZ has_option) rrr%Zconfigr*Z index_serversZ_serversr"ÚcurrentÚkeyÚdefaultrrrÚ _read_pypirc/sb    þý    þ  ÿ þ    ûzPyPIRCCommand._read_pypirccCs8ddl}| dd¡}| |¡d dd¡}| ¡ |¡S)z%Read and decode a PyPI HTTP response.rNz content-typez text/plainrÚcharsetÚascii)ÚcgiZ getheaderZ parse_headerr+r)Údecode)rZresponser4Z content_typeÚencodingrrrÚ_read_pypi_responsexs z!PyPIRCCommand._read_pypi_responsecCsd|_d|_d|_dS)zInitialize options.Nr)r%r&Z show_responserrrrÚinitialize_options€sz PyPIRCCommand.initialize_optionscCs(|jdur|j|_|jdur$|j|_dS)zFinalizes options.N)r%r(r&r-rrrrÚfinalize_options†s  zPyPIRCCommand.finalize_options)Ú__name__Ú __module__Ú __qualname__Ú__doc__r(r-r%r&Z user_optionsZboolean_optionsrrr1r7r8r9rrrrrs þIr)r=r Z configparserrÚcmdrrrrrrrÚs