_d/BdZddlZddlmZddlmZdZGddeZy) 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^eZdZdZdZdZdZdZdddezfdgZd gZ d Z d Z d Z d Z dZdZy) 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 serverr c|tjjtjjddS)zReturns rc file path.~z.pypirc)ospathjoin expanduserselfs >/usr/lib/python3/dist-packages/setuptools/_distutils/config.py _get_rc_filezPyPIRCCommand._get_rc_file%s&ww||BGG..s3Y??c|j}tjtj|tjtj zdd5}|j t||fzdddy#1swYyxYw)zCreates a default .pypirc file.iwN)rr fdopenopenO_CREATO_WRONLYwriteDEFAULT_PYPIRC)rusernamepasswordrcfs r _store_pypirczPyPIRCCommand._store_pypirc)se     YYrwwr2:: #;UCS I ;Q GGNh%99 : ; ; ;s A??Bc|j}tjj|r|j d|z|j xs |j }t}|j||j}d|vr|jdd}|jdDcgc]%}|jdk7r|j'}}|gk(r d|vrdg}niS|D]}d|i}|j|d|d<d |j fd |jfd fD]2\} } |j|| r|j|| || <.| || <4|dk(r#||j dfvr|j |d <|cS|d|k(s |d |k(s|cSiSd |vred }|j|d r|j|d }n |j }|j|d|j|d |||jdSiScc}w)zReads the .pypirc file.zUsing PyPI login from %s distutilsz index-servers rserverr repositoryrealm)rNz server-loginr)rrr(r'r))rr rexistsannouncer(DEFAULT_REPOSITORYrreadsectionsgetsplitstrip DEFAULT_REALM has_option) rr r(configr. index_serversr'_serverscurrentkeydefaults r _read_pypirczPyPIRCCommand._read_pypirc/sK     77>>"  MM4r9 :CD,C,CJ$&F KKO(Hh& & ; H #0"5"5d";||~+LLN r>)$*8 " &'F'0G*0**VZ*HGJ'&t'>'>? $"4"45*)3 W ",,VS9+1::fc+BGCL+2GCL3'J//;-150G0G -& )Z7"<0J>&;'Z  8+'$$V\:!'FL!AJ!%!8!8J & 6: > & 6: >",$!//  us4*H cddl}|jdd}|j|djdd}|j j |S)z%Read and decode a PyPI HTTP response.rNz content-typez text/plainrcharsetascii)cgi getheader parse_headerr/r-decode)rresponser> content_typeencodings r_read_pypi_responsez!PyPIRCCommand._read_pypi_responsexsP)).,G ##L1!488GL}}%%h//rc.d|_d|_d|_y)zInitialize options.Nr)r(r) show_responsers rinitialize_optionsz PyPIRCCommand.initialize_optionss rcz|j|j|_|j|j|_yy)zFinalizes options.N)r(r,r)r2rs rfinalize_optionszPyPIRCCommand.finalize_optionss5 ?? ""55DO :: ++DJ r)__name__ __module__ __qualname____doc__r,r2r(r) user_optionsboolean_optionsrr"r:rErHrJrrrrsb@:MJ E >ASSTIL ''O@; GR0 ,rr)rNr configparserrcmdrrrrQrrrTs*  (u,Gu,r