Your IP : 3.147.57.239


Current Path : /lib/python3.8/site-packages/setuptools/command/__pycache__/
Upload File :
Current File : //lib/python3.8/site-packages/setuptools/command/__pycache__/upload_docs.cpython-38.pyc

U

�Qab��@s�dZddlmZddlmZddlmZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlmZddlmZmZddlmZd	d
lmZdd�ZGd
d�de�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�)�uploadcCstjr
dnd}|�d|�S)N�surrogateescape�strictzutf-8)r�PY3�encode)�s�errors�r�B/usr/lib/python3.8/site-packages/setuptools/command/upload_docs.py�_encodesrc@s�eZdZdZdZdddejfddgZejZdd	�Zd
efgZ	dd�Z
d
d�Zdd�Zdd�Z
edd��Zedd��Zdd�ZdS)�upload_docszhttps://pypi.python.org/pypi/zUpload documentation to PyPIzrepository=�rzurl of repository [default: %s])z
show-responseNz&display full response text from server)zupload-dir=Nzdirectory to uploadcCs"|jdkrtdd�D]}dSdS)Nzdistutils.commands�build_sphinxT)�
upload_dirr)�selfZeprrr�
has_sphinx/s
zupload_docs.has_sphinxrcCst�|�d|_d|_dS)N)r
�initialize_optionsr�
target_dir)rrrrr6s
zupload_docs.initialize_optionscCs�t�|�|jdkrN|��r0|�d�}|j|_q`|�d�}tj�	|j
d�|_n|�d�|j|_d|jkrtt
�d�|�d|j�dS)Nr�buildZdocsrzpypi.python.orgz3Upload_docs command is deprecated. Use RTD instead.zUsing upload directory %s)r
�finalize_optionsrrZget_finalized_commandZbuilder_target_dirr�os�path�joinZ
build_baseZensure_dirname�
repositoryr�warn�announce)rrrrrrr;s







zupload_docs.finalize_optionscCs�t�|d�}z�|�|j�t�|j�D]x\}}}||jkrP|sPd}t||j��|D]H}tj�	||�}|t
|j�d��tjj�}	tj�	|	|�}
|�
||
�qTq&W5|��XdS)N�wz'no files found in upload directory '%s')�zipfileZZipFile�closeZmkpathrr�walkrrr �len�lstrip�sep�write)r�filename�zip_file�root�dirs�filesZtmpl�nameZfull�relative�destrrr�create_zipfileKszupload_docs.create_zipfilec	Csh|��D]}|�|�qt��}|jj��}tj�	|d|�}z|�|�|�
|�W5t
�|�XdS)Nz%s.zip)Zget_sub_commandsZrun_command�tempfileZmkdtemp�distribution�metadata�get_namerrr �shutilZrmtreer4�upload_file)rZcmd_nameZtmp_dirr1r-rrr�run[s
zupload_docs.runccs�|\}}d|}t|t�s |g}|D]f}t|t�rL|d|d7}|d}nt|�}|Vt|�VdV|V|r$|dd�dkr$dVq$dS)	Nz*
Content-Disposition: form-data; name="%s"z; filename="%s"rr	s

����
�
)�
isinstance�list�tupler)�item�sep_boundary�key�values�title�valuerrr�_build_partis



zupload_docs._build_partcCsnd}d|}|d}|df}tj|j|d�}t||���}tj�|�}t�||�}	d|�d�}
d�	|	�|
fS)	z=
        Build up the MIME payload for the POST data
        s3--------------GHSKFJDLGDS7543FJKLFHRE75642756743254s
--s--r>)rCz multipart/form-data; boundary=%s�ascii�)
�	functools�partialrH�map�items�	itertools�chain�
from_iterable�decoder )�cls�data�boundaryrCZend_boundaryZ	end_itemsZbuilderZpart_groups�partsZ
body_items�content_typerrr�_build_multipart}s�zupload_docs._build_multipartc
CsJt|d��}|��}W5QRX|jj}d|��tj�|�|fd�}t|j	d|j
�}t|�}tj
rn|�d�}d|}|�|�\}}	d|j}
|�|
tj�tj�|j�\}}}
}}}|s�|s�|r�t�|dkr�t�|�}n |d	kr�t�|�}ntd
|��d}zZ|��|�d|
�|	}|�d
|�|�dtt|���|�d|�|� �|�!|�Wn>t"j#k
�r�}z|�t|�tj$�WY�dSd}~XYnX|�%�}|j&dk�r�d|j&|j'f}
|�|
tj�nb|j&dk�r|�(d�}|dk�r�d|��}d|}
|�|
tj�nd|j&|j'f}
|�|
tj$�|j)�rFt*d|��d�dS)N�rbZ
doc_upload)z:actionr1�content�:rIzBasic zSubmitting documentation to %sZhttpZhttpszunsupported schema �ZPOSTzContent-typezContent-lengthZ
Authorization��zServer response (%s): %si-ZLocationzhttps://pythonhosted.org/%s/zUpload successful. Visit %szUpload failed (%s): %szK---------------------------------------------------------------------------)+�open�readr6r7r8rr�basenamerZusernameZpasswordrrr
rRrXr!r#r�INFOr�parseZurlparse�AssertionErrorrZHTTPConnectionZHTTPSConnectionZconnectZ
putrequestZ	putheader�strr(Z
endheaders�send�socket�errorZERRORZgetresponseZstatus�reasonZ	getheaderZ
show_response�print)rr,�frZ�metarTZcredentialsZauthZbodyZct�msgZschemaZnetlocZurlZparamsZqueryZ	fragmentsZconnrW�er�locationrrrr:�sd�

�

zupload_docs.upload_fileN)�__name__�
__module__�__qualname__ZDEFAULT_REPOSITORY�descriptionr
Zuser_optionsZboolean_optionsrZsub_commandsrrr4r;�staticmethodrH�classmethodrXr:rrrrrs(��


r)�__doc__�base64rZ	distutilsrZdistutils.errorsrrrfr%r5r9rOrKZsetuptools.externrZsetuptools.extern.six.movesrrZ
pkg_resourcesrr
rrrrrr�<module>s 

?>