AlkantarClanX12

Your IP : 18.117.154.134


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__/req.cpython-34.pyc

�
�Re)G�@s\ddlmZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZddl
mZmZmZmZmZddlmZmZmZmZmZmZmZddlmZddlmZddlm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0dd	l1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9dd
l:m;Z;ddl
m<Z<ddl=m>Z>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHddlIZJdd
lImKZKmLZLmMZMddlNmOZOmPZPdd�ZQGdd�deR�ZSGdd�deR�ZTGdd�deR�ZUdd�ZVejWdejX�ZYdddddd�ZZdd�Z[dd�Z\d d!�Z]dd"d#�Z^Gd$d%�d%eR�Z_Gd&d'�d'eR�Z`Gd(d)�d)eR�ZadS)*�)�
FeedParserN)�change_root)�bin_py�running_under_virtualenv�PIP_DELETE_MARKER_FILENAME�write_delete_marker_file�bin_user)�InstallationError�UninstallationError�UnsupportedWheel�BestVersionAlreadyInstalled�InvalidWheelFilename�DistributionNotFound�PreviousBuildDirError)�vcs)�logger)�display_path�rmtree�ask�ask_path_exists�
backup_dir�is_installable_dir�is_local�
dist_is_local�dist_in_usersite�dist_in_site_packages�renames�normalize_path�
egg_link_path�make_path_relative�call_subprocess�
is_prerelease�normalize_name)�urlparse�urllib�uses_pycache�ConfigParser�string_types�	HTTPError�get_python_version�b)�Link)�build_prefix)�
PipSession�get_file_content�is_url�url_to_path�path_to_url�is_archive_file�unpack_vcs_link�
is_vcs_url�is_file_url�unpack_file_url�unpack_http_url)�move_wheel_files�Wheel�	wheel_ext)�
pkg_resources�sixcCs�t|d��}|j�}WdQXdtjd�dg}x:|D]2}y|j|�}Wntk
rswCYnXPqCWt|�tks�t�|S)aQReturn the contents of *filename*.

    Try to decode the file contents with utf-8, the preffered system encoding
    (e.g., cp1252 on some Windows machines) and latin1, in that order. Decoding
    a byte string with latin1 will never raise an error. In the worst case, the
    returned string will contain some garbage characters.

    �rbNzutf-8F�latin1)	�open�read�locale�getpreferredencoding�decode�UnicodeDecodeError�type�bytes�AssertionError)�filename�fp�data�	encodings�enc�rM�"/tmp/pip-ztkk0jow-build/pip/req.py�read_text_file's	

rOc@skeZdZddddddddddd�	Zedddd��Zedddd	��Zd
d�Zdd
�Zddd�Z	dd�Z
edd��Zedd��Z
edd��Zddd�ZdZdd�Zdd�Zdd �Zd!d"�Zed#d$��Zejd%�Zfd&d'�Zed(d)��Zed*d+��Zd,d-�Zdd.d/�Zdd0d1�Zd2d3�Zd4d5�Z d6d7�Z!d8d9�Z"fddd:d;�Z#d<d=�Z$fd>d?�Z%d@dA�Z&dBdC�Z'edDdE��Z(edFdG��Z)dHdI�Z*dJdK�Z+dddLdM�Z,edNdO��Z-dS)P�InstallRequirementNFTcCsLf|_t|t�r9tjj|�}|j|_n||_||_||_||_	|	dkrri}	n|	|_
||_||_d|_
d|_d|_d|_d|_||_d|_d|_d|_d|_|
|_||_|rd|_n=|jdk	r?tdd�|jjD��|_n	d|_dS)NFTcSs0g|]&}t|d�o)|ddk�qS)�rz!=)r!)�.0�xrMrMrN�
<listcomp>ls	z/InstallRequirement.__init__.<locals>.<listcomp>)�extras�
isinstancer'r;�Requirement�parse�req�
comes_from�
source_dir�editable�editable_options�url�as_egg�_egg_info_path�satisfied_by�conflicts_with�_temp_build_dir�
_is_bundle�update�install_succeeded�uninstalled�
use_user_site�
target_dir�from_bundle�	pycompile�prereleases�any�specs)�selfrYrZr[r\r^r_rerlr]rjrkrMrMrN�__init__As<																					%zInstallRequirement.__init__c	
Cs�t||�\}}}|jd�r6t|�}nd}|||d|ddd|d|dd�}|dk	r�||_n|S)Nzfile:r[r\Tr^r]rl)�parse_editable�
startswithr0rU)	�cls�editable_reqrZ�default_vcs�namer^�extras_overrider[�resrMrMrN�
from_editableps	z InstallRequirement.from_editablec	Cs�d}|j�}d}tjjtjj|��}d}t|�rWt|�}n�tjj|�r�tjj|ks�|j	d�r�t
|�s�td|��ntt|��}nFt
|�rtjj|�s�tjd|�ntt|��}n|r�|dkr�|j}|j}|jdkrstjd|�rsttjjtjj|j���}n|jtkr�t|j�}|j�s�td|j��q�q�n|}|||d|d	|�S)
z�Creates an InstallRequirement from a name, which might be a
        requirement, directory containing 'setup.py', filename, or URL.
        N�.z;Directory %r is not installable. File 'setup.py' not found.zARequirement %r looks like a filename, but the file does not exist�filez\.\./z-%s is not a supported wheel on this platform.r^rl)�strip�os�path�normpath�abspathr/r+�isdir�seprrrr	r1r2�isfiler�warn�url_without_fragment�egg_fragment�scheme�re�search�extr:r9rH�	supportedr)	rsrvrZrlr^rYr~�link�wheelrMrMrN�	from_line�s43		!*zInstallRequirement.from_linecCs�|jr8t|j�}|jrA|d|j7}qAn	|j}|jdk	rm|dt|jj�7}n|jr�t|jt�r�|j}n|jj	�}|r�|d|7}q�n|S)Nz from %sz in %sz
 (from %s))
