U e2@sdZddlmZddlmZddlmZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlmZddlmZd d ZGd d d eZdS) z|upload_docs Implements a Distutils 'upload_docs' subcommand (upload documentation to sites other than PyPi such as devpi). )standard_b64encode)log)DistutilsOptionErrorN)iter_entry_points)uploadcCs |ddS)Nzutf-8surrogateescape)encode)sr L/opt/hc_python/lib/python3.8/site-packages/setuptools/command/upload_docs.py_encodesr c@seZdZdZdZdddejfddgZejZdd Zd efgZ d d Z d dZ ddZ ddZ eddZeddZddZdS) upload_docszhttps://pypi.python.org/pypi/z;Upload documentation to sites other than PyPi such as devpiz repository=rzurl of repository [default: %s])z show-responseNz&display full response text from server)z upload-dir=Nzdirectory to uploadcCs"|jdkrtddD]}dSdS)Nzdistutils.commands build_sphinxT) upload_dirr)selfepr r r has_sphinx-s zupload_docs.has_sphinxrcCst|d|_d|_dS)N)rinitialize_optionsr target_dir)rr r r r4s zupload_docs.initialize_optionscCst||jdkrV|r8|d}t|jd|_qh|d}tj |j d|_n| d|j|_d|j kr|td|d|jdS) Nrhtmlbuilddocsrzpypi.python.orgzt!j"k r}z|t|tj#WYdSd}~XYnX|$}|j%dkrd|j%|j&f} || tjnb|j%dkr |'d}|dkrd|}d|} || tjnd|j%|j&f} || tj#|j(r@t)d|ddS)NrbZ doc_upload)z:actionr5content:rSzBasic zSubmitting documentation to %shttphttpszunsupported schema POSTz Content-typezContent-length AuthorizationzServer response (%s): %si-ZLocationzhttps://pythonhosted.org/%s/zUpload successful. Visit %szUpload failed (%s): %szK---------------------------------------------------------------------------)*openreadr>r?r@rrbasenamer usernamepasswordrdecoderar"r$rINFOurllibparseurlparseAssertionErrorreclientHTTPConnectionHTTPSConnectionconnect putrequest putheaderstrr+ endheaderssendsocketerrorERROR getresponsestatusreason getheader show_responseprint)rr/frcmetar] credentialsauthbodyctmsgZschemanetlocurlparamsquery fragmentsconnr`erlocationr r r rCs`            zupload_docs.upload_fileN)__name__ __module__ __qualname__DEFAULT_REPOSITORY descriptionr user_optionsboolean_optionsr sub_commandsrrr9rE staticmethodrR classmethodrarCr r r r rs(   r)__doc__base64r distutilsrdistutils.errorsrrrr&r<rArYrU http.clientre urllib.parserr pkg_resourcesrrr rr r r r s