AlkantarClanX12

Your IP : 3.145.164.47


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

�
�Re@Q�@sZdZddlmZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZddl
mZddlmZmZddlmZmZddlmZdd	lmZdd
lmZddlmZmZmZddlm Z dd
l!m"Z"ddlm Z dZ#d0Z$dd1dd�Z%ye&dd�Z'Wne(k
r�dd�Z'YnXdd�Z)dd�Z*ej+dej,�Z-dd�Z.dd�Z/d ddd!ddd"d#�Z0d$d%�Z1e1d&d'��Z2d(d)�Z3d*d+�Z4Gd,d-�d-e5�Z6Gd.d/�d/e5�Z7dS)2zH
Support for installing and building the "wheel" binary package format.
�)�with_statementN)�urlsafe_b64encode)�Parser)�ConfigParser�StringIO)�InvalidWheelFilename�UnsupportedWheel)�distutils_scheme)�logger)�
pep425tags)�call_subprocess�normalize_path�make_path_relative)�
pkg_resources)�ScriptMakerz.whl��sha256�c
Cs�tj|�}d}t|d��O}|j|�}x6|rn|t|�7}|j|�|j|�}q9WWdQXdt|j��jd�j	d�}||fS)z6Return (hash, length) for path using hashlib.new(algo)r�rbNzsha256=�latin1�=)
�hashlib�new�open�read�len�updater�digest�decode�rstrip)�path�algo�	blocksize�h�length�f�blockr�r'�$/tmp/pip-ztkk0jow-build/pip/wheel.py�rehash"s	
(r)cCs t|t�r|jd�S|S)N�ascii)�
isinstance�unicode�encode)�sr'r'r(�binary1s
r/cCs t|t�r|jd�SdS)Nr*)r+�strr-)r.r'r'r(r/6scCsItjddkr"i}d}nidd6}d}t||||�S)Nr��b��newline)�sys�version_infor)�name�mode�nl�binr'r'r(�open_for_csv:s	
r;cCs�tjj|�r�t|d�}zj|j�}|jtd��sIdStjj	tj
��}td�|ttj�}|j�}Wd|j
�Xt|d�}z|j|�|j|�Wd|j
�XdSdS)zLReplace #!python with #!/path/to/python
    Return True if file was changed.rz#!pythonFz#!N�wbT)�osr �isfiler�readline�
startswithr/r5�
executabler-�getfilesystemencoding�linesepr�close�write)r �script�	firstline�exename�restr'r'r(�
fix_scriptCs 
rJzZ^(?P<namever>(?P<name>.+?)(-(?P<ver>\d.+?))?)
                                \.dist-info$cCs�|jdd�}x�tj|�D]�}tj|�}|r"|jd�|kr"ttjj||d���:}x0|D](}|j	�j
�}|dkrzdSqzWWdQXq"q"WdS)	zP
    Return True if the extracted wheel in wheeldir should go into purelib.
    �-�_r7�WHEELzroot-is-purelib: trueTNF)�replacer=�listdir�dist_info_re�match�grouprr �join�lowerr)r7�wheeldir�name_folded�itemrQ�wheel�liner'r'r(�root_is_purelib]s!