rY�strr^rar�locationrZrVr'�	from_path)ro�srZrMrMrN�__str__�s				zInstallRequirement.__str__cCsv|jdkrdSt|j�}|jrrt|jt�rI|j}n|jj�}|rr|d|7}qrn|S)Nz->)rYr�rZrVr'r�)ror�rZrMrMrNr��s	zInstallRequirement.from_pathcCs�|jdk	r|jS|jdkrJtjdd�|_||_|jS|jre|jj�}n	|j}tj	j
|�s�t|�ntj	j||�S)Nz-buildzpip-)
rcrY�tempfile�mkdtemp�_ideal_build_dirr\rv�lowerr}r~�exists�_make_build_dir�join)ro�	build_dir�unpackrvrMrMrN�build_location�s			
z!InstallRequirement.build_locationcCs8|jdk	rdS|jdk	s(t�|js7t�|j}|j}|`|jrj|jj�}n	|j}tj	j
||�}tj	j|�s�tj
d|�t|�ntj	j|�r�tdt|���ntj
d|t|�t|�f�tj||�||_||_d|_dS)zkIf the build location was a temporary directory, this will move it
        to a new more permanent locationNzCreating directory %sz<A package already exists in %s; please remove it to continuez,Moving package %s from %s to new location %s)r[rYrGrcr�r\rvr�r}r~r�r�r�debugr�r	r�shutil�mover`)ro�old_location�
new_build_dirrv�new_locationrMrMrN�correct_build_location�s0				
			z)InstallRequirement.correct_build_locationcCs|jdkrdS|jjS)N)rY�project_name)rorMrMrNrv�szInstallRequirement.namecCs&|jdkrdStj|jj�S)N)rYr$�quote�unsafe_name)rorMrMrN�url_nameszInstallRequirement.url_namecCs�yddl}Wntk
r0td��YnXd}|jrtd|jkrttjj|j|jd|�}ntjj|j|�}tj	r�t
|tj�r�|jt
j��}n|S)NrzBsetuptools must be installed to install from a source distributionzsetup.py�subdirectory)�
setuptools�ImportErrorr	r]r}r~r�r[r<�PY2rV�	text_type�encode�sys�getfilesystemencoding)ror��
setup_file�setup_pyrMrMrNr�s

zInstallRequirement.setup_pycCs�|jst�|jr8tjd|j|jf�ntjd|j|jf�tjd7_z>|jdkr�tj	j
tj	j|jd��r�ttj	j|jd��n|j
}|jdt|j��}|jdt|j��}tjd	|d
g}|js|r&g}nFtj	j|jd�}tj	j|�s`tj|�nddg}t||d
|jd|jdddtjdd�Wdtjd8_X|js�tjjd|j��|_|j�ndS)Nz2Running setup.py (path:%s) egg_info for package %sz7Running setup.py (path:%s) egg_info for package from %s��
distributer�zdistribute.egg-info�__SETUP_PY__�__PKG_NAME__z-c�egg_infozpip-egg-infoz
--egg-base�cwd�
filter_stdout�show_stdoutF�
command_level�command_desczpython setup.py egg_infoz%(Name)s==%(Version)s)r[rGrvr�notifyr�r^�indentr}r~r�r�r�
_run_setup_py�replace�reprr��
executabler\r��makedirsr �_filter_install�
VERBOSE_DEBUGrYr;rWrX�pkg_infor�)ro�force_root_egg_info�script�egg_info_cmd�egg_base_option�egg_info_dirrMrMrN�run_egg_info!s8	 	4		
			zInstallRequirement.run_egg_infoa}
__file__ = __SETUP_PY__
from setuptools.command import egg_info
import pkg_resources
import os
import tokenize
def replacement_run(self):
    self.mkpath(self.egg_info)
    installer = self.distribution.fetch_build_egg
    for ep in pkg_resources.iter_entry_points('egg_info.writers'):
        # require=False is the change we're making:
        writer = ep.load(require=False)
        if writer:
            writer(self, ep.name, os.path.join(self.egg_info,ep.name))
    self.find_sources()
egg_info.egg_info.run = replacement_run
exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))
cCsy|jdk	r5|jj|�s%dS|jj|�S|jsDt�|j|�}tjj|�sidSt	|�}|S)N)
ra�has_metadata�get_metadatar[rG�
egg_info_pathr}r~r�rO)rorHrJrMrMrN�
egg_info_databsz InstallRequirement.egg_info_datacs|jdkr|jr$|j}ntjj|jd�}tj|�}|jr�g}x
tj|�D]�\�}}x-tj	D]"}||kr�|j
|�q�q�Wx�t|�D]�}tjjtjj�|dd��s
tjjtjj�|dd��r|j
|�n|dks2|dkr�|j
|�q�q�W|j
�fdd	�|D��qjWd
d	�|D�}n|s�td||f��n|s�td||f��t|�dkr�|jd
dd��ntjj||d�|_ntjj|j|�S)Nzpip-egg-info�bin�python�Scriptsz
Python.exe�test�testscs%g|]}tjj�|��qSrM)r}r~r�)rR�dir)�rootrMrNrT�s	z4InstallRequirement.egg_info_path.<locals>.<listcomp>cSs%g|]}|jd�r|�qS)z	.egg-info)�endswith)rR�frMrMrNrT�s	z$No files/directories in %s (from %s)rQ�keycSs8|jtjj�tjjr3|jtjj�p6dS)Nr)�countr}r~r��altsep)rSrMrMrN�<lambda>�sz2InstallRequirement.egg_info_path.<locals>.<lambda>r)r`r\r[r}r~r��listdir�walkr�dirnames�remove�listr��extendr	rG�len�sort)rorH�base�	filenames�dirs�filesr�rM)r�rNr�ns6		''z InstallRequirement.egg_info_pathcCso|j|�}|sgSg}xI|j�D];}|j�}|s,|jd�rZq,n|j|�q,W|S)N�#)r��
splitlinesr|rr�append)rorHrJ�result�linerMrMrN�egg_info_lines�sz!InstallRequirement.egg_info_linescCs^t�}|jd�}|sAtjdt|jd���n|j|pPd�|j�S)NzPKG-INFOzNo PKG-INFO file found in %s�)rr�rr�rr��feed�close)ro�prJrMrMrNr��s	#zInstallRequirement.pkg_infocCs
|jd�S)Nzdependency_links.txt)r�)rorMrMrN�dependency_links�sz#InstallRequirement.dependency_linksz	\[(.*?)\]ccs�d}xx|jd�D]g}|jj|j��}|rO|jd�}qn|rx||krxtjd|�qn|VqWdS)Nzrequires.txtrQzskipping extra %s)r��_requirements_section_re�matchr��grouprr�)rorU�in_extrar�r�rMrMrN�requirements�szInstallRequirement.requirementsccs5x.|jjD] \}}|dkr
|Vq
q
WdS)Nz==)rYrn)ro�	qualifier�versionrMrMrN�absolute_versions�sz$InstallRequirement.absolute_versionscCs|j�dS)Nr�)r�)rorMrMrN�installed_version�sz$InstallRequirement.installed_versioncCsk|jst�|j}||jkrDtjd||jf�n#tjdt|j�||f�dS)Nz'Requested %s, but installing version %sz;Source in %s has version %s, which satisfies requirement %s)r[rGr�rYrr�r�r)ror�rMrMrN�assert_source_matches_version�s		z0InstallRequirement.assert_source_matches_versioncCs|js!tjd|j�dS|js0t�|js?t�|jjd�rUdSd|jkswtd|j��|js�dS|jjdd�\}}t	j
|�}|r�||j�}|r�|j|j�q|j|j�ndstd|j|f��dS)Nz>Cannot update repository at %s; repository location is unknownzfile:�+zbad url: %rrQrz+Unexpected version control type (in %s): %s)
r^r�infor[r\rGrrre�splitr�get_backend�obtain�export)ror�vc_typer^�backend�vcs_backendrMrMrN�update_editable�s(	"		z"InstallRequirement.update_editablecsd|j�s%td|jf��n|jp4|j}t|�}tjj|j	|j
��d}tjj|j	dj|j
�jd�dd���d}|jdt
jd�}|j
�d	}t|�}tjj|�}	tjj|�}
tjj|�}|	s|
rR|	r)|}n|}|j|�|jd
�r�x|jd
�j�D]4}
tjjtjj||
��}|j|�qaWq�|jd�r�|jd�r�|jd��ng�xz�fd
d�|jd�j�D�D]M}tjj|j	|�}|j|�|j|d�|j|d�q�Wq�n?|j	j|�r�|j|j	�tjjtjj|j	�d�}|j|d|�n�|r^t|d�}tjj|j�j��}|j�||j	kstd||j|j	f��|j|�tjjtjj|�d�}|j||j	�n3|r�x*tj j!|�D]}|j|�qwWn|jd�r5|j"d�r5x�|j#d�D]o}t$|�r�t%}nt&}|jtjj||��t'j(dkr�|jtjj||�d�q�q�Wn|jd�rJt)j*�}|j+t,|j-d���|j.d�rJx�|j/d�D]�\}}t$|�r�t%}nt&}|jtjj||��t'j(dkr�|jtjj||�d�|jtjj||�d�|jtjj||�d�q�q�WqJn|j0|�||_1dS)a�
        Uninstall the distribution currently satisfying this requirement.

        Prompts before removing or modifying files unless
        ``auto_confirm`` is True.

        Refuses to delete or modify files outside of ``sys.prefix`` -
        thus uninstallation within a virtual environment can only
        modify that virtual environment, even if the virtualenv is
        linked to global site-packages.

        z.Cannot uninstall requirement %s, not installedz	.egg-info�-Nr�z
