Your IP : 216.73.216.213


Current Path : /opt/alt/python34/lib/python3.4/site-packages/wheel/tool/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib/python3.4/site-packages/wheel/tool/__pycache__/__init__.cpython-34.pyc

�
��]4�@skdZddlZddlZddlZddlZddlZddlmZddl	m
Z
ddlmZm
Z
mZmZmZddlmZdd	�ZddlZGd
d�de�Zdd
�Zedd�Zdedd�Zdd�Zdd�Zddd�Zddddddd�Zdd�Zdd�Zd d!�Zd"d#�Z dS)$z
Wheel command-line utility.
�N)�iglob�)�
signatures)�urlsafe_b64decode�urlsafe_b64encode�native�binary�matches_requirement)�	WheelFilecCs>yddl}Wn'tk
r9tdj|���YnXdS)Nrz/'{0}' needs pkg_resources (part of setuptools).)�
pkg_resources�ImportError�RuntimeError�format)�namer�r�D/opt/alt/python34/lib/python3.4/site-packages/wheel/tool/__init__.py�require_pkgresourcess
rc@seZdZdS)�
WheelErrorN)�__name__�
__module__�__qualname__rrrrrsrcCsNy ddlm}ddl}Wntk
r@td��YnX|j|fS)Nr)�keysrzEInstall wheel[signatures] (requires keyring, dirspec) for signatures.)rr�keyringrr�	WheelKeys)rrrrr�get_keyrings
rc
CsZ|�\}}tj�}|�j�}|j�}tt|j��}tt|j��}|j�}|j	d||�t
jjdj
|��t||jjj�r�t
jjdj
|j��nt
jjd|j�|jd|�}	|	|krtd��nt
jjdj
|��|jd|�|jd|�|j�dS)	z#Generate a public/private key pair.�wheelz$Created Ed25519 keypair with vk={0}
zin {0}
zin %r
z1Keyring is broken. Could not retrieve secret key.z.Trusting {0} to sign and verify all packages.
�+N)r�
get_ed25519ll�loadZcrypto_sign_keypairrr�vk�skrZset_password�sys�stdout�writer�
isinstanceZbackends�fileZBaseKeyring�	file_path�	__class__�get_passwordrZ
add_signer�trustZsave)
rrr�	ed25519ll�wk�keypairrr �krZsk2rrr�keygen$s&r.FcCs�|�\}}tj�}t|dd�}|�j�}|jjd�}|j|�d}	tjj	dj
||	d��|	d}
|j�}|jd|
�}|j
tt|
��tt|���}
|jd}|jd	}||jj�krtd
��n|jj|�}idtttj|�j���d6}tj||
�}|jj|tj|d
d��|jj�dS)zSign a wheel�appendTrrzSigning {0} with {1}
�rz/RECORDz/RECORD.jwszWheel is already signed.zsha256=�hashZ	sort_keysN)rrr
r�parsed_filename�groupZsignersr!r"r#rrr(ZKeypairrr�
distinfo_name�zipfile�namelistr�readrr�hashlib�sha256�digest�sign�writestr�json�dumps�close)�	wheelfile�replacerrrr*�wfr+rZ	sign_withrr-r r,Zrecord_name�sig_nameZrecord_data�payload�sigrrrr;@s* 


,"r;cCsvddl}|jj|d�}|j�}t|�oL|djjd�s^td��n|j�|j	�dS)a*
    Remove RECORD.jws from a wheel by truncating the zip file.
    
    RECORD.jws must be at the end of the archive. The zip file must be an 
    ordinary archive, with the compressed files and the directory in the same 
    order, and without any non-zip content after the truncation point.
    rN�ar0z/RECORD.jwsz'RECORD.jws not found at end of archive.���)
Z
wheel.install�installZVerifyingZipFile�infolist�len�filename�endswithr�popr?)r@rZvzf�inforrr�unsign^s"
rOcCs�t|�}|jd}tjt|jj|�j���}tj	|�}t
jjd�t
j
jtj|dd��t
j
jd�dS)z�Verify a wheel.
    
    The signature will be verified for internal consistency ONLY and printed. 
    Wheel's own unpack/install commands verify the manifest against the
    signature and file contents.
    z/RECORD.jwsz&Signatures are internally consistent.
�indentr�
N)r
r4r=�loadsrr5�openr7r�verifyr!�stderrr#r"r>)r@rBrCrEZverifiedrrrrTns
'rT�.cCsht|�}|jjd�}tjj||�}tjjd|�|j	j
|�|j	j�dS)aUnpack a wheel.

    Wheel content will be unpacked to {dest}/{name}-{ver}, where {name}
    is the package name and {ver} its version.

    :param wheelfile: The path to the wheel.
    :param dest: Destination directory (default to current directory).
    �nameverzUnpacking to: %s
N)r
r2r3�os�path�joinr!rUr#r5�
extractallr?)r@�destrBrWZdestinationrrr�unpack}s	r]c
Cs�|sBtjd�}|r0|jtj�}qBtjjg}ng}xn|D]f}x]tj|�D]L}	|	jd�rettjj	||	��}
|
j
r�|j|
�q�qeqeWqOW|r;tjj|�sxB|D]7}tjj	||�}tjj|�r�|}Pq�q�Wnt
|��}|j|�WdQXng}
x�|D]�}|jd�r�tjj|�r�t|�}
|
j
s�|r�|
j|
�q�dj|�}t|��qHtdj|���qHnt||�}|stdj|���n|
jt|��qHW|r0tjjd�n|r:dSxS|
D]K}
|rotjjdj|
j��qAn|
jd	|�|
jj�qAWdS)
a�Install wheels.
    
    :param requirements: A list of requirements or wheel files to install.
    :param requirements_file: A file containing requirements to install.
    :param wheel_dirs: A list of directories to search for wheels.
    :param force: Install a wheel file even if it is not compatible.
    :param list_files: Only list the files to install, don't install them.
    :param dry_run: Do everything but the actual install.
    Z	WHEELPATHz.whlNzB{0} is not compatible with this Python. --force to install anyway.zNo such wheel file: {}zNo match for requirement {}zInstalling:
z    {0}
�force)rX�getenv�split�pathseprY�curdir�listdirrLr
rZZ
compatibler/�existsrS�extendrrr	�maxr!r"r#rKrHr5r?)�requirements�requirements_file�
wheel_dirsr^�
list_files�dry_runZ	wheelpathZ
all_wheels�d�wrBr�fdZ
to_install�req�msg�matchesrrrrH�s^
	

	
rHcCs�y ddlm}ddl}Wntk
r@td��YnXxd|D]\}|j|�}tjj|�}|j|j	�}dg|_
|j�|j|�qHWdS)zQ
    Regenerate the entry_points console_scripts for the named distribution.
    r)�easy_installNz)'wheel install_scripts' needs setuptools.r)
Zsetuptools.commandrrrrr
�get_distributionr�pathsZget_install_command�distribution�args�finalize_optionsZinstall_egg_scripts)�
distributionsrrr�distZpkg_resources_distrH�commandrrr�install_scripts�s


r{cCs�td�ddlm}ddlm}x�|D]�}x�t|�D]�}tjj|�ddkro|}n|}|r�tj	j
dj|��tj	j�n|||�|rDtj	j
d�qDqDWq1WdS)	Nz
wheel convertr)�bdist_wininst2wheel)�	egg2wheelr0z.eggz{0}... zOK
)
rZ
wininst2wheelr|r}rrXrY�splitextr!r"r#r�flush)�
installers�dest_dir�verboser|r}�pat�	installer�convrrr�convert�s

	
r�cs�tj���jdd�}dd�}|jddd�}|jd|�dd	�}|jd
dd�}|jddd
�|jd|�dd�}|jddtj�}|jddd
�|jd|�dd�}|jddtj�}|jddd
�|jd|�dd�}	|jddd�}
|
jdddddd�|
jddd
�|
jd|	�dd�}|jddd �}|jd!d"d#dd$�|jd%dd&d'd(dd)�|jd*dd'd+d,d-dd.�|jd/d0dd1�|jd2d3dd&d,d4d'd(dd5�|jd|�d6d7�}
|jd8dd9�}|jd:d"d#dd;�|jd|
�d<d=�}|jd>dd?�}|jd@d"d#ddA�|jdBddt	j
jddC�|jdDdEd'd(�|jd|�dFdG�}|jdHddI�}|jd|��fdJdK�}|jdddL�}|jd|��S)MN�help�commandscSst�dS)N)r.)rvrrr�keygen_fszparser.<locals>.keygen_fr.zGenerate signing key�funccSst|j�dS)N)r;r@)rvrrr�sign_fszparser.<locals>.sign_fr;z
Sign wheelr@z
Wheel filecSst|j�dS)N)rOr@)rvrrr�unsign_fszparser.<locals>.unsign_frOcSst|j�dS)N)rTr@)rvrrr�verify_fszparser.<locals>.verify_frTcSst|j|j�dS)N)r]r@r\)rvrrr�unpack_f#szparser.<locals>.unpack_fr]zUnpack wheelz--destz-dzDestination directory�defaultrVcSs)t|j|j|j|j|j�dS)N)rHrgrhrir^rj)rvrrr�	install_f+szparser.<locals>.install_frHzInstall wheelsrg�nargs�*zRequirements to install.z--forceF�action�
store_truez!Install incompatible wheel files.z--wheel-dirr/r\rizDirectories containing wheels.z--requirements-filez-rz*A file containing requirements to install.z--listz-lrjzJList wheels which would be installed, but don't actually install anything.cSst|j�dS)N)r{rx)rvrrr�install_scripts_fAsz!parser.<locals>.install_scripts_fzinstall-scriptszInstall console_scriptsrxz2Regenerate console_scripts for these distributionscSst|j|j|j�dS)N)r�r�r�r�)rvrrr�	convert_fHszparser.<locals>.convert_fr�zConvert egg or wininst to wheelr�zInstallers to convertz
--dest-dirz/Directory to store wheels (default %(default)s)z	--verbosez-vcSs(ddlm}tjjd|�dS)Nr)�__version__z	wheel %s
)�r�r!r"r#)rvr�rrr�	version_fQszparser.<locals>.version_f�versionzPrint version and exitcs�j�dS)N)�
print_help)rv)�prr�help_fWszparser.<locals>.help_fzShow this help)�argparse�ArgumentParser�add_subparsers�
add_parser�set_defaults�add_argumentrO�__doc__rTrXrYrb)�sr�Z
keygen_parserr�Zsign_parserr�Z
unsign_parserr�Z
verify_parserr�Z
unpack_parserr�Zinstall_parserr�Zinstall_scripts_parserr�Zconvert_parserr�Zversion_parserr�Zhelp_parserr)r�r�parsersvr�cCs�t�}|j�}t|d�s1|j�nTy|j|�dSWn<tk
r�}ztjj|j	d�WYdd}~XnXdS)Nr�rrQr0)
r��
parse_args�hasattrr�r�rr!rUr#�message)r�rv�errr�main^s	

*r�)!r�rXr8r!r=Zwheel.pathsr�globrr�r�utilrrrrr	rHr
rr��	Exceptionrrr.r;rOrTr]r{r�r�r�rrrr�<module>s2(	SV