Your IP : 216.73.216.213


Current Path : /opt/alt/python36/lib/python3.6/site-packages/wheel/tool/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib/python3.6/site-packages/wheel/tool/__pycache__/__init__.cpython-36.pyc

3

Dt�Z5�@sdZddlmZddlZddlZddlZddlZddlZddlm	Z	ddl
mZddlm
Z
mZddlmZdd	lmZmZmZmZmZd
d�ZGdd
�d
e�Zdd�Zdd�Zefdd�Zdefdd�Zdd�Zdd�Zd(dd�Z d)dd�Zd d!�Z!d"d#�Z"d$d%�Z#d&d'�Z$dS)*z
Wheel command-line utility.
�)�print_functionN)�iglob�)�
signatures)�	WheelFile�VerifyingZipFile)�get_install_command)�urlsafe_b64decode�urlsafe_b64encode�native�binary�matches_requirementcCs4yddl}Wn"tk
r.tdj|���YnXdS)Nrz/'{0}' needs pkg_resources (part of setuptools).)�
pkg_resources�ImportError�RuntimeError�format)�namer�r�D/opt/alt/python36/lib/python3.6/site-packages/wheel/tool/__init__.py�require_pkgresourcessrc@seZdZdS)�
WheelErrorN)�__name__�
__module__�__qualname__rrrrrsrcCsRy&ddlm}ddl}|j�js$t�Wn ttfk
rFtd��YnX|j|fS)Nr)�keysrzQInstall wheel[signatures] (requires keyring, keyrings.alt, pyxdg) for signatures.)	rr�keyring�get_keyring�priority�AssertionErrorrr�	WheelKeys)rrrrrr srcCstdtjd�dS)Nz�WARNING: The wheel signing and signature verification commands have been deprecated and will be removed before the v1.0.0 release.)�file)�print�sys�stderrrrrr�warn_signatures,sr$c
Cs�t�|�\}}tj�}|�j�}|j�}tt|j��}tt|j��}|j	�}|j
d||�tdj|��tdj|��|j
d|�}	|	|kr�td��tdj|��|jd|�|jd|�|j�dS)z#Generate a public/private key pair.�wheelz"Created Ed25519 keypair with vk={}zin {!r}z1Keyring is broken. Could not retrieve secret key.z,Trusting {} to sign and verify all packages.�+N)r$r�
get_ed25519ll�loadZcrypto_sign_keypairrr
�vk�skrZset_passwordr!r�get_passwordrZ
add_signerZtrustZsave)
rrr�	ed25519ll�wk�keypairr)r*�krZsk2rrr�keygen1s$

r0FcCst�|�\}}tj�}t|dd�}|�j�}|jjd�}|j|�d}	tdj	||	d��|	d}
|j
�}|jd|
�}|jt
t|
��t
t|���}
|jd}|jd	}||jj�kr�td
��|jj|�}ddtttj|�j���i}tj||
�}|jj|tj|dd
��|jj�dS)zSign a wheelT)�appendrrzSigning {} with {}�r%z/RECORDz/RECORD.jwszWheel is already signed.�hashzsha256=)�	sort_keysN)r$rr'rr(�parsed_filename�groupZsignersr!rrr+ZKeypairr	r�
distinfo_name�zipfile�namelistr�readrr
�hashlib�sha256�digest�sign�writestr�json�dumps�close)�	wheelfile�replacerrrr,�wfr-rZ	sign_withr)r/r*r.Zrecord_name�sig_nameZrecord_data�payload�sigrrrr>Ls,



r>cCsLt�t|d�}|j�}t|�o.|djjd�s8td��|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.
    �ar2z/RECORD.jwszEThe wheel is not signed (RECORD.jws not found at end of the archive).N���)	r$r�infolist�len�filename�endswithr�poprB)rCZvzf�inforrr�unsignks
rQc
Cs�t�t|�}|jd}ytjt|jj|�j���}Wnt	k
rRt
d��YnXtj|�}t
dtjd�t
tj|dd��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.jwszEThe wheel is not signed (RECORD.jws not found at end of the archive).z%Signatures are internally consistent.)r r)�indentN)r$rr7r@�loadsrr8�openr:�KeyErrorrr�verifyr!r"r#rA)rCrErFrHZverifiedrrrrV|s

rV�.cCsNt|�}|jjd�}tjj||�}td|tjd�|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)r N)rr5r6�os�path�joinr!r"r#r8�
extractallrB)rC�destrErXZdestinationrrr�unpack�s	r^cCs�|s*tjd�}|r |jtj�}n
tjjg}g}xL|D]D}x>tj|�D]0}	|	jd�rDttjj	||	��}
|
j
rD|j|
�qDWq4W|r�tjj|�s�x,|D]$}tjj	||�}tjj|�r�|}Pq�Wt
|��}|j|�WdQRXg}
x�|D]�}|jd��rFtjj|��r6t|�}
|
j
�s|�r"|
j|
�ndj|�}t|��q�tdj|���q�t||�}|�sdtdj|���|
jt|��q�W|�r�td�|�r�dSx>|
D]6}
|�r�tdj|
j���q�|
j|d	�|
jj��q�WdS)
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 {}zInstalling:z    {})�force)rY�getenv�split�pathseprZ�curdir�listdirrNrr[�
compatibler1�existsrT�extendrrr
�maxr!rM�installr8rB)�requirements�requirements_file�
wheel_dirsr_�
list_files�dry_runZ	wheelpathZ
all_wheels�d�wrEr�fdZ
to_install�req�msg�matchesrrrri�s^