rZc
Cs�tjj|�siifSt|��N}t�}x.|D]&}|j|j��|jd�q;W|jd�WdQXtj	�}|j
|�i}i}|jd�r�t|j
d��}n|jd�r�t|j
d��}n||fS)N�
r�console_scripts�gui_scripts)r=r �existsrrrE�strip�seekr�RawConfigParser�readfp�has_section�dict�items)�filename�fp�datarY�cp�console�guir'r'r(�get_entrypointsms"
	

rlFTc	$s(|s't|d|d|d|�}nt|��rC|d�n
|d�g�g��jtjj�tjj}	i�t��g}
|r�tj|	dddd�nd	d
��d�����fdd
��	dd���	�
fdd�}||	�d��s#t	d�
��tjj
�dd�}t|�\����fdd�}
x��D]�}d}d}x�tjtjj
�|��D]e}d}|dkr�t
}|
}ntjj
�||�}	||}||	|dd|d|�q�WqjWtd|d��td2��_d�_�fdd�}|�_d�_�jdd�}|rSdtjkr�d|}|
j�j|��ntjjdd�d kr�d!tjdd"�|f}|
j�j|��nd!tjdd#�|f}|
j�j|��d$d%��D�}x|D]
}�|=q?Wn�jd&d�}|r�dtjkr�d'|}|
j�j|��nd(tjdd#�|f}|
j�j|��d)d%��D�}x|D]
}�|=q�Wnt��dkr<|
j�jd*d%��j�D���nt��dkr�|
j�jd+d%��j�D�idd,6��ntjj
�dd-�}tjj
�dd.�}t|d/��M}t|d0��5}tj|�}tj |�}xj|D]b} �j| d| d�| d<| d�krTt!| d�\| d"<| d1<n|j"| �q�Wxu|
D]m}!t!|!�\}"}#|r�|!j#|�r�tjj
tjtjj$|!|��}!n|j"|!|"|#f�qlWx(�D] }!|j"�|!ddf�q�WWdQXWdQXt%j&||�dS)3zInstall a wheel�user�home�root�purelib�platlib�forceT�quietcSst||�jtjjd�S)N�/)rrNr=r �sep)�src�pr'r'r(�normpath�sz"move_wheel_files.<locals>.normpathFcsB�|��}�|��}|�|<|r>�j|�ndS)z6Map archive RECORD paths to installation RECORD paths.N)�add)�srcfile�destfile�modified�oldpath�newpath)�changed�	installed�lib_dirrxrUr'r(�record_installed�s

