AlkantarClanX12

Your IP : 13.58.34.132


Current Path : /usr/lib/python3.6/site-packages/pip/__pycache__/
Upload File :
Current File : //usr/lib/python3.6/site-packages/pip/__pycache__/wheel.cpython-36.pyc

3

�Pf~�@s$dZddlmZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z	ddlZddlZddl
Z
ddlZddlZddlZddlmZddlmZddlmZddlZddlmZddlmZmZdd	lmZmZm Z dd
l!m"Z"m#Z#ddlm$Z$ddl%m&Z&m'Z'm(Z(m)Z)m*Z*dd
l+m,Z,ddl-m.Z.ddl/m0Z0ddl1m2Z2ddl3m4Z4ddl5m6Z6ddl7m8Z8dZ9d9Z:ej;e<�Z=Gdd�de>�Z?dd�Z@dd�ZAd;dd�ZBd d!�ZCd"d#�ZDejEd$ejF�ZGd%d&�ZHd'd(�ZId<d+d,�ZJd-d.�ZKeKd/d0��ZLd1d2�ZMd3d4�ZNGd5d6�d6e>�ZOGd7d8�d8e>�ZPdS)=zH
Support for installing and building the "wheel" binary package format.
�)�absolute_importN)�urlsafe_b64encode)�Parser)�StringIO)�
expanduser)�path_to_url�
unpack_url)�InstallationError�InvalidWheelFilename�UnsupportedWheel)�distutils_scheme�PIP_DELETE_MARKER_FILENAME)�
pep425tags)�call_subprocess�
ensure_dir�captured_stdout�rmtree�read_chunks)�open_spinner)�
indent_log)�SETUPTOOLS_SHIM)�ScriptMaker)�
pkg_resources)�canonicalize_name)�configparserz.whl�c@s eZdZdZdd�Zdd�ZdS)�
WheelCachez&A cache of wheels for future installs.cCs|rt|�nd|_||_dS)z�Create a wheel cache.

        :param cache_dir: The root of the cache.
        :param format_control: A pip.index.FormatControl object to limit
            binaries being read from the cache.
        N)r�
_cache_dir�_format_control)�self�	cache_dir�format_control�r"�/usr/lib/python3.6/wheel.py�__init__8szWheelCache.__init__cCst|j||j|�S)N)�cached_wheelrr)r�link�package_namer"r"r#r%BszWheelCache.cached_wheelN)�__name__�
__module__�__qualname__�__doc__r$r%r"r"r"r#r5s
rcCs�|jg}|jdk	r4|jdk	r4|jdj|j|jg��dj|�}tj|j��j�}|dd�|dd�|dd�|dd�g}t	j
j|df|��S)a�
    Return a directory to store cached wheels in for link.

    Because there are M wheels for any one sdist, we provide a directory
    to cache them in, and then consult that directory when looking up
    cache hits.

    We only insert things into the cache if they have plausible version
    numbers, so that we don't contaminate the cache with things that were not
    unique. E.g. ./package might have dozens of installs done for it and build
    a version of 0.0...and if we built and cached a wheel, we'd end up using
    the same wheel even if the source has been edited.

    :param cache_dir: The cache_dir being used by pip.
    :param link: The link of the sdist for which this will cache wheels.
    N�=�#���Zwheels)Zurl_without_fragmentZ	hash_name�hash�append�join�hashlibZsha224�encodeZ	hexdigest�os�path)r r&Z	key_partsZkey_urlZhashed�partsr"r"r#�_cache_for_linkGs
,r9c
Cs,|s|S|s|S|jr|S|js$|S|s,|St|�}tjj||�}d|krN|St||�}ytj|�}Wn:t	k
r�}z|j
t
jt
jfkr�|S�WYdd}~XnXg}	xL|D]D}
yt
|
�}Wntk
r�w�YnX|j�s�q�|	j|j�|
f�q�W|	�s�|S|	j�tjj||	dd�}tjjt|��S)N�binaryrr)�is_wheel�is_artifactr�pip�index�fmt_ctl_formatsr9r6�listdir�OSError�errno�ENOENT�ENOTDIR�Wheelr
�	supportedr2�support_index_min�sortr7r3�Linkr)
r r&r!r'Zcanonical_nameZformats�rootZwheel_names�eZ
candidates�
wheel_name�wheelr7r"r"r#r%psF