.dist-infoz-py%sr�z.eggzinstalled-files.txtz
top_level.txtznamespace_packages.txtcs(g|]}|r|�kr|�qSrMrM)rRr�)�
namespacesrMrNrTs	z0InstallRequirement.uninstall.<locals>.<listcomp>z.pyz.pyczeasy-install.pthz./�rz;Egg-link %s does not match installed location of %s (at %s)�scripts�win32z.batzentry_points.txt�console_scriptsz.exez
.exe.manifestz
-script.py)2�check_if_existsr
rvrarb�UninstallPathSetr}r~r�r��egg_namerr�r;�PY_MAJORrr��addr�r�r�rr��dirname�add_pthr?�normcase�readliner|r�rG�pipr��uninstallation_paths�metadata_isdir�metadata_listdirrrrr��platformr&�SafeConfigParser�readfp�FakeFile�get_metadata_lines�has_section�itemsr�rg)ro�auto_confirm�dist�paths_to_remove�pip_egg_info_path�dist_info_path�debian_egg_info_path�easy_install_egg�develop_egg_link�pip_egg_info_exists�debian_egg_info_exists�dist_info_existsr��installed_filer~�
top_level_pkg�easy_install_pth�fh�link_pointerr��bin_dir�configrv�valuerM)r
rN�	uninstall�s�
(	
!
	
.
		*	  -
zInstallRequirement.uninstallcCs4|jr|jj�ntjd|jf�dS)Nz'Can't rollback %s, nothing uninstalled.)rg�rollbackr�errorr�)rorMrMrN�rollback_uninstallYs		z%InstallRequirement.rollback_uninstallcCs4|jr|jj�ntjd|jf�dS)Nz%Can't commit %s, nothing uninstalled.)rg�commitrr8r�)rorMrMrN�commit_uninstall`s		z#InstallRequirement.commit_uninstallcCs�|jst�d}d|j|jf}tjj||�}tjj|�rtdt	|�d�}|dkr�d}q|dkr�t
jdt	|��tj|�q|dkrt
|�}t
jd	t	|�t	|�f�tj||�qn|r�tj|dtj�}tjjtjj|j��}xtj|�D]�\}	}
}d
|
kr~|
jd
�nxl|
D]d}tjj|	|�}|j||�}
tj|jd|
d�}d|_|j|d�q�Wxb|D]Z}|tkrq�ntjj|	|�}|j||�}
|j||jd|
�q�WqSW|j�t
jd8_t
jdt	|��ndS)NTz	%s-%s.zipz/The file %s exists. (i)gnore, (w)ipe, (b)ackup �i�wr*FzDeleting %szBacking up %s to %szpip-egg-info�/i��r�r�zSaved %s)r<r=r*i�)r[rGrvr�r}r~r�r�rrrr�r�rr�r��zipfile�ZipFile�ZIP_DEFLATEDrr�r��_clean_zip_name�ZipInfo�
external_attr�writestrr�writer�r�r�)ror��create_archive�archive_name�archive_path�response�	dest_file�zipr��dirpathr�r�rrv�zipdirrHrMrMrN�archivegsN		!
	