z*move_wheel_files.<locals>.record_installedNcs&tjj|�s"tj|�nx�tj|�D]�\}}}|t|�d�jtjj�}tjj||�}	|r�|j	tjjd�dj
d�r�q2nx�|D]�}
tjj|||
�}|r|dkr|j
d�r�j|
�q�q�|r�|
j
d�r�|
j�j
�jjdd�j��r��sWtd���j|�q�q�Wx�|D]�}|r�||�r�qrntjj||�}
tjj|||�}tjj|	�s�tj|	�ntj|
|�d	}|r
||�}n�|
||�qrWq2WdS)
Nrrz.datar3z
.dist-inforKrLzMultiple .dist-info directoriesF)r=r r^�makedirs�walkr�lstriprurS�split�endswith�appendrTr@�project_namerN�AssertionError�shutil�copy2)�source�dest�is_base�fixer�filter�dir�subdirs�files�basedir�destdirr.�
destsubdirr%rzr{r)�	data_dirs�info_dirr��reqr'r(�clobber�s:%+
!
*
z!move_wheel_files.<locals>.clobberz!%s .dist-info directory not foundrzentry_points.txtcs�|j�jd�r(|dd�}nV|j�jd�rP|dd�}n.|j�jd�rx|dd�}n|}|�kp�|�kS)	Nz.exe�z
-script.py�
z.pya���i����r�)rTr�)r7�	matchname)rjrkr'r(�is_entrypoint_wrapper�sz/move_wheel_files.<locals>.is_entrypoint_wrapper�scriptsr�r�r3cs6�ji|jd6|jjd�dd6|jd6S)N�module�.r�import_name�func)�script_template�prefix�suffixr�)�entry)�makerr'r(�_get_script_text	s	
z*move_wheel_files.<locals>._get_script_textz�# -*- coding: utf-8 -*-
import re
import sys

from %(module)s import %(import_name)s

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    sys.exit(%(func)s())
�pip�ENSUREPIP_OPTIONSzpip = �
altinstallz
pip%s = %srr1cSs(g|]}tjd|�r|�qS)zpip(\d(\.\d)?)?$)�rerQ)�.0�kr'r'r(�
<listcomp>Js	z$move_wheel_files.<locals>.<listcomp>�easy_installzeasy_install = zeasy_install-%s = %scSs(g|]}tjd|�r|�qS)zeasy_install(-\d\.\d)?$)r�rQ)r�r�r'r'r(r�Vs	cSsg|]}d|�qS)z%s = %sr')r��kvr'r'r(r�]s	cSsg|]}d|�qS)z%s = %sr')r�r�r'r'r(r�_s	rk�RECORDz
RECORD.pip�rzw+�)r3)'r	rZrr=r ru�set�
compileall�compile_dirr�rSrlrOrJr�variants�set_moder�r��pop�environ�extend�make�getr5�versionr�
make_multiplerer;�csv�reader�writerr)�writerowr@�relpathr��move)$r7r�rUrmrnro�	pycompile�scheme�strip_file_prefixr��	generatedr��ep_filer��datadirr�r��subdirr�r��
pip_script�spec�pip_epr��easy_install_script�easy_install_ep�record�temp_record�	record_in�
record_outr�r��rowr%r#�lr')rrjr�rkr�r�r�r�rxr�r�rUr(�move_wheel_files�s�!

	!!(
%	
$		
	#



,6
!
*
*r�cs%tj���fdd��}|S)Nc?sHt�}x8�||�D]'}||kr|j|�|VqqWdS)N)r�ry)�args�kw�seenrW)�fnr'r(�uniquevs
	
z_unique.<locals>.unique)�	functools�wraps)r�r�r')r�r(�_uniqueus!r�ccs�ddlm}tj||jd���}x�|D]}tjj|j|d�}|V|j	d�r5tjj
|�\}}|dd�}tjj||d�}|Vq5q5WdS)	a
    Yield all the uninstallation paths for dist based on RECORD-without-.pyc

    Yield paths to all the files in RECORD. For each .py file in RECORD, add
    the .pyc in the same directory.

    UninstallPathSet.add() takes care of the __pycache__ .pyc.
    r)�FakeFiler�z.pyNr1z.pyc���)�pip.reqr�r�r��get_metadata_linesr=r rS�locationr�r�)�distr�r�r�r �dnr��baser'r'r(�uninstallation_paths�s

r�cCs�yzdd�tjd|�D�d}|jd�}t�j|�}|dj�}ttt|j	d���}|SWndSYnXdS)	z�
    Return the Wheel-Version of an extracted wheel, if possible.

    Otherwise, return False if we couldn't parse / extract it.
    cSsg|]}|�qSr'r')r��dr'r'r(r��s	z!wheel_version.<locals>.<listcomp>NrrMz
Wheel-Versionr�F)
r�find_on_path�get_metadatar�parsestrr_�tuple�map�intr�)�
source_dirr��
wheel_datar�r'r'r(�
wheel_version�s#r�cCs�|std|��n|dtdkrXtd|djtt|��f��n2|tkr�tjddjtt|���ndS)a�
    Raises errors or warns if called with an incompatible Wheel-Version.

    Pip should refuse to install a Wheel-Version that's a major series
    ahead of what it's compatible with (e.g 2.0 > 1.1); and warn when
    installing a version only minor version ahead (e.g 1.2 > 1.1).

    version: a 2-tuple representing a Wheel-Version (Major, Minor)
    name: name of wheel or package to raise exception about

    :raises UnsupportedWheel: when an incompatible Wheel-Version is given
    z(%s is in an unsupported or invalid wheelrzB%s's Wheel-Version (%s) is not compatible with this version of pipr�z*Installing from a newer Wheel-Version (%s)N)r�VERSION_COMPATIBLErSr�r0r
�warn)r�r7r'r'r(�check_compatibility�s
%	r�c@sUeZdZdZejdej�Zdd�Zddd�Z	ddd	�Z
dS)
�WheelzA wheel filez�^(?P<namever>(?P<name>.+?)-(?P<ver>\d.*?))
                ((-(?P<build>\d.*?))?-(?P<pyver>.+?)-(?P<abi>.+?)-(?P<plat>.+?)
                \.whl|\.dist-info)$cs��jj|�}|s+td|��n|�_|jd�jdd��_|jd�jdd��_|jd�jd��_	|jd�jd��_
