Sindbad~EG File Manager

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

3

�Üg~�@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"�(/tmp/pip-build-chubckx0/pip/pip/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�=�#����wheels)�url_without_fragment�	hash_name�hash�append�join�hashlib�sha224�encode�	hexdigest�os�path)r r&�	key_parts�key_url�hashed�partsr"r"r#�_cache_for_linkGs
,rAc
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_formatsrAr;�listdir�OSError�errno�ENOENT�ENOTDIR�Wheelr
�	supportedr5�support_index_min�sortr<r6�Linkr)
r r&r!r'�canonical_name�formats�root�wheel_names�e�
candidates�
wheel_name�wheelr<r"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,)
r7�new�openr�len�updater�digest�decode�rstrip)r<�algo�	blocksize�h�length�f�blockrcr"r"r#�rehash�s

rlcCs6tjddkri}d}nddi}d}t|||f|�S)Nr��b�newline�)�sys�version_infor`)�name�mode�nl�binr"r"r#�open_for_csv�srwcCs�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.r\s#!pythonFs#!�asciiN�wbT)
r;r<�isfiler`�readline�
startswithrq�
executabler9�getfilesystemencoding�linesep�read�write)r<�script�	firstline�exename�restr"r"r#�
fix_script�s

r�zZ^(?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.
    �-�_rs�WHEELzroot-is-purelib: trueTNF)�replacer;rH�dist_info_re�match�groupr`r<r6�lowerre)rs�wheeldir�name_folded�itemr�rY�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")�optionr"r"r#�<lambda>�sz!get_entrypoints.<locals>.<lambda>�console_scripts�gui_scripts)r;r<�existsr`rr��strip�seekr�RawConfigParser�optionxform�readfp�has_section�dict�items)�filename�fp�datar��cp�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�homerT�isolated�prefix�purelib�platlib�ignoreT)�force�quietNcSstjj||�jtjjd�S)N�/)r;r<�relpathr��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�destfile�modified�oldpath�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.datarpz
