Your IP : 18.118.208.127


Current Path : /usr/lib64/python3.8/distutils/command/__pycache__/
Upload File :
Current File : //usr/lib64/python3.8/distutils/command/__pycache__/upload.cpython-38.opt-2.pyc

U

&�.e��@s�ddlZddlZddlZddlZddlmZddlmZmZm	Z	ddl
mZddlm
Z
mZddlmZddlmZddlmZGd	d
�d
e�ZdS)�N)�standard_b64encode)�urlopen�Request�	HTTPError)�urlparse)�DistutilsError�DistutilsOptionError)�
PyPIRCCommand)�spawn)�logc@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�0/usr/lib64/python3.8/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)rZconfigrrrr(s
�



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�run:s
z
upload.runc"Cst|j�\}}}}}}	|s"|s"|	r0td|j��|dkrDtd|��|jr|ddd|g}
|jrnd|jg|
dd�<t|
|jd	�t|d
�}z|�	�}W5|��X|j
j}
dd|
��|
�
�tj�|�|f||t�|���d
|
��|
��|
��|
��|
��|
��|
��|
��|
��|
��|
��|
��|
� �d�}zt�!|���}WnPt"k
�r�}z0d|}|�#|t$j%�ddl&m'}|��s|�W5d}~XYn
X||d<d|d<|j�r�t|dd
��"}tj�|�d|�	�f|d<W5QRX|j(d|j)�*d�}dt+|��,d�}d}d|�*d�}|d}t-�.�}|�/�D]�\}}d|}t0|t1��sP|g}|D]j}t2|�t3k�r�|d|d7}|d}nt4|��*d �}|�5|�|�5|�*d ��|�5d!�|�5|��qT�q.|�5|�|�6�}d"||jf}|�#|t$j%�d#|t4t7|��|d$�}t8|j||d%�}zt9|�}|�:�}|j;} Wnft<k
�rd}z|j=}|j;} W5d}~XYn8t>k
�r�}z|�#t4|�t$j?��W5d}~XYnX|d&k�r�|�#d'|| ft$j%�|j@�r|�A|�}!d(�Bd)|!d)f�}|�#|t$j%�n"d*|| f}|�#|t$j?�tC|��dS)+NzIncompatible url %s)ZhttpZhttpszunsupported schema Zgpgz
--detach-signz-az--local-user�)�dry_run�rbZfile_upload�1z1.0)z:actionZprotocol_version�name�version�contentZfiletyper Z
sha256_digestZmetadata_versionZsummaryZ	home_pageZauthorZauthor_email�license�description�keywords�platformZclassifiersZdownload_urlZprovidesZrequiresZ	obsoletesz#calculating md5 checksum failed: %sr)�
get_fips_modeZ
md5_digestrZcommentz.ascZ
gpg_signature�:�asciizBasic z3--------------GHSKFJDLGDS7543FJKLFHRE75642756743254s
--s--
z+
Content-Disposition: form-data; name="%s"z; filename="%s"�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)Drr�AssertionErrorr
rr
r$�open�close�readrZmetadataZget_nameZget_version�os�path�basename�hashlibZsha256Z	hexdigestZget_descriptionZget_urlZget_contactZget_contact_emailZget_licenceZget_long_descriptionZget_keywordsZ
get_platformsZget_classifiersZget_download_urlZget_providesZget_requiresZ
get_obsoletesZmd5�
ValueErrorZannouncer�INFOZ_hashlibr.rr�encoder�decode�io�BytesIO�items�
isinstance�list�type�tuple�str�write�getvalue�lenrrZgetcoderr�code�OSErrorZERRORrZ_read_pypi_response�joinr)"rrr r!ZschemaZnetlocZurlZparamsZqueryZ	fragmentsZgpg_args�fr)�metar2Zdigest�err.Z	user_passZauth�boundaryZsep_boundaryZend_boundaryZbody�key�value�titler3Zrequest�resultZstatus�reason�textrrrrBs���

�!�




��

�
zupload.upload_fileN)�__name__�
__module__�__qualname__r+r	Zuser_optionsZboolean_optionsrrr"rrrrrrs�r)r:rBr-r=�base64rZurllib.requestrrrZurllib.parserZdistutils.errorsrrZdistutils.corer	Zdistutils.spawnr
Z	distutilsrrrrrr�<module>s

?>