#
zInstallRequirement.archivecCse|j|tjj�s/td||f��|t|�dd�}|jtjjd�}|S)Nz$name %r doesn't start with prefix %rrQr>)rrr}r~r�rGr�r�)rorv�prefixrMrMrNrC�s
z"InstallRequirement._clean_zip_namecs�|jr|j||�dS|jrztjj|j�}tjj||j�|j	|jd�d|�d|_
dStjdd�}t
jj|d�}z�tjg}|jd�|jd|j�|t|�d	d
|g7}|js|dg7}n�dk	r&|d�g7}n|jr?|d
g7}n
|dg7}t�r�|dt
jjtjdddt��g7}ntjd|j�tjd7_z*t||d|jd|jdd�Wdtjd8_Xt
jj|�stjd|�dSd|_
|jr$dS�fdd�}	t |�}
xN|
D]1}|j!�}|j"d�rI|	|�}PqIqIWtj#d|�dS|
j$�g}
t |�}
x[|
D]S}|j!�}t
jj%|�r�|t
jj&7}n|
jt'|	|�|��q�W|
j$�t t
jj|d�d�}
|
j(d j|
�d �|
j$�Wdt
jj|�rt
j)|�nt
j*|�XdS)!Nr��strip_file_prefixTz-recordzpip-zinstall-record.txtz-cz�import setuptools, tokenize;__file__=%r;exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))�installz--recordz#--single-version-externally-managedz--rootz	--compilez--no-compilez--install-headers�include�siter�zRunning setup.py install for %sr�r�r�r�FzRecord file %s not foundcs4�dkstjj|�r#|St�|�SdS)N)r}r~�isabsr)r~)r�rMrN�prepend_root�sz0InstallRequirement.install.<locals>.prepend_rootz	.egg-infoz;Could not find .egg-info directory in install record for %szinstalled-files.txtr=�
)+r\�install_editable�is_wheelrr��
wheel_versionr[�check_compatibilityrvr8rfr�r�r}r~r�r�r�r�r�r�r_rkrrQr)rr�r�r r�r�r?r|r�r�r�r�r�rrGr��rmdir)ro�install_options�global_optionsr�rRr��
temp_location�record_filename�install_argsrWr�r�r��	new_linesrHrM)r�rNrS�s�				
		
	
		


 
zInstallRequirement.installcCs�|jstjj|j�rWtjd|j�|jrKt|j�nd|_n|j	r�tjj|j	�r�t|j	�nd|_	dS)zVRemove the source files from this requirement, if they are marked
        for deletionzRemoving source in %sN)
�	is_bundler}r~r��delete_marker_filenamerrr[rrc)rorMrMrN�remove_temporary_source�s	z*InstallRequirement.remove_temporary_sourcecCs�tjd|j�tjd7_zWttjdd|jgt|�ddgt|�d|j	d|j
d	d
�Wdtjd8_Xd|_dS)NzRunning setup.py develop for %sr�z-cz�import setuptools, tokenize; __file__=%r; exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))�developz	--no-depsr�r�r�FT)rr�rvr�r r�r�r�r�r[r�rf)ror^r_rMrMrNrYs7z#InstallRequirement.install_editablecCsatj}xKddddddddgD]+}tj||j��r(tj}Pq(q(W||fS)	Nz^running .*z^writing .*z^creating .*z^[Cc]opying .*z^reading .*z4^removing .*\.egg-info' \(and everything under it\)$z^byte-compiling z7^warning: manifest_maker: standard file '-c' not found$)r�NOTIFYr�r�r|�INFO)ror��level�regexrMrMrNr�s	
	z"InstallRequirement._filter_installcCs|jdkrdSyJ|jjdkrG|jrG|jjdkrGdStj|j�|_Wn�tjk
rxdSYn�tjk
rtj|jj�}|jr�t	|�r�||_q�t
�r�t|�r�td|j|j
f��q�n	||_YnXdS)z�Find an installed distribution that satisfies or conflicts
        with this requirement, and set self.satisfied_by or
        self.conflicts_with appropriately.NFr�r�TzVWill not install to the user site because it will lack sys.path precedence to %s in %s)rYr�rbr;�get_distributionrar�VersionConflictrhrrrr	r�)ro�
existing_distrMrMrNrs(		z"InstallRequirement.check_if_existscCs|jod|jkS)Nz.whl)r^)rorMrMrNrZ=szInstallRequirement.is_wheelcCsu|jdk	r|jS|j}|s)dStjjtjj|d��phtjjtjj|d��|_|jS)NFzpip-manifest.txtzpyinstall-manifest.txt)rdrcr}r~r�r�)ror�rMrMrNrdAs	!$zInstallRequirement.is_bundlec
csGx|jD]�}tjj|�}x�tjD]�}d}}tjj||j�}tjj|�r,|j	}t
|�}|j�}	|j�|�j
|	�\}}Pq,q,W|r�d|||f}nd}t||ddd|ddd|dd�Vq
Wx=|jD]2}tjj|�}t||d|dd�Vq
WdS)	Nz%s+%s@%sr\Tr^reFr[rj)�_bundle_editable_dirsr}r~�basenamer�backendsr��bundle_filer�rvr?r@r��parse_vcs_bundle_filerP�_bundle_build_dirs)
ro�dest_dir�packagerr^�rev�vcs_bundle_filerrI�contentrMrMrN�bundle_requirementsMs,
		
z&InstallRequirement.bundle_requirementsc
Cs�|j}|st�tjj|d�}tjj|d�}g}g}x#|||f|||fgD]\}}	}
tjj|�rjx�tj|�D]�}tjj|	|�}|
j|�tjj|�r�tj	d|||f�q�ntjj|	�s(tj
d|	�tj|	�ntj
tjj||�|�q�Wtj|�smtj|�qmqjqjWd|_||_||_dS)N�src�buildzZThe directory %s (containing package %s) already exists; cannot move source from bundle %szCreating directory %s)rcrGr}r~r�r�r�r�rr�rr�r�r�r]rtro)
ro�dest_build_dir�dest_src_dirr��src_dirr��bundle_build_dirs�bundle_editable_dirsr[ru�dir_collectionr�destrMrMrN�move_bundle_filesgs4	
	#		z$InstallRequirement.move_bundle_filescCsAt|j|j|d|jd|jd|d|jd|�dS)N�user�homer�rkrR)r8rvrYrhrirk)ro�wheeldirr�rRrMrMrNr8�s			z#InstallRequirement.move_wheel_filescCs%|jst�tjj|jt�S)N)r[rGr}r~r�r)rorMrMrNre�sz)InstallRequirement.delete_marker_filename).�__name__�
__module__�__qualname__rp�classmethodryr�r�r�r�r��propertyrvr�r�r�r�r�r�r�r�r�r��compiler�r�r�r�r�rr6r9r;rPrCrSrfrYr�rrZrdrzr�r8rerMrMrMrNrP?sV-*
?*
	n)]!
rPc@sdeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�RequirementscCsg|_i|_dS)N)�_keys�_dict)rorMrMrNrp�s	zRequirements.__init__cCs|jS)N)r�)rorMrMrN�keys�szRequirements.keyscs�fdd��jD�S)Ncsg|]}�j|�qSrM)r�)rRr�)rorMrNrT�s	z'Requirements.values.<locals>.<listcomp>)r�)rorM)rorN�values�szRequirements.valuescCs
||jkS)N)r�)ro�itemrMrMrN�__contains__�szRequirements.__contains__cCs3||jkr"|jj|�n||j|<dS)N)r�r�r�)ror�r5rMrMrN�__setitem__�szRequirements.__setitem__cCs|j|S)N)r�)ror�rMrMrN�__getitem__�szRequirements.__getitem__cs0�fdd��j�D�}ddj|�S)Ncs0g|]&}dt|�t�|�f�qS)z%s: %s)r�)rR�k)rorMrNrT�s	z)Requirements.__repr__.<locals>.<listcomp>zRequirements({%s})z, )r�r�)ror�rM)rorN�__repr__�szRequirements.__repr__N)
r�r�r�rpr�r�r�r�r�r�rMrMrMrNr��sr�c
@sBeZdZddddddddddddd�Zdd�Zdd	�Zd
d�Zedd
��Zedd��Z	edd��Z
dd�Zddd�Zdd�Z
dddd�Zddd�Zdd�Zdd�Zddd d!�Zfd"d#�Zd$d%�Zd&Zd'd(�Zd)d*�ZdS)+�RequirementSetNFTcCs�||_||_||_|r6tjj|�}n||_||_||_|
|_	t
�|_i|_g|_
|	|_g|_g|_g|_||_||_||_|p�t�|_|
|_||_dS)N)r�r�download_dirr}r~�
expanduser�download_cache�upgrade�ignore_installed�force_reinstallr�r��requirement_aliases�unnamed_requirements�ignore_dependencies�successfully_downloaded�successfully_installed�reqs_to_cleanupr_rhrir-�sessionrk�wheel_download_dir)ror�rr�r�r�r�r_rir�r�rhr�rkr�rMrMrNrp�s,																	zRequirementSet.__init__cCsLdd�|jj�D�}|jddd��djdd�|D��S)NcSsg|]}|js|�qSrM)rZ)rRrYrMrMrNrT�s	z*RequirementSet.__str__.<locals>.<listcomp>r�cSs
|jj�S)N)rvr�)rYrMrMrNr��sz(RequirementSet.__str__.<locals>.<lambda>� cSsg|]}t|j��qSrM)r�rY)rRrYrMrMrNrT�s	)r�r�r�r�)ro�reqsrMrMrNr��szRequirementSet.__str__cCs�|j}|j|_|j|_|j|_|j|_|sR|jj|�ni|j|�r�td||j	|�|f��n||j
|<|j�|kr�||j|j�<ndS)Nz5Double requirement given: %s (already in %s, name=%r))
rvr_rhrirkr�r��has_requirementr	�get_requirementr�r�r�)ro�install_reqrvrMrMrN�add_requirement�s	
zRequirementSet.add_requirementcCsCx<||j�fD](}||jks7||jkrdSqWdS)NTF)r�r�r�)ror�rvrMrMrNr��szRequirementSet.has_requirementcCst|jj��p|jS)N)r�r�r�r�)rorMrMrN�has_requirements�szRequirementSet.has_requirementscCsJtdd�|jj�D��r&dStdd�|jD��rFdSdS)Ncss|]}|jVqdS)N)r\)rRrYrMrMrN�	<genexpr>�sz/RequirementSet.has_editables.<locals>.<genexpr>Tcss|]}|jVqdS)N)r\)rRrYrMrMrNr��sF)rmr�r�r�)rorMrMrN�
has_editables�s
"zRequirementSet.has_editablescCsg|jrctjj|j�|_tjj|j�r:dStjd�tdt|j���ndS)NTz!Could not find download directoryz0Could not find or access download directory '%s'F)	r�r}r~r�r�r�fatalr	r)rorMrMrN�is_download�s	
zRequirementSet.is_downloadcCslxU||j�fD]A}||jkr3|j|S||jkr|j|j|SqWtd|��dS)NzNo project with the name %r)r�r�r��KeyError)ror�rvrMrMrNr�szRequirementSet.get_requirementcCs8x1|jj�D] }|jd|�|j�qWdS)Nr#)r�r�r6r;)ror#rYrMrMrNr6szRequirementSet.uninstallcCs�t|j�}t|jj��}xc|s3|r�|rK|jd�}n|jd�}d}|jr�|jr�|j�|jr�|j	r�|j
o�t|j�s�|j|_nd|_q�d}n|jr�t
jd|�q�n|jr |jdkrE|j|j�|_qEn%|rE|j|j|j�|_n|jdk	r'tjj|j�r'td||jf��q'q'WdS)NrTFz<Requirement already satisfied (use --upgrade to upgrade): %sz�Could not install requirement %s because source folder %s does not exist (perhaps --no-download was used without first running an equivalent install with --no-install?))r�r�r�r��popr�r\rrar�rhrrbrr�r[r�rr�r�r}r~r�r	)ro�unnamedr��req_to_install�install_neededrMrMrN�locate_filess4
						%zRequirementSet.locate_filesc(Cs�t|j�}t|jj��}x�|s3|r�|rK|jd�}n|jd�}d}d}d}	|jr�|jr�|j�|jr`|j	rW|j
r|jry|j||j	�}
Wn?t
k
r�d}d}Yqtk
r
tj�d}	YqX|
j|_n|s]|jo6t|j�sH|j|_nd|_q]q`d}n|jr�|r�tjd|�q�tjd|�q�n|jr�tjd|�n^|r|jr|jj�jd	�rtjd
tt|j���qtjd|�ntjd7_zld}d}|jr�|jdkri|j|j�}
|
|_n	|j}
tjj |j!�s�t"|j!�n|j#|j$�|j$r�|j%�|j&|j'�q1|j%�nV|r1|j|j!|j$�}
d}d}
|j(rnWtjj tjj)|
d
��rUt*t+j,d||
f���n|jdkr�|	rs|	�n|j|d|j	�}
nt-|j�}
|
s�t.�|
rcyY|
j/j0t1�r�|j2r�|j2}d}n|j'}|j$}|j3|
|
||�Wqit4k
r_}z5tj5d||f�t6d|||
f��WYdd}~XqiXnd}|r1|j7}|
o�|
j/j0t1�}|r�|j8|j!|j�x�|j9�D] }|j:|�|j;|�q�Wn�|j$r3|
|_|s|j%�n|
r�|
j<t=j>kr�|j&|j'�q�ny|rQ|
|_|
j|_n[|
|_|j%�|r}|j%dd�n|j?�|r�|jr�|j@|�d}n|js�|j�n|jr.|j	s�|jr|jo�t|j�s|j|_nd|_q+tjd|�d}q.q1n|r�ttAjB|
��d}|jCsx|jD�|_C|j;|�n|jEsxd|jF|jG�D]M}|jH|jI�r�q�ntJtK|�|�}|j:|�|j;|�q�Wqn&|s|jL|jM�|jGr*tjddj)|jG��n|jEs�x�|j|jG�D]�}ytAjNjO|�jI}Wn?tPk
r�tj�d}tjQd|||f�wFYnX|jH|�r�qFntJ||�}|j:|�|j;|�qFWn|jH|jR�s|j;|�qn|sE|j$s/|jSdk	rE|jTj:|�qEn|r�|jUj:|�|r�|jr�|jjd�r�|j@|�q�nWdtjd8_Xq'WdS)zGPrepare process. Create temp directories, download and/or unpack files.rTFNrQz"Requirement already up-to-date: %sz<Requirement already satisfied (use --upgrade to upgrade): %szObtaining %szfile:zUnpacking %szDownloading/unpacking %sr�zsetup.pya�
                          pip can't proceed with requirement '%s' due to a pre-existing build directory.
                           location: %s
                          This is likely due to a previous installation that failed.
                          pip is being responsible and not assuming it can delete this.
                          Please delete it and try again.
                        r�z4Could not install requirement %s because of error %szDCould not install requirement %s because of HTTP error %s for URL %sr�z!Installing extra requirements: %r�,z.Invalid requirement: %r (%s) in requirement %szfile:///)Vr�r�r�r�r�r�r\rrar�r�r^�find_requirementrrr��exc_inforhrrbrr�r�rrrr0r�r[r�rr}r~r�r�r�rr�r�rPr�rjr�r�textwrap�dedentr+rGrHr�r:r��
unpack_urlr(r�r	rdr�rzr�r�r�r�all_schemesr��copy_to_build_dirr;�find_distributionsrY�as_requirementr��requiresrUr�r�rPr��add_dependency_linksr�rWrX�
ValueErrorr8rvrcr�r�)ro�finderr��bundler�r�r�rS�best_installed�	not_foundr^rdrZr�r�r��do_download�exc�e�subreqr$rYrvrMrMrN�
prepare_files:sV
		


					!#			

	!								)	
		
		


		
					
	 	

	!zRequirementSet.prepare_filescCs�tjd�tjd7_x|jD]}|j�q&Wg}|j�r_|j|j�n|rx|j|j�nx>|D]6}t	j
j|�rtjd|�t
|�qqWtjd8_dS)zClean up files, remove builds.zCleaning up...r�zRemoving temporary dir %s...N)rr�r�r�rf�_pip_has_created_build_dirr�r�rr}r~r�rr)ror�rY�
remove_dirr�rMrMrN�
cleanup_files's

zRequirementSet.cleanup_filescCs1|jtko0tjjtjj|jt��S)N)r�r,r}r~r�r�r)rorMrMrNr�>sz)RequirementSet._pip_has_created_build_dircCs�|jr|jp|j}tjd|j|f�tjj||j�}t	j
|j|�tdd|dgd|dd�dS)NzCopying %s to %sr�z%s/setup.py�cleanr�r�zpython setup.py clean)
r\rr�rrrvr}r~r�r��copytreer[r )ror�rir�rMrMrNr�Bsz RequirementSet.copy_to_build_dircCs�|dkr|j}nt|�rL|r3|}n|}t|||�nat|�r~t|||�|r�t|�q�n/t|||j||j�|r�t|�ndS)N)	r�r4r3r5r6rr7r�r�)ror�r�r��
only_download�locrMrMrNr�Js&	
zRequirementSet.unpack_urlc"Osdd�|jj�D�}tjjd�}xI|D]A}|jdkr5|j|kr5|j|�|j|�q5q5W|r�t	j
ddjdd�|D���nt	jd7_zCx<|D]4}|jd	kr0y=tjjd
�}	tj
d�}
|
|	kr|
|_nWq0tjk
r,Yq0Xn|jr�t	j
d|j�t	jd7_z|jdd
�Wdt	jd8_Xny|j||||�Wn+|jr�|jr�|j�n�Yn X|jr�|jr�|j�n|j�q�WWdt	jd8_X||_dS)zRInstall everything in this set (after having downloaded and unpacked the packages)cSsg|]}|js|�qSrM)ra)rRrrMrMrNrTks	z*RequirementSet.install.<locals>.<listcomp>zdistribute>=0.7r�z!Installing collected packages: %sz, cSsg|]}|j�qSrM)rv)rRrYrMrMrNrT{s	r�r�zdistribute<0.7zFound existing installation: %sr#TN)r�r�r;rWrXrvr�r�r�rr�r�r�rlrbrr6rSrfr9r;rfr�)ror^r_�args�kwargs�
to_install�distribute_reqrY�requirement�distribute_requirement�existing_distributerMrMrNrSisJ	

*
		

zRequirementSet.installcCs�tj|dtj�}g}xJ|jdf|jdffD]*\}}tjjtjj|��}x�tj	|�D]�\}}}x�t
jD]�}	|	�}
d}}|
j|kr�xR|D]}
|j
|
�r�Pq�q�W|
jtjj||��\}}|j|�|
j}|
ji|d6|d6}|j|
j�Pq�q�Wd|kre|jd�nxQ|D]I}tjj||�}|j||�}|j|d|dd�qlWx_|D]W}|tkr�q�ntjj||�}|j||�}|j||d|�q�W|rwtjj||�}|j||�}|j|d||�qwqwWq=W|jd	|j��|j�dS)
Nr=r|r{r^rwzpip-egg-infor>r�zpip-manifest.txt)r@rArBr�rr}r~rr�r�rrqrrr�get_infor�r�rr�guider�rCrFrrGrzr�)ro�bundle_filenamerM�vcs_dirsr�rprNr�r�rr�vcs_url�vcs_rev�vcs_dirrx�	vcs_guiderrvrHrMrMrN�
create_bundle�sL+	


	
 