.dist-infoz!Multiple .dist-info directories: z, �utimeF)rr;�walkra�lstripr<r�r6�split�endswithr5rr|rs�AssertionError�shutil�copyfile�stat�hasattrr��st_atime�st_mtime�access�X_OK�st_mode�S_IXUSR�S_IXGRP�S_IXOTH�chmod)�source�dest�is_base�fixer�filter�dir�subdirs�files�basedir�destdir�s�
destsubdirrjr�r��st�permissionsr�)�	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�)rs�	matchname)r�r�r"r#�is_entrypoint_wrapperasz/move_wheel_files.<locals>.is_entrypoint_wrapper�scripts)r�r�rpcs<|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)�module�import_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())
rE�ENSUREPIP_OPTIONSzpip = �
altinstallz
pip%s = %srrmcSsg|]}tjd|�r|�qS)zpip(\d(\.\d)?)?$)�rer�)�.0�kr"r"r#�
<listcomp>�sz$move_wheel_files.<locals>.<listcomp>�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��	INSTALLERz
INSTALLER.pipryspip
�RECORDz
RECORD.pip�rzw+r.)F)NN)rp)2rr�rer;r<r��setr�warnings�catch_warnings�filterwarnings�
compileall�compile_dir�logger�debug�getvaluer�r6r�rHr�rr��variants�set_moder�r��pop�environ�extend�make�getrq�versionra�
make_multipler�r`r�r��mover5rw�csv�reader�writerrl�writerowr|r�)+rsr�r�r�r�rT�	pycompile�schemer�r��strip_file_prefixr��	generated�stdoutr��ep_filer��datadirr�r��subdirr�r��
pip_script�spec�pip_epr��easy_install_script�easy_install_ep�	installer�temp_installer�installer_file�record�temp_record�	record_in�
record_outrr�rowrjrh�l�
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)rr�)�args�kw�seenr�)�fnr"r#�uniques

z_unique.<locals>.unique)�	functools�wraps)r2r3r")r2r#�_uniquesr6ccs�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.pyNrmz.pyc���)�	pip.utilsr7rr�get_metadata_linesr;r<r6�locationr�r�)�distr7r�r+r<�dnr2�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>Nrr�z
Wheel-Versionr�F)
r�find_on_path�get_metadatar�parsestrr��tuple�map�intr�)�
source_dirr<�
wheel_datarr"r"r#�
wheel_version8s
rIcCsb|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_COMPATIBLEr6rE�strr�warning)rrsr"r"r#�check_compatibilityKs

rMc@s:eZdZdZejdej�Zdd�Zd
dd�Z	ddd	�Z
dS)rMz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.rsr�r��ver�pyverr��abi�platc3s0|](}�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�r�rsrr��
pyversionsrRrSr�	file_tags)rr��
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")rF)r��c)�tagsr"r#r��sz+Wheel.support_index_min.<locals>.<listcomp>)r�supported_tagsrZ�min)rr]�indexesr")r]r#rO�szWheel.support_index_mincCs"|dkrtj}tt|�j|j��S)z'Is this wheel supported on this system?N)rr^�boolr�intersectionrZ)rr]r"r"r#rN�szWheel.supported)N)N)r(r)r*r+r��compile�VERBOSErXr$rOrNr"r"r"r#rMhs
rMc@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�finder�_wheel_cacher�_cache_root�wheel_download_dir�
_wheel_dir�
build_options�global_options)rrfrgrlrmr"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)
�tempfile�mkdtemp�_WheelBuilder__build_oner;rHr<r6r�rr�info�
_clean_oner)rr��
output_dirrn�tempdrX�
wheel_pathr"r"r#�
_build_one�s

zWheelBuilder._build_onecCstjddt|jgt|j�S)Nz-uz-c)rqr}r�setup_py�listrm)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: %s�bdist_wheelz-dz--python-tagF)�cwd�show_stdout�spinnerT�errorzFailed building wheel for %s)
rzrsrrrrlr�setup_py_dir�finishr)rr�rurn�	base_args�spin_messager~�
wheel_argsr"r"r#�__build_one�s



zWheelBuilder.__build_onecCsV|j|�}tjd|j�|ddg}yt||jdd�dStjd|j�dSdS)NzRunning setup.py clean for %s�cleanz--allF)r|r}Tz Failed cleaning build dir for %s)rzrrrrsrrGr)rr�r��
clean_argsr"r"r#rs�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.NrBzCSkipping bdist_wheel for %s, due to binaries being disabled for it.Tz*Building wheels for collected packages: %sz, cSsg|]
}|j�qSr")rs)r�r�r"r"r#r�sz&WheelBuilder.build.<locals>.<listcomp>z Building wheel for %s failed: %s)rnzbad source dir - missing markerF)�sessionzSuccessfully built %s� cSsg|]
}|j�qSr")rs)r�r�r"r"r#r�QszFailed to build %scSsg|]
}|j�qSr")rs)r�r�r"r"r#r�Vsr).rkrir�rf�
prepare_filesrg�requirements�values�
constraintrCrrrrs�editabler&rDrG�splitextrErF�egg_info_matchesrGr!rr5r6rr�implementation_tagrArrIrLrwr;r<r�r
�remove_temporary_source�build_location�	build_dirrQrrr�ra)r�autobuilding�reqset�buildsetr�r&r>�ext�
build_success�
build_failurernrtrV�
wheel_filer"r"r#�build�s�






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


re)rr�)rZr�)FNNTNFNN)Qr+�
__future__rrrrJr4r7�loggingr;�os.pathr�r�r�rqror�base64r�email.parserr�pip._vendor.sixrrE�
pip.compatr�pip.downloadrr�pip.exceptionsr	r
r�
pip.locationsrr
rr9rrrrr�pip.utils.uir�pip.utils.loggingr�pip.utils.setuptools_buildr�pip._vendor.distlib.scriptsr�pip._vendorr�pip._vendor.packaging.utilsr�pip._vendor.six.movesr�	wheel_extrJ�	getLoggerr(r�objectrrAr%rlrwr�rcrdr�r�r�r.r6r?rIrMrMrer"r"r"r#�<module>sn
)'



'7

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists