Viewing File: /usr/lib/python3.6/site-packages/setuptools/command/__pycache__/upload_docs.cpython-36.opt-1.pyc

3

Xoh@sdZddlmZddlmZddlmZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlmZddlmZmZddlmZd	d
lmZddZGd
ddeZdS)zpupload_docs

Implements a Distutils 'upload_docs' subcommand (upload documentation to
PyPI's pythonhosted.org).
)standard_b64encode)log)DistutilsOptionErrorN)six)http_clienturllib)iter_entry_points)uploadcCstjr
dnd}|jd|S)Nsurrogateescapestrictzutf-8)rPY3encode)serrorsr!/usr/lib/python3.6/upload_docs.py_encodesrc@seZdZdZdZdddejfddgZejZddZd
efgZ	ddZ
ddZddZddZ
eddZeddZddZdS)upload_docszhttps://pypi.python.org/pypi/zUpload documentation to PyPIzrepository=rzurl of repository [default: %s]
show-responseN&display full response text from serverupload-dir=directory to uploadcCs$|jdkr xtddD]}dSWdS)Nzdistutils.commandsbuild_sphinxT)
upload_dirr)selfZeprrr
has_sphinx/s
zupload_docs.has_sphinxrcCstj|d|_d|_dS)N)r
initialize_optionsr
target_dir)rrrrr6s
zupload_docs.initialize_optionscCstj||jdkrN|jr0|jd}|j|_q`|jd}tjj	|j
d|_n|jd|j|_d|jkrtt
jd|jd|jdS)NrbuildZdocsrzpypi.python.orgz3Upload_docs command is deprecated. Use RTD instead.zUsing upload directory %s)r
finalize_optionsrrZget_finalized_commandZbuilder_target_dirrospathjoinZ
build_baseZensure_dirname
repositoryrwarnannounce)rrr rrrr!;s







zupload_docs.finalize_optionscCstj|d}z|j|jxtj|jD]~\}}}||jkrT|rTd}t||jxP|D]H}tjj||}|t	|jdj
tjj}	tjj|	|}
|j||
qZWq(WWd|j
XdS)Nwz'no files found in upload directory '%s')zipfileZZipFileZmkpathrr"walkrr#r$lenlstripsepwriteclose)rfilenamezip_filerootdirsfilesZtmplnameZfullZrelativedestrrrcreate_zipfileKs
zupload_docs.create_zipfilecCslx|jD]}|j|q
Wtj}|jjj}tjj	|d|}z|j
||j|Wdtj
|XdS)Nz%s.zip)Zget_sub_commandsZrun_commandtempfileZmkdtempdistributionmetadataget_namer"r#r$r7upload_fileshutilZrmtree)rZcmd_nameZtmp_dirr5r1rrrrun[s
zupload_docs.runccs|\}}d|}t|ts |g}xn|D]f}t|trN|d|d7}|d}nt|}|Vt|VdV|V|r&|dddkr&dVq&WdS)	Nz*
Content-Disposition: form-data; name="%s"z; filename="%s"rr	s



)
isinstancelisttupler)itemsep_boundarykeyvaluestitlevaluerrr_build_partis




zupload_docs._build_partcCsnd}d|}|d}|df}tj|j|d}t||j}tjj|}tj||}	d|jd}
dj	|	|
fS)	z=
        Build up the MIME payload for the POST data
        s3--------------GHSKFJDLGDS7543FJKLFHRE75642756743254s
--s--r@)rFz multipart/form-data; boundary=%sascii)
	functoolspartialrKmapitems	itertoolschain
from_iterabledecoder$)clsdataboundaryrFZend_boundaryZ	end_itemsZbuilderZpart_groupspartsZ
body_itemscontent_typerrr_build_multipart}szupload_docs._build_multipartcCs:t|d}|j}WdQRX|jj}d|jtjj||fd}t|j	d|j
}t|}tj
rn|jd}d|}|j|\}}	d|j}
|j|
tjtjj|j\}}}
}}}|dkrtj|}n |d	krtj|}ntd
|d}yZ|j|jd|
|	}|jd
||jdtt||jd||j |j!|Wn6t"j#k
r~}z|jt|tj$dSd}~XnX|j%}|j&dkrd|j&|j'f}
|j|
tjnb|j&dkr|j(d}|dkrd|j}d|}
|j|
tjnd|j&|j'f}
|j|
tj$|j)r6t*dd|jdddS)NrbZ
doc_upload)z:actionr5content:rLzBasic zSubmitting documentation to %sZhttpZhttpszunsupported schema ZPOSTzContent-typezContent-lengthZ
AuthorizationzServer response (%s): %si-ZLocationzhttps://pythonhosted.org/%s/zUpload successful. Visit %szUpload failed (%s): %s-K)+openreadr9r:r;r"r#basenamerZusernameZpasswordrrr
rUr[r%r'rINFOrparseZurlparserZHTTPConnectionZHTTPSConnectionAssertionErrorZconnectZ
putrequestZ	putheaderstrr+Z
endheaderssendsocketerrorZERRORZgetresponseZstatusreasonZ	getheaderZ
show_responseprint)rr0fr]metarWZcredentialsZauthZbodyZctmsgZschemaZnetlocZurlZparamsZqueryZ	fragmentsZconnrZerlocationrrrr<s^



zupload_docs.upload_file)rNr)rNr)__name__
__module____qualname__ZDEFAULT_REPOSITORYdescriptionr
Zuser_optionsZboolean_optionsrZsub_commandsrr!r7r>staticmethodrKclassmethodr[r<rrrrrs"

r)__doc__base64rZ	distutilsrZdistutils.errorsrr"rkr)r8r=rRrNZsetuptools.externrZsetuptools.extern.six.movesrrZ
pkg_resourcesrr
rrrrrr<module>s 
Back to Directory File Manager