r%�sha256�cCsttj|�}d}t|d��2}x*t||d�D]}|t|�7}|j|�q(WWdQRXdt|j��jd�j	d�}||fS)z6Return (hash, length) for path using hashlib.new(algo)r�rb)�sizeNzsha256=�latin1r,)
r4�new�openr�len�updater�digest�decode�rstrip)r7ZalgoZ	blocksize�hZlength�f�blockrWr"r"r#�rehash�s

r]cCs6tjddkri}d}nddi}d}t|||f|�S)Nr��b�newline�)�sys�version_inforT)�name�mode�nl�binr"r"r#�open_for_csv�srhcCs�tjj|�r�t|d��H}|j�}|jd�s.dStjjtj	��}d|tj
jd�}|j�}WdQRXt|d��}|j|�|j|�WdQRXdSdS)	zLReplace #!python with #!/path/to/python
    Return True if file was changed.rPs#!pythonFs#!�asciiN�wbT)
r6r7�isfilerT�readline�
startswithrb�
executabler5�getfilesystemencoding�linesep�read�write)r7Zscript�	firstlineZexename�restr"r"r#�
fix_script�s

ruzZ^(?P<namever>(?P<name>.+?)(-(?P<ver>\d.+?))?)
                                \.dist-info$cCs�|jdd�}xttj|�D]f}tj|�}|r|jd�|krttjj||d���,}x$|D]}|j	�j
�}|dkrTdSqTWWdQRXqWdS)	zP
    Return True if the extracted wheel in wheeldir should go into purelib.
    �-�_rd�WHEELzroot-is-purelib: trueTNF)�replacer6r@�dist_info_re�match�grouprTr7r3�lowerrY)rd�wheeldirZname_folded�itemr{rM�liner"r"r#�root_is_purelib�s

r�c
Cs�tjj|�siifSt|��<}t�}x$|D]}|j|j��|jd�q*W|jd�WdQRXtj	�}dd�|_
|j|�i}i}|jd�r�t
|jd��}|jd�r�t
|jd��}||fS)N�
rcSs|S)Nr")Zoptionr"r"r#�<lambda>�sz!get_entrypoints.<locals>.<lambda>Zconsole_scriptsZgui_scripts)r6r7�existsrTrrr�strip�seekrZRawConfigParserZoptionxformZreadfpZhas_section�dict�items)�filename�fp�datar�Zcp�console�guir"r"r#�get_entrypoints�s$





r�FTc+)s*|st||||||	d�}t|��r,|d�n|d�g�g��jtjj�tjj}i�t��g}|r�t��4}
tj	�� tj
d�tj|ddd�WdQRXWdQRXt
j|
j��dd	��d3�����fdd�	�	d4���	�
fd
d�	}||�d���std�
��tjj�dd�}t|�\����fdd�}xv�D]n}d}d}x^tjtjj�|��D]F}d}|dk�rpt}|}tjj�||�}||}|||d
||d��qVW�q4Wtd|d��d�_td5��_d�_��
fdd�}|�_d�_�jdd�}|�r�dtjk�rd|}|j�j|��tjjdd�dk�rTdt j!dd�|f}|j�j|��dt j!dd �|f}|j�j|��d!d"��D�}x|D]}�|=�q�W�jd#d�}|�rdtjk�r�d$|}|j�j|��d%t j!dd �|f}|j�j|��d&d"��D�}x|D]}�|=�qWt"��dk�rJ|j�j#d'd"��j$�D���t"��dk�r||j�j#d(d"��j$�D�d)di��tjj�dd*�}tjj�dd+�}t%|d,��}|j&d-�WdQRXt'j(||�|j)|�tjj�dd.�} tjj�dd/�}!t*| d0���}"t*|!d1���}#t+j,|"�}$t+j-|#�}%xV|$D]N}&�j|&d|&d�|&d<|&d�k�rpt.|&d�\|&d<|&d2<|%j/|&��q.Wx`|D]X}'t.|'�\}(})�|'��}*|
�r�|*j0|
��r�tjjtjtjj1|*|
��}*|%j/|*|(|)f��q�Wx"�D]}'|%j/�|'ddf��q�WWdQRXWdQRXt'j(|!| �dS)6zInstall a wheel)�user�homerJ�isolated�prefix�purelib�platlib�ignoreT)�force�quietNcSstjj||�jtjjd�S)N�/)r6r7�relpathry�sep)�src�pr"r"r#�normpathsz"move_wheel_files.<locals>.normpathFcs.�|��}�|��}|�|<|r*�j|�dS)z6Map archive RECORD paths to installation RECORD paths.N)�add)�srcfile�destfileZmodifiedZoldpath�newpath)�changed�	installed�lib_dirr�r~r"r#�record_installeds