|jd	�jd��_t�fd
d��j	D���_
dS)
zX
        :raises InvalidWheelFilename: when the filename is invalid for a wheel
        z!%s is not a valid wheel filename.r7rLrK�ver�pyverr��abi�platc3s>|]4}�jD]$}�jD]}|||fVqqqdS)N)�abis�plats)r��x�y�z)�selfr'r(�	<genexpr>�sz!Wheel.__init__.<locals>.<genexpr>N)�
wheel_file_rerQrrfrRrNr7r�r��
pyversionsrrr��	file_tags)rrf�
wheel_infor')rr(�__init__�s	zWheel.__init__NcsH�dkrtj�n�fdd�|jD�}|rDt|�SdS)a"
        Return the lowest index that one of the wheel's file_tag combinations
        achieves in the supported_tags list e.g. if there are 8 supported tags,
        and one of the file tags is first in the list, then return 0.  Returns
        None is the wheel is not supported.
        Ncs+g|]!}|�kr�j|��qSr')�index)r��c)�tagsr'r(r��s	z+Wheel.support_index_min.<locals>.<listcomp>)r�supported_tagsr	�min)rr�indexesr')rr(�support_index_min�szWheel.support_index_mincCs4|dkrtj}ntt|�j|j��S)z'Is this wheel supported on this system?N)rr�boolr��intersectionr	)rrr'r'r(�	supported�szWheel.supported)�__name__�
__module__�__qualname__�__doc__r��compile�VERBOSErrrrr'r'r'r(r��sr�c@s@eZdZdZggdd�Zdd�Zdd�ZdS)	�WheelBuilderz#Build wheels from a RequirementSet.cCs7||_||_t|�|_||_||_dS)N)�requirement_set�finderr
�	wheel_dir�
build_options�global_options)rrrrr r!r'r'r(r�s
			zWheelBuilder.__init__cCs�tjdd|jgt|j�}tjd|j�tjd|j�|dd|jg|j	}y!t
|d|jdd	�d
SWn tjd|j�d	SYnXdS)
zBuild one wheel.z-czjimport setuptools;__file__=%r;exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))z#Running setup.py bdist_wheel for %szDestination directory: %s�bdist_wheelz-d�cwd�show_stdoutFTzFailed building wheel for %sN)
r5rA�setup_py�listr!r
�notifyr7rr rr��error)rr��	base_args�
wheel_argsr'r'r(�
_build_ones	
zWheelBuilder._build_onecCs5|jj|j�|jjj�}dd�|D�}|sBdStjddjdd�|D���tjd7_gg}}x:|D]2}|j	|�r�|j
|�q�|j
|�q�Wtjd8_|rtjdd	jd
d�|D���n|r1tjdd	jdd�|D���ndS)
z
Build wheels.cSsg|]}|js|�qSr')�is_wheel)r�r�r'r'r(r�s	z&WheelBuilder.build.<locals>.<listcomp>Nz*Building wheels for collected packages: %s�,cSsg|]}|j�qSr')r7)r�r�r'r'r(r�#s	r�zSuccessfully built %s� cSsg|]}|j�qSr')r7)r�r�r'r'r(r�0s	zFailed to build %scSsg|]}|j�qSr')r7)r�r�r'r'r(r�2s	)r�
prepare_filesr�requirements�valuesr
r'rS�indentr+r�)r�reqset�buildset�
build_success�
build_failurer�r'r'r(�builds&

*zWheelBuilder.buildN)rrrrrr+r7r'r'r'r(r�sr)rri)8r�
__future__rr�r�r�rr=r�r�r5�base64r�email.parserrZpip.backwardcompatrr�pip.exceptionsrr�
pip.locationsr	�pip.logr
r�r�pip.utilrr
r�pip._vendorr�pip._vendor.distlib.scriptsr�	wheel_extr�r)r,r/�	NameErrorr;rJrrrPrZrlr�r�r�r�r��objectr�rr'r'r'r(�<module>sT

		�2