Your IP : 18.189.192.214


Current Path : /opt/alt/python34/lib64/python3.4/distutils/command/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/distutils/command/__pycache__/upload.cpython-34.pyo

�
i f��@sdZddlZddlZddlZddlZddlZddlmZddlm	Z	m
Z
mZddlm
Z
ddlmZmZddlmZddlmZdd	lmZejd
kr�ddlmZnddlmZGdd
�d
e�ZdS)z`distutils.command.upload

Implements the Distutils 'upload' subcommand (upload package to PyPI).�N)�standard_b64encode)�urlopen�Request�	HTTPError)�urlparse)�DistutilsError�DistutilsOptionError)�
PyPIRCCommand)�spawn)�logz2.5)�md5c@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/python34/lib64/python3.4/distutils/command/upload.pyr#s
				zupload.initialize_optionscCs�tj|�|jr/|jr/td��n|j�}|ikr~|d|_|d|_|d|_|d|_	n|jr�|j
jr�|j
j|_ndS)Nz.Must use --sign for --identity to have meaningrr�
repository�realm)r	�finalize_optionsrrrZ_read_pypircrrrr�distribution)r�configrrrr+s



zupload.finalize_optionscCsR|jjstd��nx0|jjD]"\}}}|j|||�q(WdS)Nz'No dist file created in earlier command)r Z
dist_filesr�upload_file)r�command�	pyversion�filenamerrr�run=sz
upload.runc$Cs�t|j�\}}}}}}	|s3|s3|	rItd|j��n|dIkrhtd|��n|jr�ddd|g}
|jr�d|jg|
d	d	�<nt|
d
|j�nt|d�}z|j�}Wd|j	�X|j
j}
idd
6dd6|
j�d6|
j
�d6tjj|�|fd6|d6|d6t|�j�d6dd6|
j�d6|
j�d6|
j�d6|
j�d6|
j�d6|
j�d6|
j�d6|
j�d6|
j�d 6|
j�d!6|
j�d"6|
j�d#6|
j�d$6}d%}|d&krRt j!�\}}}|rwd'||f}qwn%|d(krwd)t j d*d+�}n||d,<|jr�tjj|�d-t|d-d�j�f|d.<n|j"d/|j#j$d0�}d1t%|�j&d0�}d2}d3|j$d0�}|d4}t'j(�}x|j)�D]�\}}d5|}t*|�t*g�krl|g}nx�|D]�}t*|�t+kr�|d6|d77}|d+}nt,|�j$d8�}|j-|�|j-|j$d8��|j-d9�|j-|�|rs|dJd�d:krs|j-d;�qsqsWq2W|j-|�|j.�}|j/d<||jft0j1�id=|d>6t,t2|��d?6|d@6}t3|jdA|dB|�}y%t4|�}|j5�}|j6} Wnwt7k
r}!z!|j/t,|!�t0j8��WYdd}!~!Xn7t9k
rM}!z|!j:}|!j6} WYdd}!~!XnX|dCkrz|j/dD|| ft0j1�n/dE|| f}"|j/|"t0j8�t;|"��|j<r�|j=|�}#dFj>dGdH|#dGdHf�}"|j/|"t0j1�ndS)KNzIncompatible url %s�http�httpszunsupported schema Zgpgz
--detach-signz-az--local-user��dry_run�rbZfile_uploadz:action�1Zprotcol_version�name�version�contentZfiletyper$Z
md5_digestz1.0Zmetadata_versionZsummaryZ	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 multipart/form-data; boundary=%szContent-typezContent-lengthZ
Authorization�data�headers��zServer response (%s): %szUpload failed (%s): %s�
�-�K)r'r(���)?rr�AssertionErrorrrr
r*�open�read�closer ZmetadataZget_nameZget_version�os�path�basenamerZ	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�type�tuple�str�write�getvalueZannouncer�INFO�lenrrZgetcode�msg�OSErrorZERRORr�coderrZ_read_pypi_response�join)$rr#r$r%ZschemaZnetlocZurlZparamsZqueryZ	fragmentsZgpg_args�fr/�metar8r5rFr.�idZ	user_passZauth�boundaryZsep_boundaryZend_boundaryZbody�key�value�titler9Zrequest�resultZstatus�reason�erS�textrrrr"Cs�!			















	#







 
	
	
	 zupload.upload_fileN)zsignrr)rrr)�__name__�
__module__�__qualname__r1r	Zuser_optionsZboolean_optionsrrr&r"rrrrr
s
r
)�__doc__�sysrCrIZsocketr3�base64rZurllib.requestrrrZurllib.parserZdistutils.errorsrrZdistutils.corer	Zdistutils.spawnr
Z	distutilsrr.rZhashlibr
rrrr�<module>s

?>