z*move_wheel_files.<locals>.record_installedcs�t|��x�tj|�D�]�\}}}|t|�d�jtjj�}tjj||�}	|rj|jtjjd�dj	d�rjqx�|D]�}
tjj|||
�}|r�|dkr�|j	d�r��j
|
�qpqp|rp|
j	d�rpt|
�jt�j
��rp�s�td|ddj�����j
|�qpWx�|D]�}|�r||��rq�tjj||�}
tjj|||�}t|	�tj|
|�tj|
�}ttd��rptj||j|jf�tj|
tj��r�tj|
�}|jtjBtjBtjB}tj||�d	}|�r�||�}�|
||�q�WqWdS)
Nrrz.dataraz
.dist-infoz!Multiple .dist-info directories: z, �utimeF)rr6�walkrU�lstripr7r�r3�split�endswithr2rrmrd�AssertionError�shutilZcopyfile�stat�hasattrr��st_atime�st_mtime�access�X_OK�st_mode�S_IXUSR�S_IXGRP�S_IXOTH�chmod)�source�destZis_base�fixer�filter�dirZsubdirs�filesZbasedirZdestdir�sZ
destsubdirr[r�r��stZpermissionsr�)�	data_dirs�info_dirr��reqr"r#�clobbersJ






z!move_wheel_files.<locals>.clobberz!%s .dist-info directory not foundrzentry_points.txtcsh|j�jd�r|dd�}n<|j�jd�r8|dd�}n |j�jd�rT|dd�}n|}|�kpf|�kS)	Nz.exer/z
-script.py�
z.pya���i����r�)r}r�)rdZ	matchname)r�r�r"r#�is_entrypoint_wrapperasz/move_wheel_files.<locals>.is_entrypoint_wrapper�scripts)r�r�racs<|jdkrtd|�f���j|j|jjd�d|jd�S)Nz�Invalid script entry point: %s for req: %s - A callable suffix is required. Cf https://packaging.python.org/en/latest/distributing.html#console-scripts for more information.�.r)�moduleZimport_name�func)�suffixr	�script_templater�r�)�entry)�makerr�r"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())
r=ZENSUREPIP_OPTIONSzpip = Z
altinstallz
pip%s = %srr^cSsg|]}tjd|�r|�qS)zpip(\d(\.\d)?)?$)�rer{)�.0�kr"r"r#�
<listcomp>�sz$move_wheel_files.<locals>.<listcomp>Zeasy_installzeasy_install = zeasy_install-%s = %scSsg|]}tjd|�r|�qS)zeasy_install(-\d\.\d)?$)r�r{)r�r�r"r"r#r��scSsg|]}d|�qS)z%s = %sr")r��kvr"r"r#r��scSsg|]}d|�qS)z%s = %sr")r�r�r"r"r#r��sr�Z	INSTALLERz
INSTALLER.piprjspip
�RECORDz
RECORD.pip�rzw+r.)F)NN)ra)2rr�rYr6r7r��setr�warnings�catch_warnings�filterwarnings�
compileall�compile_dir�logger�debug�getvaluer�r3r�r@rurr�ZvariantsZset_moder�r��pop�environ�extendZmake�getrb�versionrUZ
make_multipler�rTrrr��mover2rh�csv�reader�writerr]Zwriterowrmr�)+rdr�r~r�r�rJZ	pycompile�schemer�r�Zstrip_file_prefixr�Z	generated�stdoutr�Zep_filer�Zdatadirr�r�Zsubdirr�r�Z
pip_script�specZpip_epr�Zeasy_install_scriptZeasy_install_epZ	installerZtemp_installerZinstaller_file�recordZtemp_recordZ	record_inZ
record_outr�r��rowr[rZ�lZ
final_pathr")r�r�r�r�r�r�r�r�r�r�r�r~r#�move_wheel_files�s�




$;



#









.r�cstj���fdd��}|S)Nc?s6t�}x*�||�D]}||kr|j|�|VqWdS)N)r�r�)�args�kw�seenr)�fnr"r#�uniques

