Your IP : 216.73.216.213


Current Path : /opt/alt/python37/lib/python3.7/site-packages/twine/commands/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/twine/commands/__pycache__/upload.cpython-37.pyc

B

Fd�W�"�@s�ddlmZmZmZddlmZddlZddlZddlZddl	Z	ddl
mZddl
mZddlmZddlmZdd�Zd	d
�Zdd�Zd
d�Zdd�Zedkr�e	�e��dS)�)�absolute_import�division�print_function)�unicode_literalsN)�PackageFile)�
Repository)�utilscCs*tdd�|D��s|S|jdd�d�|S)Ncss|]}|�d�r|VqdS)z.whlN)�endswith)�.0�fname�r�F/opt/alt/python37/lib/python3.7/site-packages/twine/commands/upload.py�	<genexpr>sz*group_wheel_files_first.<locals>.<genexpr>cSs|�d�rdSdS)Nz.whl���r)r	)�xrrr
�<lambda>!�z)group_wheel_files_first.<locals>.<lambda>)�key)�any�sort)�filesrrr
�group_wheel_files_firstsrcCsVg}xH|D]@}tj�|�r&|�|�q
t�|�}|s@td|��|�|�q
Wt|�S)Nz*Cannot find file (or expand pattern): '%s')�os�path�exists�append�glob�
ValueError�extendr)�dists�uploads�filenamerrrr
�
find_dists&s



r"cCs8|j}d�|�df}|o6|jdkp6|jdko6|j�|�S)Nz%A file named "{0}" already exists forzFile already existsi�i�)�basefilename�formatZstatus_code�reason�
startswith)�response�
skip_existing�packager!�msgrrr
�skip_upload8s
	r+c
Cs�|s|rtd��t|�}tdd�|D��}
dd�|D�}t�|||�}t�|d�|d<td�|d��t�||�}t�	||�}t�
|
|�}t�||�}t|d||�}|�
|�|�|�x�|D]�}t�||�}d�|j�}|	r�|�|�r�t|�q�|j}||
k�r|�|
||�n|�r,|�||�|�|�}|j�rZt�d	�|d|jd
���t||	|��rrt|�q�t�|�q�W|��dS)Nz&sign must be given along with identitycss(|] }|�d�rtj�|�|fVqdS)z.ascN)r	rr�basename)r
�drrr
rUszupload.<locals>.<genexpr>cSsg|]}|�d�s|�qS)z.asc)r	)r
�irrr
�
<listcomp>Wszupload.<locals>.<listcomp>�
repositoryzUploading distributions to {0}z2  Skipping {0} because it appears to already existz?"{0}" attempted to redirect to "{1}" during upload. Aborting...�location)rr"�dictrZget_repository_from_configZnormalize_repository_url�printr$Zget_usernameZget_passwordZ
get_cacertZget_clientcertrZset_certificate_authorityZset_client_certificater�
from_filenamer#Zpackage_is_uploadedZsigned_basefilenameZadd_gpg_signature�sign�uploadZis_redirect�excZRedirectDetected�headersr+Zcheck_status_code�close)rr0r5Zidentity�username�password�commentZ	sign_with�config_filer(ZcertZclient_certZrepository_urlZ
signaturesr �configZca_certr!r)Zskip_messageZsigned_nameZresprrr
r6JsV




r6c
Cs\tjdd�}|jddtjdddd�|jd	tjd
dddd
�|jdddddd�|jdddd�|jdddd�|jddtjdddd�|jd d!tjd"dd#d�|jd$d%d&d�|jd'd(d)d�|jd*ddd+d,�|jd-d.d/d0�|jd1d.d2d0�|jd3d4d5d6d7�|�|�}ytft|��Wn6tk
�rV}zt	�
d8j|d9��Wdd}~XYnXdS):Nztwine upload)�progz-rz--repositoryZTWINE_REPOSITORY�pypiz�The repository to register the package to. Can be a section in the config file or a full URL to the repository (default: %(default)s))�action�env�default�helpz--repository-urlZTWINE_REPOSITORY_URLFz�The repository URL to upload the package to. This can be specified with --repository because it will be used if there is no configuration for the value passed to --repository.)rArBrC�requiredrDz-sz--sign�
store_truezSign files to upload using gpg)rArCrDz--sign-withZgpgz7GPG program used to sign uploads (default: %(default)s))rCrDz-iz
--identityzGPG identity used to sign files)rDz-uz
--usernameZTWINE_USERNAMEzdThe username to authenticate to the repository as (can also be set via %(env)s environment variable))rArBrErDz-pz
--passwordZTWINE_PASSWORDzfThe password to authenticate to the repository with (can also be set via %(env)s environment variable)z-cz	--commentz1The comment to include with the distribution filez
--config-filez	~/.pypirczThe .pypirc config file to usez--skip-existingz�Continue uploading files if one already exists. (Only valid when uploading to PyPI. Other implementations may not support this.))rCrArDz--certrzPath to alternate CA bundle)�metavarrDz
--client-certziPath to SSL client certificate, a single file containing the private key and the certificate in PEM formar�+�distz�The distribution files to upload to the repository, may additionally contain a .asc file to include an existing signature with the file upload)�nargsrGrDz{exc.__class__.__name__}: {exc})r7)�argparse�ArgumentParser�add_argumentrZEnvironmentDefault�
parse_argsr6�vars�	Exception�sys�exitr$)�args�parserr7rrr
�main�s�


rU�__main__)�
__future__rrrrrKr�os.pathrrQZtwine.exceptions�
exceptionsr7Z
twine.packagerZtwine.repositoryr�twinerrr"r+r6rU�__name__rRrrrr
�<module>s 
Ob