Files
Home-AssistantConfig/deps/setuptools/command/__pycache__/upload_docs.cpython-34.pyc
T

56 lines
6.4 KiB
Plaintext
Raw Normal View History

2016-10-11 16:42:06 +00:00
î
ø¾ûWkã@dZddlmZddlmZddlmZddlZddlZddl Z ddl
Z
ddl Z ddl Z ddl
Z
ddlmZddlmZmZddlmZd d
lmZd d ZGd
ddeƒZdS)zpupload_docs
Implements a Distutils 'upload_docs' subcommand (upload documentation to
PyPI's pythonhosted.org).
é)Ústandard_b64encode)Úlog)ÚDistutilsOptionErrorN)Úsix)Ú http_clientÚurllib)Úiter_entry_pointsé)ÚuploadcCs%tjrdnd}|jd|ƒS)surrogateescapeÚstrictzutf-8)rÚPY3Úencode)Úerrors©rúD/tmp/pip-build-fo9udfsu/setuptools/setuptools/command/upload_docs.pyÚ_encodesrc@s¿eZdZdZdZdddejfddgZejZd d Zd
efgZ ddZ
ddZ ddZ ddZ
eddƒZeddƒZddZdS)Ú upload_docszhttps://pypi.python.org/pypi/zUpload documentation to PyPIz repository=Úrzurl of repository [default: %s]ú
show-responseNú&display full response text from serverú upload-dir=údirectory to uploadcCs1|jdkr-xtddƒD]}dSWndS)Nzdistutils.commandsÚ build_sphinxT)Ú
upload_dirr)ÚselfÚeprrrÚ
has_sphinx/szupload_docs.has_sphinxrcCs#tj|ƒd|_d|_dS)N)r
Úinitialize_optionsrÚ
target_dir)rrrrr6s
 zupload_docs.initialize_optionscCtjdƒtj|ƒ|jdkr€|jƒrS|jdƒ}|j|_q™|jdƒ}t j
j |j dƒ|_n|j
dƒ|j|_|jd|jƒdS)Nz3Upload_docs command is deprecated. Use RTD instead.rÚbuildZdocsrzUsing upload directory %s)rÚwarnr
Úfinalize_optionsrrÚget_finalized_commandZbuilder_target_dirr ÚosÚpathÚjoinÚ
build_baseÚensure_dirnameÚannounce)rrr!rrrr#;s

 
 zupload_docs.finalize_optionsc
Ctj|dƒ}|j|jƒtj|jƒD]®\}}}||jkrs| rstd|jƒnxp|D]h}tjj||ƒ}|t |jƒdj
tjj ƒ}tjj||ƒ} |j || ƒqzWq8WWd|j
ƒXdS)wz'no files found in upload directory '%s')ÚzipfileÚZipFileÚmkpathr r%Úwalkrr&r'ÚlenÚlstripÚsepÚwriteÚclose)
rÚfilenameÚzip_fileÚrootÚdirsÚfilesÚnameÚfullZrelativeÚdestrrrÚcreate_zipfileJs"
(zupload_docs.create_zipfilec Cx!|jƒD]}|j|ƒq
Wtjƒ}|jjjƒ}tjj |d|ƒ}z|j
|ƒ|j |ƒWdt j
|ƒXdS)Nz%s.zip)Úget_sub_commandsÚ run_commandÚtempfileÚmkdtempÚ distributionÚmetadataÚget_namer%r&r'r=Ú upload_fileÚshutilÚrmtree)rÚcmd_nameZtmp_dirr:r6rrrÚrun[s 
zupload_docs.runcc|\}}d|}t|tƒs1|g}nx†|D]~}t|tƒrl|d|d7}|d}n t|ƒ}|Vt|ƒVdV|V|r8|dddkr8dVq8q8WdS) Nz*
Content-Disposition: form-data; name="%s"z; filename="%s"rr s
s
s
éÿÿÿÿ)Ú
isinstanceÚlistÚtupler)ÚitemÚ sep_boundaryÚkeyÚvaluesÚtitleÚvaluerrrÚ _build_partis 
 

  zupload_docs._build_partc Cs”d}d|}|d}|df}tj|jd|ƒ}t||jƒƒ}tjj|ƒ}tj||ƒ} d|}
dj| ƒ|
fS)z=
Build up the MIME payload for the POST data
s3--------------GHSKFJDLGDS7543FJKLFHRE75642756743254s
--s--s
rOz multipart/form-data; boundary=%só) Ú functoolsÚpartialrTÚmapÚitemsÚ itertoolsÚchainÚ
from_iterabler') ÚclsÚdataÚboundaryrOZ end_boundaryZ end_itemsZbuilderZ part_groupsÚpartsZ
body_itemsÚ content_typerrrÚ_build_multipart}s