z_unique.<locals>.unique)�	functools�wraps)r�r�r")r�r#�_uniquesr�ccs�ddlm}tj||jd���}xd|D]\}tjj|j|d�}|V|j	d�r&tjj
|�\}}|dd�}tjj||d�}|Vq&WdS)	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.pyNr^z.pyc���)�	pip.utilsr�r�r�Zget_metadata_linesr6r7r3�locationr�r�)�distr�r�r�r7Zdnr��baser"r"r#�uninstallation_paths"s


r�cCsdyTdd�tjd|�D�d}|jd�}t�j|�}|dj�}ttt|j	d���}|SdSdS)	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�?sz!wheel_version.<locals>.<listcomp>Nrrxz
Wheel-Versionr�F)
rZfind_on_pathZget_metadatarZparsestrr��tuple�map�intr�)�
source_dirr�Z
wheel_datar�r"r"r#�
wheel_version8s
rcCsb|std|��|dtdkr>td|djtt|��f��n |tkr^tjddjtt|���dS)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_COMPATIBLEr3r�strr��warning)r�rdr"r"r#�check_compatibilityKs

rc@s:eZdZdZejdej�Zdd�Zd
dd�Z	ddd	�Z
dS)rEzA wheel filez�^(?P<namever>(?P<name>.+?)-(?P<ver>\d.*?))
        ((-(?P<build>\d.*?))?-(?P<pyver>.+?)-(?P<abi>.+?)-(?P<plat>.+?)
        \.whl|\.dist-info)$cs��jj|�}|std|��|�_|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.rdrwrvZverZpyverr��abiZplatc3s0|](}�jD]}�jD]}|||fVqqqdS)N)�abis�plats)r��x�y�z)rr"r#�	<genexpr>�sz!Wheel.__init__.<locals>.<genexpr>N)�
wheel_file_rer{r
r�r|ryrdr�r�Z
pyversionsr
rr��	file_tags)rr�Z
wheel_infor")rr#r$ts
zWheel.__init__Ncs2�dkrtj��fdd�|jD�}|r.t|�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.
        Ncsg|]}|�kr�j|��qSr")r>)r��c)�tagsr"r#r��sz+Wheel.support_index_min.<locals>.<listcomp>)r�supported_tagsr�min)rrZindexesr")rr#rG�szWheel.support_index_mincCs"|dkrtj}tt|�j|j��S)z'Is this wheel supported on this system?N)rr�boolr��intersectionr)rrr"r"r#rF�szWheel.supported)N)N)r(r)r*r+r��compile�VERBOSErr$rGrFr"r"r"r#rEhs
rEc@sHeZdZdZddd�Zddd�Zdd�Zdd	d
�Zdd�Zddd�Z	dS)�WheelBuilderz#Build wheels from a RequirementSet.NcCs6||_||_|jj|_|j|_|p$g|_|p.g|_dS)N)	�requirement_set�finderZ_wheel_cacher�_cache_rootZwheel_download_dir�
_wheel_dir�
build_options�global_options)rrrrr r"r"r#r$�s

zWheelBuilder.__init__cCs�tjd�}zn|j|||d�rlyBtj|�d}tjj||�}tjtjj||�|�t	j
d|�|SYnX|j|�dSt|�XdS)ziBuild one wheel.

        :return: The filename of the built wheel, or None if the build failed.
        z
pip-wheel-)�
python_tagrzStored in directory: %sN)
�tempfileZmkdtemp�_WheelBuilder__build_oner6r@r7r3r�r�r��info�
_clean_oner)rr��
output_dirr!�tempdrLZ
wheel_pathr"r"r#�
_build_one�s

