ó ž­çSc@sþdZddlmZddlmZddlmZddlmZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlmZmZmZmZmZddlmZerÒd nd Zd d „Zd efd„ƒYZdS(spupload_docs Implements a Distutils 'upload_docs' subcommand (upload documentation to PyPI's pythonhosted.org). iÿÿÿÿ(tstandard_b64encode(tlog(tDistutilsOptionError(tuploadN(thttplibturlparsetunicodet iteritemstPY3(titer_entry_pointstsurrogateescapetstrictsutf-8cCs#t|tƒr|j|tƒS|S(N(t isinstanceRtencodeterrors(tstencoding((sH/usr/local/lib/python2.7/site-packages/setuptools/command/upload_docs.pytbst upload_docscBs{eZdZdddejfddgZejZd„Zd efgZ d „Z d „Z d „Z d „Z d„ZRS(sUpload documentation to PyPIs repository=trsurl of repository [default: %s]s show-responses&display full response text from servers upload-dir=sdirectory to uploadcCs1|jdkr-xtddƒD]}tSWndS(Nsdistutils.commandst build_sphinx(t upload_dirtNoneR tTrue(tselftep((sH/usr/local/lib/python2.7/site-packages/setuptools/command/upload_docs.pyt has_sphinx.sRcCs#tj|ƒd|_d|_dS(N(Rtinitialize_optionsRRt target_dir(R((sH/usr/local/lib/python2.7/site-packages/setuptools/command/upload_docs.pyR5s  cCs¤tj|ƒ|jdkrs|jƒrF|jdƒ}|j|_qŒ|jdƒ}tj j |j dƒ|_n|j dƒ|j|_|j d|jƒdS(NRtbuildtdocsRsUsing upload directory %s(Rtfinalize_optionsRRRtget_finalized_commandtbuilder_target_dirRtostpathtjoint build_basetensure_dirnametannounce(RRR((sH/usr/local/lib/python2.7/site-packages/setuptools/command/upload_docs.pyR:s    c Cs÷tj|dƒ}zÓ|j|jƒx¼tj|jƒD]¨\}}}||jkrs| rstd|jƒ‚nxj|D]b}tjj||ƒ}|t |jƒj tjj ƒ}tjj||ƒ} |j || ƒqzWq8WWd|j ƒXdS(Ntws'no files found in upload directory '%s'(tzipfiletZipFiletmkpathRR"twalkRR#R$tlentlstriptseptwritetclose( Rtfilenametzip_filetroottdirstfilestnametfulltrelativetdest((sH/usr/local/lib/python2.7/site-packages/setuptools/command/upload_docs.pytcreate_zipfileHs" "cCsŽx!|jƒD]}|j|ƒq Wtjƒ}|jjjƒ}tjj |d|ƒ}z|j |ƒ|j |ƒWdt j |ƒXdS(Ns%s.zip(tget_sub_commandst run_commandttempfiletmkdtempt distributiontmetadatatget_nameR"R#R$R;t upload_filetshutiltrmtree(Rtcmd_namettmp_dirR7R3((sH/usr/local/lib/python2.7/site-packages/setuptools/command/upload_docs.pytrunYs  cCsEt|dƒ}|jƒ}|jƒ|jj}idd6|jƒd6tjj|ƒ|fd6}t |j d|j ƒ}t |ƒ}t r¢|jdƒ}nd|}d }t d ƒt |ƒ} | t d ƒ} g} xÿt|ƒD]ñ\} } d | }t| tƒs| g} nx½| D]µ}t|ƒtkrZ|d |d7}|d}n t |ƒ}| j| ƒ| jt |ƒƒ| jt dƒƒ| j|ƒ|r#|dt dƒkr#| jt dƒƒq#q#WqëW| j| ƒ| jt dƒƒt dƒj| ƒ} |jd|jtjƒt|jƒ\}}}}}}|dkrntj|ƒ}n.|dkrŒtj|ƒ}ntd|ƒ‚d}y{|jƒ|j d|ƒd|}|j!d|ƒ|j!dt"t#| ƒƒƒ|j!d|ƒ|j$ƒ|j%| ƒWn>t&j'k r]t(j)ƒd}|jt"|ƒtj*ƒdSX|j+ƒ}|j,dkrŸ|jd|j,|j-ftjƒnz|j,d krö|j.d!ƒ}|dkrÜd"|jƒ}n|jd#|tjƒn#|jd$|j,|j-ftj*ƒ|j0rAd%d&|jƒd%d&fGHndS('Ntrbt doc_uploads:actionR7tcontentt:tasciisBasic s3--------------GHSKFJDLGDS7543FJKLFHRE75642756743254s --s--s* Content-Disposition: form-data; name="%s"s; filename="%s"iis iÿÿÿÿs s tsSubmitting documentation to %sthttpthttpssunsupported schema tPOSTs multipart/form-data; boundary=%ss Content-typesContent-lengtht AuthorizationiÈsServer response (%s): %si-tLocationshttps://pythonhosted.org/%s/sUpload successful. Visit %ssUpload failed (%s): %st-iK(1topentreadR1R@RARBR"R#tbasenameRtusernametpasswordRRtdecodeRR tlistttypettupletappendR$R't repositoryRtINFORRtHTTPConnectiontHTTPSConnectiontAssertionErrortconnectt putrequestt putheadertstrR-t endheaderstsendtsocketterrortsystexc_infotERRORt getresponsetstatustreasont getheaderRt show_response(RR2tfRKtmetatdatat credentialstauthtboundaryt sep_boundaryt end_boundarytbodytkeytvaluesttitletvaluetschematnetlocturltparamstqueryt fragmentstconnt content_typeteRtlocation((sH/usr/local/lib/python2.7/site-packages/setuptools/command/upload_docs.pyRCgsŽ               !            N(s show-responseNs&display full response text from server(s upload-dir=Nsdirectory to upload(t__name__t __module__t descriptionRtDEFAULT_REPOSITORYRt user_optionstboolean_optionsRt sub_commandsRRR;RHRC(((sH/usr/local/lib/python2.7/site-packages/setuptools/command/upload_docs.pyR"s        (t__doc__tbase64Rt distutilsRtdistutils.errorsRtdistutils.command.uploadRR"RjR)R>RlRDtsetuptools.compatRRRRRt pkg_resourcesR RRR(((sH/usr/local/lib/python2.7/site-packages/setuptools/command/upload_docs.pyts      (