HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.7/site-packages/setuptools/command/__pycache__/upload_docs.cpython-37.pyc
B

N��g
�@s�dZddlmZddlmZddlmZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlmZddlmZd	d
lmZdd�ZGd
d�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�)�metadata)�SetuptoolsDeprecationWarning�)�uploadcCs|�dd�S)Nzutf-8�surrogateescape)�encode)�s�r
�B/tmp/pip-unpacked-wheel-yrlplx0q/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/z;Upload documentation to sites other than PyPi such as devpizrepository=�rzurl of repository [default: %s])z
show-responseNz&display full response text from server)zupload-dir=Nzdirectory to uploadcCst|jdkotjddd��S)Nzdistutils.commands�build_sphinx)�group�name)�bool�
upload_dirr�entry_points)�selfr
r
r�
has_sphinx.s
zupload_docs.has_sphinxrcCst�|�d|_d|_dS)N)r	�initialize_optionsr�
target_dir)rr
r
rr6s
zupload_docs.initialize_optionscCs�t�d�t�|�|jdkr`|��rB|�d�}t|j�d|_	qr|�d�}t
j�|j
d�|_	n|�d�|j|_	|�d|j	�dS)NzWUpload_docs command is deprecated. Use Read the Docs (https://readthedocs.org) instead.r�html�buildZdocsrzUsing upload directory %s)r�warnr	�finalize_optionsrr�get_finalized_command�dictZbuilder_target_dirsr�os�path�join�
build_base�ensure_dirname�announce)rrrr
r
rr;s




zupload_docs.finalize_optionscCs�t�|d�}z�|�|j�x�t�|j�D]|\}}}||jkrR|sRd}t||j��xP|D]H}tj�||�}|t	|j�d��
tjj�}	tj�|	|�}
|�||
�qXWq(WWd|�
�XdS)N�wz'no files found in upload directory '%s')�zipfile�ZipFile�mkpathrr"�walkrr#r$�len�lstrip�sep�write�close)r�filename�zip_file�root�dirs�files�tmplr�full�relative�destr
r
r�create_zipfileLs
zupload_docs.create_zipfilec	Cs|tjdddd�x|��D]}|�|�qWt��}|jj��}t	j
�|d|�}z|�|�|�
|�Wdt�|�XdS)NzDeprecated commanda
            upload_docs is deprecated and will be removed in a future version.
            Instead, use tools like devpi and Read the Docs; or lower level tools like
            httpie and curl to interact directly with your hosting service API.
            )i��	�)Zdue_datez%s.zip)r�emit�get_sub_commands�run_command�tempfile�mkdtemp�distributionr�get_namer"r#r$r;�upload_file�shutil�rmtree)r�cmd_nameZtmp_dirrr3r
r
r�run\s
zupload_docs.runccs�|\}}d|}t|t�s |g}xn|D]f}t|t�rN|d|d7}|d}nt|�}|Vt|�VdV|V|r&|dd�dkr&dVq&WdS)	Nz*
Content-Disposition: form-data; name="%s"z; filename="%s"rrs

����
�
)�
isinstance�list�tupler)�item�sep_boundary�key�values�title�valuer
r
r�_build_partts




zupload_docs._build_partcCsnd}d|�d�}|d}|df}tj|j|d�}t||���}tj�|�}t�||�}	d|}
d�	|	�|
fS)	z=
        Build up the MIME payload for the POST data
        z3--------------GHSKFJDLGDS7543FJKLFHRE75642756743254s
--�asciis--rL)rQz multipart/form-data; boundary=%s�)
r�	functools�partialrV�map�items�	itertools�chain�
from_iterabler$)�cls�data�boundaryrQZend_boundaryZ	end_itemsZbuilderZpart_groups�partsZ
body_items�content_typer
r
r�_build_multipart�szupload_docs._build_multipartc
Cs>t|d��}|��}WdQRX|jj}d|��tj�|�|fd�}t|j	d|j
�}t|��d�}d|}|�
|�\}}	d|j}
|�|
tj�tj�|j�\}}}
}}}|s�|s�|r�t�|dkr�tj�|�}n"|d	kr�tj�|�}ntd
|��d}yZ|��|�d|
�|	}|�d
|�|�dtt|���|�d|�|��|� |�Wn8t!j"k
�r�}z|�t|�tj#�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(�r:t)d|��d�dS)N�rbZ
doc_upload)z:actionr�content�:rWzBasic zSubmitting documentation to %s�http�httpszunsupported schema ��POSTzContent-typezContent-length�
Authorization��zServer response (%s): %si-ZLocationzhttps://pythonhosted.org/%s/zUpload successful. Visit %szUpload failed (%s): %szK---------------------------------------------------------------------------)*�open�readrCrrDr"r#�basenamer�username�passwordr�decodere�
repositoryr'r�INFO�urllib�parse�urlparse�AssertionErrorri�client�HTTPConnection�HTTPSConnection�connect�
putrequest�	putheader�strr-�
endheaders�send�socket�error�ERROR�getresponse�status�reason�	getheader�
show_response�print)rr2�frg�metara�credentials�auth�body�ct�msgZschema�netloc�url�params�query�	fragments�connrd�er�locationr
r
rrE�s\


zupload_docs.upload_fileN)�__name__�
__module__�__qualname__�DEFAULT_REPOSITORY�descriptionr	�user_options�boolean_optionsr�sub_commandsrrr;rI�staticmethodrV�classmethodrerEr
r
r
rrs 

r)�__doc__�base64r�	distutilsr�distutils.errorsrr"r�r)rArFr]rY�http.clientri�urllib.parserwZ
_importlibr�warningsrr	rrr
r
r
r�<module>s"