zWheelBuilder._build_onecCstjddt|jgt|j�S)Nz-uz-c)rbrnrZsetup_py�listr )rr�r"r"r#�_base_setup_args�s
zWheelBuilder._base_setup_argscCs�|j|�}d|jf}t|��t}tjd|�|dd|g|j}|dk	rT|d|g7}yt||jd|d�dS|jd	�tj	d
|j�dSWdQRXdS)Nz#Running setup.py bdist_wheel for %szDestination directory: %sZbdist_wheelz-dz--python-tagF)�cwd�show_stdout�spinnerT�errorzFailed building wheel for %s)
r*rdrr�r�rrZsetup_py_dirZfinishr.)rr�r'r!�	base_argsZspin_messager-Z
wheel_argsr"r"r#Z__build_one�s



zWheelBuilder.__build_onecCsV|j|�}tjd|j�|ddg}yt||jdd�dStjd|j�dSdS)NzRunning setup.py clean for %sZcleanz--allF)r+r,Tz Failed cleaning build dir for %s)r*r�r$rdrrr.)rr�r/Z
clean_argsr"r"r#r%�s
zWheelBuilder._clean_oneFcCs�|js|r|jst�|jj|j�|jjj�}g}x�|D]�}|jrDq8|j	r^|s�t
jd|j�q8|rj|j
rjq8|r�|jr�|jjr�q8|r�|jr�q8|r�|j}|j�\}}tjj|d|�dkr�q8dtjj|jjt|j��kr�t
jd|j�q8|j|�q8W|�s�dSt
jddjdd	�|D���t���Jgg}}	�x6|D�],}d}
|�r�tj}
t|j|j�}yt|�WnBtk
�r�}z$t
j d
|j|�|	j|��w6WYdd}~XnXn|j}|j!|||
d�}
|
�rX|j|�|�rb|j�rt"j#j$t"j#j|jt%���rtd��|j&�|j'|jj(�|_tjj)t*|
��|_|jj	�s<t�t+|j|jdd
|jj,d�n
|	j|��q6WWdQRX|�r�t
jddjdd	�|D���|	�r�t
jddjdd	�|	D���t-|	�dkS)z�Build wheels.

        :param unpack: If True, replace the sdist we built from with the
            newly built wheel, in preparation for installation.
        :return: True if all the wheels built correctly.
        z(Skipping %s, due to already being wheel.Nr:zCSkipping bdist_wheel for %s, due to binaries being disabled for it.Tz*Building wheels for collected packages: %sz, cSsg|]
}|j�qSr")rd)r�r�r"r"r#r�sz&WheelBuilder.build.<locals>.<listcomp>z Building wheel for %s failed: %s)r!zbad source dir - missing markerF)�sessionzSuccessfully built %s� cSsg|]
}|j�qSr")rd)r�r�r"r"r#r�QszFailed to build %scSsg|]
}|j�qSr")rd)r�r�r"r"r#r�Vsr).rrr�rZ
prepare_filesrZrequirements�valuesZ
constraintr;r�r$rdZeditabler&r<r�splitextr=r>Zegg_info_matchesr?r!rr2r3rrZimplementation_tagr9rrArr(r6r7r�r
Zremove_temporary_sourceZbuild_locationZ	build_dirrIrrr0rU)rZautobuildingZreqsetZbuildsetr�r&r�ZextZ
build_successZ
build_failurer!r&rKZ
wheel_filer"r"r#�build�s�






zWheelBuilder.build)NN)N)N)F)
r(r)r*r+r$r(r*r#r%r4r"r"r"r#r�s


r)rr�)rNr5)FNNTNFNN)Qr+Z
__future__rr�r�rBr�r4Zloggingr6Zos.pathr�r�r�rbr"r��base64rZemail.parserrZpip._vendor.sixrr=Z
pip.compatrZpip.downloadrrZpip.exceptionsr	r
rZ
pip.locationsrr
rr�rrrrrZpip.utils.uirZpip.utils.loggingrZpip.utils.setuptools_buildrZpip._vendor.distlib.scriptsrZpip._vendorrZpip._vendor.packaging.utilsrZpip._vendor.six.movesrZ	wheel_extrZ	getLoggerr(r��objectrr9r%r]rhrurrrzr�r�r�r�r�rrrErr"r"r"r#�<module>sn
)'



'7