#zRequirementSet.create_bundlez�# This is a pip bundle file, that contains many source packages
# that can be installed as a group.  You can install this like:
#     pip this_file.zip
# The rest of the file contains a list of all the packages included:
cCs�|jg}xAdd�|jj�D�D]#}|jd|j|jf�q)W|jd�xAdd�|jj�D�D]#}|jd|j|jf�qzWdj|�S)NcSsg|]}|js|�qSrM)rZ)rRrYrMrMrNrT�s	z6RequirementSet.bundle_requirements.<locals>.<listcomp>z%s==%s
zC# These packages were installed to satisfy the above requirements:
cSsg|]}|jr|�qSrM)rZ)rRrYrMrMrNrT�s	r�)�
BUNDLE_HEADERr�r�r�rvr�r�)ro�partsrYrMrMrNrz�s#!
#!z"RequirementSet.bundle_requirementscCse|j|tjj�s/td||f��|t|�dd�}|jtjjd�}|S)Nz$name %r doesn't start with prefix %rrQr>)rrr}r~r�rGr�r�)rorvrQrMrMrNrC�s
zRequirementSet._clean_zip_name)r�r�r�rpr�r�r�r�r�r�r�r�r6r�r�r�r�r�r�rSr�r�rzrCrMrMrMrNr��s2		
'�E7r�cCstj|�t|�dS)N)r}r�r)r�rMrMrNr��s
r�z^(http|https|file):c
cs|dkrt�}nd}|r-|jnd}|rKtj|�}ntjjtjj|��}t|d|d|�\}}xzt	|j
��D]f\}	}
|	d7}	|
j�}
tjdd|
�}
|
s�|
j
d�r�q�n|r|j|
�rq�n|
j
d�s&|
j
d�r�|
j
d�rN|
d	d�j�}n%|
td�d�j�jd
�}tj|�r�tj||�}n3tj|�s�tjjtjj|�|�}nx3t||d|d|d|�D]}|Vq�Wq�|
j
d�s|
j
d
�rq�|
j
d�s=|
j
d�r�|
j
d�re|
d	d�j�}
n%|
td�d�j�jd
�}
tjj||
�}
tjj|
�r�|
}
n|r|jj|
�qq�|
j
d�s�|
j
d�rY|
j
d�r|
d	d�j�}
n%|
td�d�j�jd
�}
|r|
g|_qq�|
j
d�r�|
td�d�j�jd
�}
|r|jj|
�qq�|
j
d�r�d|_q�|
j
d�r�g|_q�|
j
d�r:|
td�d�j�jd
�}
|jtt|
�j�g�O_q�|
j
d�rUd|_q�|
j
d�rgq�|
j
d�ryq�|
j
d�r�|
td�d�j�jd
�}
|j tt|
�j�g�O_ q�|
j
d�r/|
td�d�j�jd
�}
|j tt|
�j�g�O_ q�d||	f}|
j
d�s]|
j
d�r�|
j
d�r�|
d	d�j�}
n%|
td�d�j�jd
�}
t!j"|
d|d|r�|j#nd�}n$t!j$|
|d t%|d!d��}|Vq�WdS)"NrZr�rQz
(^|\s)#.*$r�r�z-rz
--requirementr��=�optionsz-Zz--always-unzipz-fz--find-linksz-iz--index-urlz--extra-index-urlz--use-wheelTz
--no-indexz--allow-externalz--allow-all-externalz--no-allow-externalz--no-allow-insecurez--allow-insecurez--allow-unverifiedz-r %s (line %s)z-ez
--editablerurl�pre)&r-�skip_requirements_regexr�r�r}r~rr�r.�	enumerater�r|�subrrr�r��
_scheme_rer#�urljoinr��parse_requirements�lstripr��
find_linksr��
index_urls�	use_wheel�allow_external�setr"r��allow_all_external�allow_unverifiedrPryrur��getattr)rHr�rZr�r��
skip_match�
skip_regex�
reqs_file_dirry�line_numberr��req_urlr��relative_to_reqs_filerYrMrMrNr�s�	
%$(%	%%%'%'%'%'$r�cCs.tjd|�}|r*|jd�}n|S)z2
        Strip req postfix ( -dev, 0.2, etc )
    z^(.*?)(?:-dev|-\d.*)$rQ)r�r�r�)rYr�rMrMrN�_strip_postfixgsrcCspdd�|jdd�djd�D�}d}|ddkrO|d}n|dd
krl|d}n|S)NcSsg|]}|r|�qSrMrM)rRr�rMrMrNrTts	z'_build_req_from_url.<locals>.<listcomp>r�rQrr>r��tags�branches�tag�branch��trunk���)ztagszbranchesztagzbranch������r)r)r^r�rYrMrMrN�_build_req_from_urlrs,

r
cCs{tjd�}|j|�}|rwt�}xC|D];}|\}}||kretd|��n|||<q4W|SdS)zz
        This method generates a dictionary of the query string
        parameters contained in a given editable URL.
    z([\?#&](?P<name>[^&=]+)=(?P<value>[^&=]+)z%s option already definedN)r�r��findall�dict�	Exception)rY�regexp�matched�ret�optionrvr5rMrMrN�_build_editable_options}s	
rc
Csm|}d}tjd|�}|rE|jd�}|jd�}n|}tjj|�r�tjjtjj|d��s�td|��nt	|�}n|j
�jd�r�|r�d|tj
jd|�jfSd|dfSnx;tD]3}|j
�jd	|�r�d
||f}Pq�q�Wd|kr_|rL|d|}q_td|��n|jdd�d
j
�}tj|�s�d|djdd�tjD��d}t|��nyt|�}	Wn8tk
rtj�d}
td||
f��YnX|	s"d|	krJt|�}|sTtd|��qTn
|	d}t|�}|||	fS)zSParses svn+http://blahblah@rev#egg=Foobar into a requirement
    (Foobar) and a URLNz^(.+)(\[[^\]]+\])$rQr�zsetup.pyz;Directory %r is not installable. File 'setup.py' not found.zfile:�__placeholder__z%s:z%s+%sr�zb%s should either be a path to a local project or a VCS url beginning with svn+, git+, hg+, or bzr+rzFor --editable=%s only z, cSsg|]}|jd�qS)z+URL)rv)rRrrMrMrNrT�s	z"parse_editable.<locals>.<listcomp>z is currently supportedz*--editable=%s error in editable options:%s�eggz@--editable=%s is not the right format; it must have #egg=Package)r�r�r�r}r~r�r�r�r	r1r�rrr;rWrXrUrrrrqrr
r�r�r
r)
rtrur^rU�m�
url_no_extras�version_controlr�
error_messager��messagerYrvrMrMrNrq�sT! 
$

rqc@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
ddd�Zdd�Zdd�Z
dS)rzMA set of file paths to be removed in the uninstallation of a
    requirement.cCs@t�|_t�|_i|_||_d|_g|_dS)N)r��paths�_refuse�pthr$�save_dir�_moved_paths)ror$rMrMrNrp�s			zUninstallPathSet.__init__cCs
