| Server IP : 127.0.0.1 / Your IP : 216.73.216.109 Web Server : Apache/2.4.54 (Win64) OpenSSL/1.1.1q PHP/8.1.10 System : Windows NT DESKTOP-E5T4RUN 10.0 build 19045 (Windows 10) AMD64 User : SERVERWEB ( 0) PHP Version : 8.1.10 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/cygwin64/lib/python3.6/site-packages/setuptools/command/__pycache__/ |
Upload File : |
3
��a2 � @ s� d Z ddlmZ ddlmZ ddlmZ ddlZddlZddl Z ddl
Z
ddlZddlZddl
Z
ddlZddlZddlmZ ddlmZ d d
� ZG dd� de�ZdS )
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� )�uploadc C s | j dd�S )Nzutf-8�surrogateescape)�encode)�s� r �!/usr/lib/python3.6/upload_docs.py�_encode s r
c @ s� e Zd ZdZdZdddej fddgZejZdd� Zd
efgZ dd� Z
dd� Zdd� Zdd� Z
edd� �Zedd� �Zdd� ZdS )�upload_docszhttps://pypi.python.org/pypi/z;Upload documentation to sites other than PyPi such as devpizrepository=�rzurl of repository [default: %s]�
show-responseN�&display full response text from server�upload-dir=�directory to uploadc C s$ | j d kr xtdd�D ]}dS W d S )Nzdistutils.commands�build_sphinxT)�
upload_dirr )�selfZepr r r �
has_sphinx- s
zupload_docs.has_sphinxr c C s t j| � d | _d | _d S )N)r �initialize_optionsr �
target_dir)r r r r r 4 s
zupload_docs.initialize_optionsc C s� t j| � | jd krV| j� r8| jd�}t|j�d | _qh| jd�}tj j
|jd�| _n| jd� | j| _d| j
kr|tjd� | jd| j � d S ) Nr Zhtml�buildZdocsr zpypi.python.orgz<Upload_docs command is deprecated for PyPi. Use RTD instead.zUsing upload directory %s)r �finalize_optionsr r Zget_finalized_command�dictZbuilder_target_dirsr �os�path�joinZ
build_baseZensure_dirname�
repositoryr �warn�announce)r r r r r r r 9 s
zupload_docs.finalize_optionsc C s� t j|d�}z�| j| j� x�tj| j�D ]~\}}}|| jkrT| rTd}t|| j ��xP|D ]H}tjj||�}|t | j�d � j
tjj�} tjj| |�}
|j||
� qZW q(W W d |j
� X d S )N�wz'no files found in upload directory '%s')�zipfileZZipFileZmkpathr r �walkr r r �len�lstrip�sep�write�close)r �filename�zip_file�root�dirs�filesZtmpl�nameZfullZrelative�destr r r �create_zipfileI s
zupload_docs.create_zipfilec C sl x| j � D ]}| j|� q
W tj� }| jjj� }tjj |d| �}z| j
|� | j|� W d tj
|� X d S )Nz%s.zip)Zget_sub_commandsZrun_command�tempfileZmkdtemp�distribution�metadata�get_namer r r r2 �upload_file�shutilZrmtree)r Zcmd_nameZtmp_dirr0 r, r r r �runY s
zupload_docs.runc c s� | \}}d| }t |t�s |g}xn|D ]f}t |t�rN|d|d 7 }|d }nt|�}|V t|�V dV |V |r&|dd � dkr&dV q&W d S ) Nz*
Content-Disposition: form-data; name="%s"z; filename="%s"r r s
�
�
���)�
isinstance�list�tupler
)�item�sep_boundary�key�values�title�valuer r r �_build_partg s
zupload_docs._build_partc C sn d}d|j d� }|d }|df}tj| j|d�}t||j� �}tjj|�}tj||�} d| }
dj | �|
fS ) z=
Build up the MIME payload for the POST data
z3--------------GHSKFJDLGDS7543FJKLFHRE75642756743254s
--�asciis --r; )rA z multipart/form-data; boundary=%s� )
r � functools�partialrF �map�items� itertools�chain�
from_iterabler )�cls�data�boundaryrA Zend_boundaryZ end_itemsZbuilderZpart_groups�partsZ
body_items�content_typer r r �_build_multipart{ s zupload_docs._build_multipartc C sJ t |d��}|j� }W d Q R X | jj}d|j� tjj|�|fd�}t| j d | j
�}t|�jd�}d| }| j
|�\}} d| j }
| j|
tj� tjj| j�\}}}
}}}| r�| r�| s�t�|dkr�tjj|�}n"|d kr�tjj|�}ntd
| ��d}yZ|j� |jd|
� | }|jd
|� |jdtt|��� |jd|� |j� |j |� W n6 t!j"k
�r� } z| jt|�tj#� d S d }~X nX |j$� }|j%dk�r�d|j%|j&f }
| j|
tj� nb|j%dk�r|j'd�}|d k�r�d|j� }d| }
| j|
tj� nd|j%|j&f }
| j|
tj#� | j(�rFt)dd |j� dd � d S )N�rbZ
doc_upload)z:actionr0 �content�:rG zBasic zSubmitting documentation to %s�httpZhttpszunsupported schema � ZPOSTzContent-typezContent-lengthZ
Authorization�� zServer response (%s): %si- ZLocationzhttps://pythonhosted.org/%s/zUpload successful. Visit %szUpload failed (%s): %s�-�K )*�open�readr4 r5 r6 r r �basenamer
ZusernameZpasswordr �decoderU r r"