ó b-äQc@s2dZddlZddlZddlZddlZddlZddlZddlmZddl m Z ddl m Z ddl mZyddlmZWn!ek rÅddlmZnXddlmZmZmZmZejd kZerd Znd Zd d „Zdefd„ƒYZdS(spupload_docs Implements a Distutils 'upload_docs' subcommand (upload documentation to PyPI's pythonhosted.org). iÿÿÿÿN(tstandard_b64encode(titer_entry_points(tlog(tDistutilsOptionError(tupload(thttplibturlparsetunicodet iteritemst3tsurrogateescapetstrictsutf-8cCs#t|tƒr|j|tƒS|S(N(t isinstanceRtencodeterrors(tstencoding((sB/usr/lib/python2.7/site-packages/setuptools/command/upload_docs.pytb&st 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_dirtNoneRtTrue(tselftep((sB/usr/lib/python2.7/site-packages/setuptools/command/upload_docs.pyt has_sphinx9sRcCs#tj|ƒd|_d|_dS(N(Rtinitialize_optionsRRt target_dir(R((sB/usr/lib/python2.7/site-packages/setuptools/command/upload_docs.pyR@s  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((sB/usr/lib/python2.7/site-packages/setuptools/command/upload_docs.pyREs    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((sB/usr/lib/python2.7/site-packages/setuptools/command/upload_docs.pytcreate_zipfileSs" "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((sB/usr/lib/python2.7/site-packages/setuptools/command/upload_docs.pytrunds  cCsZt|dƒ}|jƒ}|jƒ|jj}idd6|jƒd6tjj|ƒ|fd6}t |j d|j ƒ}t |ƒ}t jd(kr«|jdƒ}nd |}d }t d ƒt |ƒ} | t d ƒ} g} xt|ƒD]ú\} } d | }t| ƒtgƒkr.| g} nx½| D]µ}t|ƒtkrl|d|d7}|d}n t |ƒ}| j| ƒ| jt |ƒƒ| jt dƒƒ| j|ƒ|r5|dt dƒkr5| jt dƒƒq5q5WqôW| j| ƒ| jt dƒƒt dƒj| ƒ} |jd|jtjƒt|jƒ\}}}}}}|dkr€tj|ƒ}n.|dkržtj|ƒ}ntd|ƒ‚d}tj}yu|jƒ|jd|ƒ|j dd|ƒ|j dt!t"| ƒƒƒ|j d|ƒ|j#ƒ|j$| ƒWn>t%j&k rrt 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(ƒ|j.rVd&d'|jƒd&d'fGHndS()Ntrbt doc_uploads:actionR7tcontentt:itasciisBasic s3--------------GHSKFJDLGDS7543FJKLFHRE75642756743254s --s--s* Content-Disposition: form-data; name="%s"s; filename="%s"iis iÿÿÿÿs s tsSubmitting documentation to %sthttpthttpssunsupported schema tPOSTs Content-types multipart/form-data; boundary=%ssContent-lengtht AuthorizationiÈsServer response (%s): %si-tLocationshttps://pythonhosted.org/%s/sUpload successful. Visit %ssUpload failed (%s): %st-iK(i(/topentreadR1R@RARBR"R#tbasenameRtusernametpasswordRtsyst version_infotdecodeRttypettupletappendR$R't repositoryRtINFORRtHTTPConnectiontHTTPSConnectiontAssertionErrortconnectt putrequestt putheadertstrR-t endheaderstsendtsocketterrortexc_infotERRORt getresponsetstatustreasont getheaderRt show_response(RR2tfRKtmetatdatat credentialstauthtboundaryt sep_boundaryt end_boundarytbodytkeytvaluesttitletvaluetschematnetlocturltparamstqueryt fragmentstconntloglevelteRtlocation((sB/usr/lib/python2.7/site-packages/setuptools/command/upload_docs.pyRCrs               !              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(((sB/usr/lib/python2.7/site-packages/setuptools/command/upload_docs.pyR,s        (t__doc__R"RkR)R>RZRDtbase64Rt pkg_resourcesRt distutilsRtdistutils.errorsRtdistutils.command.uploadRt ImportErrortsetuptools.command.uploadtsetuptools.compatRRRRtversiont _IS_PYTHON3RRR(((sB/usr/lib/python2.7/site-packages/setuptools/command/upload_docs.pyts*       "