t|�S)zs
        Return True if the given path is one we are permitted to
        remove/modify, False otherwise.

        )r)ror~rMrMrN�
_permitted�szUninstallPathSet._permittedcCsFt|j�sBtjd|jjt|jj�tjf�dSdS)Nz1Not uninstalling %s at %s, outside environment %sFT)	rr$rr�r�rr�r�rQ)rorMrMrN�_can_uninstall�s
	&zUninstallPathSet._can_uninstallcCs�t|�}tjj|�s"dS|j|�rD|jj|�n|jj|�tjj|�ddkr�t	r�|jt
j|��ndS)NrQz.py)rr}r~r�rrrr�splitextr%�imp�cache_from_source)ror~rMrMrNr�s"zUninstallPathSet.addcCskt|�}|j|�rW||jkr@t|�|j|<n|j|j|�n|jj|�dS)N)rrr�UninstallPthEntriesrr)ro�pth_file�entryrMrMrNr�szUninstallPathSet.add_pthcsYt�}xIt|dt�D]5�t�fdd�|D��s|j��qqW|S)z�Compact a path set to contain the minimal number of paths
        necessary to contain all paths in the set. If /a/path/ and
        /a/path/to/a/file.txt are both in the set, leave only the
        shorter path.r�csJg|]@}�j|�oC�t|jtjj��tjjk�qSrM)rrr��rstripr}r~r�)rR�	shortpath)r~rMrNrT
s	z,UninstallPathSet.compact.<locals>.<listcomp>)r��sortedr�rmr)ror�short_pathsrM)r~rN�compacts	
zUninstallPathSet.compactcCs5tjj|jtjj|�djtjj��S)NrQ)r}r~r�r�
splitdriver�r�)ror~rMrMrN�_stashs	zUninstallPathSet._stashFcCs�|j�sdS|js4tjd|jj�dStjd|jj�tjd7_t|j|j��}z6|r�d}n-x|D]}tj|�q�Wt	dd�}|j
r�tjd�x*|j|j
�D]}tj|�q�Wn|dkr�tjd	d
dd�|_
xK|D]C}|j|�}tjd
|�|jj|�t||�q"Wx!|jj�D]}|j�qyWtjd|jj�nWdtjd8_XdS)z[Remove paths in ``self.paths`` with confirmation (unless
        ``auto_confirm`` is True).Nz7Can't uninstall '%s'. No files were found to uninstall.zUninstalling %s:r��yzProceed (y/n)? �nz.Not removing or modifying (outside of prefix):�suffixz
-uninstallrQzpip-zRemoving file or directory %szSuccessfully uninstalled %s)r.r/)r rrr�r$r�r�r)r+rrr�r�rr-rrr�rrr�r�)ror#rrKr~�new_pathrrMrMrNr�s<		
	

zUninstallPathSet.removecCs�|jdkr*tjd|jj�dStjd|jj�x>|jD]3}|j|�}tjd|�t	||�qKWx|j
D]}|j�q�WdS)z1Rollback the changes previously made by remove().Nz'Can't roll back %s; was not uninstalledFzRolling back uninstall of %szReplacing %s)rrr8r$r�r�rr-rrrr7)ror~�tmp_pathrrMrMrNr79szUninstallPathSet.rollbackcCs5|jdk	r1t|j�d|_g|_ndS)z?Remove temporary save dir: rollback will no longer be possible.N)rrr)rorMrMrNr:Fs
	zUninstallPathSet.commitN)r�r�r��__doc__rprr rrr+r-r�r7r:rMrMrMrNr�s	
%
rc@s@eZdZdd�Zdd�Zdd�Zdd�Zd	S)
r$cCsGtjj|�s%td|��n||_t�|_d|_dS)Nz.Cannot remove entries from nonexistent file %s)r}r~r�r
r{r��entries�_saved_lines)ror%rMrMrNrpOs
	zUninstallPthEntries.__init__cCsatjj|�}tjdkrMtjj|�drM|jdd�}n|jj|�dS)Nr
r�\r>)	r}r~rr�rr,r�r4r)ror&rMrMrNrVs&zUninstallPthEntries.addcCs�tjd|j�t|jd�}|j�}||_|j�tdd�|D��rgd}nd}xR|jD]G}y,tjd|�|j	t
||��Wqwtk
r�YqwXqwWt|jd�}|j|�|j�dS)	NzRemoving pth entries from %s:r=css!|]}td�|kVqdS)z
N)r*)rRr�rMrMrNr�gsz-UninstallPthEntries.remove.<locals>.<genexpr>z
rXzRemoving entry: %s�wb)
rrr{r?�	readlinesr5r�rmr4r�r*r��
writelines)ror1�lines�endliner&rMrMrNr�`s"	
	
	
zUninstallPthEntries.removecCsk|jdkr'tjd|j�dStjd|j�t|jd�}|j|j�|j�dS)Nz.Cannot roll back changes to %s, none were madeFz!Rolling %s back to previous stater7T)r5rr8r{rr?r9r�)ror1rMrMrNr7us
zUninstallPthEntries.rollbackN)r�r�r�rprr�r7rMrMrMrNr$Ns
r$c@s:eZdZdZdd�Zdd�Zdd�ZdS)	rzQWrap a list of lines in an object with readline() to make
    ConfigParser happy.cCsdd�|D�|_dS)Ncss|]}|VqdS)NrM)rR�lrMrMrNr��sz$FakeFile.__init__.<locals>.<genexpr>)�_gen)ror:rMrMrNrp�szFakeFile.__init__cCsTy7yt|j�SWntk
r5|jj�SYnXWntk
rOdSYnXdS)Nr�)�nextr=�	NameError�
StopIteration)rorMrMrNr�s

zFakeFile.readlinecCs|jS)N)r=)rorMrMrN�__iter__�szFakeFile.__iter__N)r�r�r�r3rprrArMrMrMrNr�s	r)b�email.parserrr}r"rAr�r�r�r�r�r@�distutils.utilr�
pip.locationsrrrrr�pip.exceptionsr	r
rrr
rr�pip.vcsr�pip.logr�pip.utilrrrrrrrrrrrrrrr r!r"Zpip.backwardcompatr#r$r%r&r'r(r)r*�	pip.indexr+r,�pip.downloadr-r.r/r0r1r2r3r4r5r6r7�	pip.wheelrr8r9r:�pip._vendorr;r<rO�objectrPr�r�r�r��Ir�r�rr
rrqrr$rrMrMrMrN�<module>sT(4p:L���W��N	cA|2