Your IP : 18.191.44.145


Current Path : /opt/alt/python35/lib64/python3.5/distutils/command/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/distutils/command/__pycache__/upload.cpython-35.opt-1.pyc



��Yf��@s�dZddlZddlZddlZddlZddlmZddlmZm	Z	m
Z
ddlmZddl
mZmZddlmZddlmZdd	lmZGd
d�de�ZdS)zm
distutils.command.upload

Implements the Distutils 'upload' subcommand (upload package to a package
index).
�N)�standard_b64encode)�urlopen�Request�	HTTPError)�urlparse)�DistutilsError�DistutilsOptionError)�
PyPIRCCommand)�spawn)�logc@sieZdZdZejddgZejdgZdd	�Zd
d�Zdd
�Z	dd�Z
dS)�uploadzupload binary package to PyPI�sign�s�sign files to upload using gpg�	identity=�i�GPG identity used to sign filescCs>tj|�d|_d|_d|_d|_d|_dS)N�rF)r	�initialize_options�username�password�
show_responser
�identity)�self�r�=/opt/alt/python35/lib64/python3.5/distutils/command/upload.pyr s
				zupload.initialize_optionscCs�tj|�|jr,|jr,td��|j�}|ikrx|d|_|d|_|d|_|d|_	|jr�|j
jr�|j
j|_dS)Nz.Must use --sign for --identity to have meaningrr�
repository�realm)r	�finalize_optionsrr
rZ_read_pypircrrrr�distribution)r�configrrrr(s
	



zupload.finalize_optionscCsU|jjsd}t|��x0|jjD]"\}}}|j|||�q+WdS)Nz'No dist file created in earlier command)rZ
dist_filesr�upload_file)r�msg�command�	pyversion�filenamerrr�run:s
z
upload.runc$4Cs�t|j�\}}}}}}	|s3|s3|	rFtd|j��|dIkrbtd|��|jr�ddd|g}
|jr�d|jg|
d	d	�<t|
d
|j�t|d�}z|j�}Wd|j	�X|j
j}
dd
ddd|
j�d|
j
�dtjj|�|fd|d|dtj|�j�ddd|
j�d|
j�d|
j�d|
j�d|
j�d|
j�d|
j�d|
j�d |
j�d!|
j�d"|
j�d#|
j�d$|
j �i}d%}|d&kr0t!j"�\}}}|rRd'||f}n"|d(krRd)t!j!d*d+�}||d,<|jr�tjj|�d-t|d-d�j�f|d.<|j#d/|j$j%d0�}d1t&|�j'd0�}d2}d3|j%d0�}|d4}t(j)�}x�|j*�D]�\}}d5|}t+|t,�s8|g}x�|D]�}t-|�t.krv|d6|d77}|d+}nt/|�j%d8�}|j0|�|j0|j%d8��|j0d9�|j0|�|r?|dJd�d:kr?|j0d;�q?Wq
W|j0|�|j1�}d<||jf}|j2|t3j4�d=d>|d?t/t5|��d@|i}t6|jdA|dB|�}y%t7|�}|j8�} |j9}!Wnwt:k
r�}"z|"j;} |"j9}!WYdd}"~"XnAt<k
r}"z!|j2t/|"�t3j=��WYdd}"~"XnX| dCkr�|j2dD| |!ft3j4�|j>r�|j?|�}#dEj@dFdG|#dFdGf�}|j2|t3j4�n/dH| |!f}|j2|t3j=�tA|��dS)KNzIncompatible url %s�http�httpszunsupported schema Zgpgz
--detach-signz-az--local-user��dry_run�rbz:actionZfile_uploadZprotocol_version�1�name�version�contentZfiletyper$Z
md5_digestZmetadata_versionz1.0ZsummaryZ	home_pageZauthorZauthor_email�license�description�keywords�platformZclassifiersZdownload_urlZprovidesZrequiresZ	obsoletesrZ	bdist_rpmzbuilt for %s %sZ
bdist_dumbzbuilt for %sZterse��commentz.ascZ
gpg_signature�:�asciizBasic z3--------------GHSKFJDLGDS7543FJKLFHRE75642756743254s
--s--
z+
Content-Disposition: form-data; name="%s"z; filename="%s"rzutf-8s

s
s
zSubmitting %s to %szContent-typez multipart/form-data; boundary=%szContent-lengthZ
Authorization�data�headers��zServer response (%s): %s�
�-�KzUpload failed (%s): %s)r'r(���)Brr�AssertionErrorr
rr
r*�open�read�closerZmetadataZget_nameZget_version�os�path�basename�hashlibZmd5Z	hexdigestZget_descriptionZget_urlZget_contactZget_contact_emailZget_licenceZget_long_descriptionZget_keywordsZ
get_platformsZget_classifiersZget_download_urlZget_providesZget_requiresZ
get_obsoletesr3�distrr�encoder�decode�io�BytesIO�items�
isinstance�list�type�tuple�str�write�getvalueZannouncer�INFO�lenrrZgetcoder"r�code�OSErrorZERRORrZ_read_pypi_response�joinr)$rr#r$r%ZschemaZnetlocZurlZparamsZqueryZ	fragmentsZgpg_args�fr/�metar8r5rGr.�idZ	user_passZauth�boundaryZsep_boundaryZend_boundaryZbody�key�value�titler"r9Zrequest�resultZstatus�reason�e�textrrrr!As�!			

	 

	






	
	
	 zupload.upload_fileN)r
rr)rrr)�__name__�
__module__�__qualname__r1r	Zuser_optionsZboolean_optionsrrr&r!rrrrrs
r)�__doc__rCrJr3rF�base64rZurllib.requestrrrZurllib.parserZdistutils.errorsrrZdistutils.corer	Zdistutils.spawnr
Z	distutilsrrrrrr�<module>s

?>