Your IP : 18.118.120.13


Current Path : /opt/alt/python39/lib64/python3.9/distutils/command/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/distutils/command/__pycache__/upload.cpython-39.opt-1.pyc

a

R�f��@s�dZddlZddlZddlZddlmZddlmZddlm	Z	m
Z
ddlmZddl
mZmZddlmZdd	lmZdd
lmZeedd�eedd�eed
d�d�ZGdd�de�ZdS)zm
distutils.command.upload

Implements the Distutils 'upload' subcommand (upload package to a package
index).
�N)�standard_b64encode)�	HTTPError)�urlopen�Request)�urlparse)�DistutilsError�DistutilsOptionError)�
PyPIRCCommand)�spawn)�logZmd5Zsha256Zblake2b)Z
md5_digestZ
sha256_digestZblake2_256_digestc@sJeZdZdZejddgZejdgZdd�Zdd�Zd	d
�Z	dd�Z
d
S)�uploadzupload binary package to PyPI)�sign�szsign files to upload using gpg)z	identity=�izGPG identity used to sign filesr
cCs,t�|�d|_d|_d|_d|_d|_dS)N�rF)r	�initialize_options�username�password�
show_responser
�identity)�self�r�=/opt/alt/python39/lib64/python3.9/distutils/command/upload.pyr*s
zupload.initialize_optionscCsrt�|�|jr|jstd��|��}|ikrV|d|_|d|_|d|_|d|_	|jsn|j
jrn|j
j|_dS)Nz.Must use --sign for --identity to have meaningrr�
repository�realm)r	�finalize_optionsrr
rZ_read_pypircrrrr�distribution)rZconfigrrrr2s
�



zupload.finalize_optionscCs:|jjsd}t|��|jjD]\}}}|�|||�qdS)NzHMust create and upload files in one command (e.g. setup.py sdist upload))rZ
dist_filesr�upload_file)r�msg�command�	pyversion�filenamerrr�runDs
z
upload.runc"Cs
t|j�\}}}}}}	|s"|s"|	r0td|j��|dvrDtd|��|jr|ddd|g}
|jrnd|jg|
dd�<t|
|jd	�t|d
�}z|��}W|�	�n
|�	�0|j
j}
dd|
��|
�
�tj�|�|f||d
|
��|
��|
��|
��|
��|
��|
��|
��|
��|
��|
��|
��|
��d�}d|d<t��D]B\}}|du�rL�q6z||�� �||<Wnt!�ytYn0�q6|j�r�t|dd
��,}tj�|�d|��f|d<Wd�n1�s�0Y|j"d|j#�$d�}dt%|��&d�}d}d|�$d�}|d}t'�(�}|��D]�\}}d|}t)|t*��sB|g}|D]j}t+|�t,u�rr|d|d7}|d}nt-|��$d�}|�.|�|�.|�$d��|�.d�|�.|��qF�q |�.|�|�/�}d||jf}|�0|t1j2�d |t-t3|��|d!�}t4|j||d"�}zt5|�}|�6�}|j7}Wnjt8�yX} z| j9}| j7}WYd} ~ nBd} ~ 0t:�y�} z |�0t-| �t1j;��WYd} ~ n
d} ~ 00|d#k�r�|�0d$||ft1j2�|j<�r|�=|�}!d%�>d&|!d&f�}|�0|t1j2�n"d'||f}|�0|t1j;�t?|��dS)(NzIncompatible url %s)ZhttpZhttpszunsupported schema Zgpgz
--detach-signz-az--local-user�)�dry_run�rbZfile_upload�1z1.0)z:actionZprotocol_version�name�version�contentZfiletyper Zmetadata_versionZsummaryZ	home_pageZauthorZauthor_email�license�description�keywords�platformZclassifiersZdownload_urlZprovidesZrequiresZ	obsoletesrZcommentz.ascZ
gpg_signature�:�asciizBasic z3--------------GHSKFJDLGDS7543FJKLFHRE75642756743254s
--s--
z+
Content-Disposition: form-data; name="%s"z; filename="%s"r�zutf-8s

zSubmitting %s to %sz multipart/form-data; boundary=%s)zContent-typezContent-lengthZ
Authorization)�data�headers��zServer response (%s): %s�
zK---------------------------------------------------------------------------zUpload failed (%s): %s)@rr�AssertionErrorr
rr
r$�open�read�closer�metadataZget_nameZget_version�os�path�basenameZget_descriptionZget_urlZget_contactZget_contact_emailZget_licenceZget_long_descriptionZget_keywordsZ
get_platformsZget_classifiersZget_download_urlZget_providesZget_requiresZ
get_obsoletes�_FILE_CONTENT_DIGESTS�itemsZ	hexdigest�
ValueErrorrr�encoder�decode�io�BytesIO�
isinstance�list�type�tuple�str�write�getvalueZannouncer�INFO�lenrrZgetcoderr�code�OSErrorZERRORrZ_read_pypi_response�joinr)"rrr r!ZschemaZnetlocZurl�paramsZqueryZ	fragmentsZgpg_args�fr)�metar1Zdigest_nameZdigest_consZ	user_passZauth�boundaryZsep_boundaryZend_boundary�body�key�value�titlerr2Zrequest�resultZstatus�reason�e�textrrrrLs���

� 

�(




��

�
zupload.upload_fileN)�__name__�
__module__�__qualname__r+r	Zuser_optionsZboolean_optionsrrr"rrrrrrs�r)�__doc__r:rBZhashlib�base64rZurllib.errorrZurllib.requestrrZurllib.parserZdistutils.errorsrrZdistutils.corer	Zdistutils.spawnr
Z	distutilsr�getattrr=rrrrr�<module>s 


�

?>