ricCs�yddlm}ddl}Wntk
r4td��YnXxD|D]<}|j|�}t|�}|j|j�}dg|_|j	�|j
|�q<WdS)zQ
    Regenerate the entry_points console_scripts for the named distribution.
    r)�easy_installNz)'wheel install_scripts' needs setuptools.r%)Zsetuptools.commandrurrr�get_distributionr�distribution�args�finalize_optionsZinstall_egg_scripts)�
distributionsrur�distZpkg_resources_distri�commandrrr�install_scripts�s

r}cCs�td�ddlm}ddlm}xn|D]f}x`t|�D]T}tjj|�ddkrR|}n|}|rrtdj	|��t
jj�|||�|r4td�q4Wq&WdS)	Nz
wheel convertr)�bdist_wininst2wheel)�	egg2wheelr2z.eggz{}... ZOK)
rZ
wininst2wheelr~rrrYrZ�splitextr!rr"�stdout�flush)�
installers�dest_dir�verboser~r�pat�	installer�convrrr�convert
s


r�cs`tj���jdd�}dd�}|jddd�}|j|d�dd	�}|jd
dd�}|jdd
d�|j|d�dd�}|jdtjd�}|jdd
d�|j|d�dd�}|jdtjd�}|jdd
d�|j|d�dd�}	|jddd�}
|
jddddd�|
jdd
d�|
j|	d�dd�}|jdd d�}|jd!d"d#d$�|jd%d&d'd(d)�|jd*dd+d,d-d.�|jd/d0d1d�|jd2d3d&d4d'd5d6�|j|d�d7d8�}
|jd9d:d�}|jd;d"d<d$�|j|
d�d=d>�}|jd?d@d�}|jdAd"dBd$�|jdCdt	j
jdDdE�|jdFdGd'dH�|j|d�dIdJ�}|jdKdLd�}|j|d��fdMdN�}|jdOdPd�}|j|d��S)QN�commands)�helpcSs
t�dS)N)r0)rxrrr�keygen_f#szparser.<locals>.keygen_fr0zGenerate signing key)�funccSst|j�dS)N)r>rC)rxrrr�sign_f(szparser.<locals>.sign_fr>z
Sign wheelrCz
Wheel filecSst|j�dS)N)rQrC)rxrrr�unsign_f.szparser.<locals>.unsign_frQcSst|j�dS)N)rVrC)rxrrr�verify_f4szparser.<locals>.verify_frVcSst|j|j�dS)N)r^rCr])rxrrr�unpack_f:szparser.<locals>.unpack_fr^zUnpack wheelz--destz-dzDestination directoryrW)r��defaultcSst|j|j|j|j|j�dS)N)rirjrkrlr_rm)rxrrr�	install_fBs
zparser.<locals>.install_frizInstall wheelsrj�*zRequirements to install.)�nargsr�z--forceF�
store_truez!Install incompatible wheel files.)r��actionr�z--wheel-dirr1rlzDirectories containing wheels.)r�r]r�z--requirements-filez-rz*A file containing requirements to install.z--listz-lrmzJList wheels which would be installed, but don't actually install anything.)r�r]r�r�cSst|j�dS)N)r}rz)rxrrr�install_scripts_fXsz!parser.<locals>.install_scripts_fzinstall-scriptszInstall console_scriptsrzz2Regenerate console_scripts for these distributionscSst|j|j|j�dS)N)r�r�r�r�)rxrrr�	convert_f_szparser.<locals>.convert_fr�zConvert egg or wininst to wheelr�zInstallers to convertz
--dest-dirz/Directory to store wheels (default %(default)s))r�r�z	--verbosez-v)r�cSsddlm}td|�dS)Nr)�__version__zwheel %s)�r�r!)rxr�rrr�	version_fhszparser.<locals>.version_f�versionzPrint version and exitcs�j�dS)N)�
print_help)rx)�prr�help_fnszparser.<locals>.help_fr�zShow this help)�argparse�ArgumentParserZadd_subparsersZ
add_parserZset_defaults�add_argumentrQ�__doc__rVrYrZrc)�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�cCsft�}|j�}t|d�s"|j�n@y|j|�dStk
r`}zt|tjd�WYdd}~XnXdS)Nr�r)r r2)	r��
parse_args�hasattrr�r�rr!r"r#)r�rx�errr�mainvs


 r�)rW)NNFFF)%r��
__future__rr�r;r@rYr"�globrr�rrirr�pathsr�utilr	r
rrr
r�	Exceptionrrr$r0r>rQrVr^r}r�r�r�rrrr�<module>s6

TW