File "req.cpython-34.pyc"

Full Path: /home/attunedd/public_html/byp/izo/con7ext_sym404/rintoar.txt/opt/alt/python34/lib/python3.4/site-packages/pip/__pycache__/req.cpython-34.pyc
File size: 56.38 KB
MIME-type: text/x-bytecode.python
Charset: 8 bit


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
lImKZKmLZLmMZMddlNmOZOmPZPddZQGdddeRZSGdddeRZTGdddeRZUddZVejWdejXZYddddddZZddZ[ddZ\d d!Z]dd"d#Z^Gd$d%d%eRZ_Gd&d'd'eRZ`Gd(d)d)eRZadS)*)
FeedParserN)change_root)bin_pyrunning_under_virtualenvPIP_DELETE_MARKER_FILENAMEwrite_delete_marker_filebin_user)InstallationErrorUninstallationErrorUnsupportedWheelBestVersionAlreadyInstalledInvalidWheelFilenameDistributionNotFoundPreviousBuildDirError)vcs)logger)display_pathrmtreeaskask_path_exists
backup_diris_installable_diris_local
dist_is_localdist_in_usersitedist_in_site_packagesrenamesnormalize_path
egg_link_pathmake_path_relativecall_subprocess
is_prereleasenormalize_name)urlparseurllibuses_pycacheConfigParserstring_types	HTTPErrorget_python_versionb)Link)build_prefix)
PipSessionget_file_contentis_urlurl_to_pathpath_to_urlis_archive_fileunpack_vcs_link
is_vcs_urlis_file_urlunpack_file_urlunpack_http_url)move_wheel_filesWheel	wheel_ext)
pkg_resourcessixcCst|d}|j}WdQXdtjddg}x:|D]2}y|j|}Wntk
rswCYnXPqCWt|tkst|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-8Flatin1)	openreadlocalegetpreferredencodingdecodeUnicodeDecodeErrortypebytesAssertionError)filenamefpdata	encodingsencrM"/tmp/pip-ztkk0jow-build/pip/req.pyread_text_file's	

rOc@skeZdZddddddddddd	ZeddddZedddd	Zd
dZdd
ZdddZ	ddZ
eddZeddZ
eddZdddZdZddZddZdd Zd!d"Zed#d$Zejd%Zfd&d'Zed(d)Zed*d+Zd,d-Zdd.d/Zdd0d1Zd2d3Zd4d5Z d6d7Z!d8d9Z"fddd:d;Z#d<d=Z$fd>d?Z%d@dAZ&dBdCZ'edDdEZ(edFdGZ)dHdIZ*dJdKZ+dddLdMZ,edNdOZ-dS)PInstallRequirementNFTcCsLf|_t|tr9tjj|}|j|_n||_||_||_||_	|	dkrri}	n|	|_
||_||_d|_
d|_d|_d|_d|_||_d|_d|_d|_d|_|
|_||_|rd|_n=|jdk	r?tdd|jjD|_n	d|_dS)NFTcSs0g|]&}t|do)|ddkqS)rz!=)r!).0xrMrMrN
<listcomp>ls	z/InstallRequirement.__init__.<locals>.<listcomp>)extras
isinstancer'r;Requirementparsereq
comes_from
source_direditableeditable_optionsurlas_egg_egg_info_pathsatisfied_byconflicts_with_temp_build_dir
_is_bundleupdateinstall_succeededuninstalled
use_user_site
target_dirfrom_bundle	pycompileprereleasesanyspecs)selfrYrZr[r\r^r_rerlr]rjrkrMrMrN__init__As<																					%zInstallRequirement.__init__c	
Cst||\}}}|jdr6t|}nd}|||d|ddd|d|dd}|dk	r||_n|S)Nzfile:r[r\Tr^r]rl)parse_editable
startswithr0rU)	clseditable_reqrZdefault_vcsnamer^extras_overrider[resrMrMrN
from_editableps	z InstallRequirement.from_editablec	Csd}|j}d}tjjtjj|}d}t|rWt|}ntjj|rtjj|ks|j	drt
|std|ntt|}nFt
|rtjj|stjd|ntt|}n|r|dkr|j}|j}|jdkrstjd|rsttjjtjj|j}n|jtkrt|j}|jstd|jqqn|}|||d|d	|S)
zCreates 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 existfilez\.\./z-%s is not a supported wheel on this platform.r^rl)stripospathnormpathabspathr/r+isdirseprrrr	r1r2isfilerwarnurl_without_fragmentegg_fragmentschemeresearchextr:r9rH	supportedr)	rsrvrZrlr^rYr~linkwheelrMrMrN	from_lines43		!*zInstallRequirement.from_linecCs|jr8t|j}|jrA|d|j7}qAn	|j}|jdk	rm|dt|jj7}n|jrt|jtr|j}n|jj	}|r|d|7}qn|S)Nz from %sz in %sz
 (from %s))
rYstrr^rarlocationrZrVr'	from_path)rosrZrMrMrN__str__s				zInstallRequirement.__str__cCsv|jdkrdSt|j}|jrrt|jtrI|j}n|jj}|rr|d|7}qrn|S)Nz->)rYrrZrVr'r)rorrZrMrMrNrs	zInstallRequirement.from_pathcCs|jdk	r|jS|jdkrJtjdd|_||_|jS|jre|jj}n	|j}tj	j
|st|ntj	j||S)Nz-buildzpip-)
rcrYtempfilemkdtemp_ideal_build_dirr\rvlowerr}r~exists_make_build_dirjoin)ro	build_dirunpackrvrMrMrNbuild_locations			
z!InstallRequirement.build_locationcCs8|jdk	rdS|jdk	s(t|js7t|j}|j}|`|jrj|jj}n	|j}tj	j
||}tj	j|stj
d|t|ntj	j|rtdt|ntj
d|t|t|ftj||||_||_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[rYrGrcrr\rvrr}r~rrrdebugrr	rshutilmover`)roold_location
new_build_dirrvnew_locationrMrMrNcorrect_build_locations0				
			z)InstallRequirement.correct_build_locationcCs|jdkrdS|jjS)N)rYproject_name)rorMrMrNrvszInstallRequirement.namecCs&|jdkrdStj|jjS)N)rYr$quoteunsafe_name)rorMrMrNurl_nameszInstallRequirement.url_namecCsyddl}Wntk
r0tdYnXd}|jrtd|jkrttjj|j|jd|}ntjj|j|}tj	rt
|tjr|jt
j}n|S)NrzBsetuptools must be installed to install from a source distributionzsetup.pysubdirectory)
setuptoolsImportErrorr	r]r}r~rr[r<PY2rV	text_typeencodesysgetfilesystemencoding)ror
setup_filesetup_pyrMrMrNrs

zInstallRequirement.setup_pycCs|jst|jr8tjd|j|jfntjd|j|jftjd7_z>|jdkrtj	j
tj	j|jdrttj	j|jdn|j
}|jdt|j}|jdt|j}tjd	|d
g}|js|r&g}nFtj	j|jd}tj	j|s`tj|nddg}t||d
|jd|jdddtjddWdtjd8_X|jstjjd|j|_|jndS)Nz2Running setup.py (path:%s) egg_info for package %sz7Running setup.py (path:%s) egg_info for package from %s
distributerzdistribute.egg-info__SETUP_PY____PKG_NAME__z-cegg_infozpip-egg-infoz
--egg-basecwd
filter_stdoutshow_stdoutF
command_levelcommand_desczpython setup.py egg_infoz%(Name)s==%(Version)s)r[rGrvrnotifyrr^indentr}r~rrr
_run_setup_pyreplacereprr
executabler\rmakedirsr _filter_install
VERBOSE_DEBUGrYr;rWrXpkg_infor)roforce_root_egg_infoscriptegg_info_cmdegg_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~rrO)rorHrJrMrMrN
egg_info_databsz InstallRequirement.egg_info_datacs|jdkr|jr$|j}ntjj|jd}tj|}|jrg}x
tj|D]\}}x-tj	D]"}||kr|j
|qqWxt|D]}tjjtjj|dds
tjjtjj|ddr|j
|n|dks2|dkr|j
|qqW|j
fdd	|DqjWd
d	|D}n|std||fn|std||ft|dkr|jd
ddntjj||d|_ntjj|j|S)Nzpip-egg-infobinpythonScriptsz
Python.exetesttestscs%g|]}tjj|qSrM)r}r~r)rRdir)rootrMrNrTs	z4InstallRequirement.egg_info_path.<locals>.<listcomp>cSs%g|]}|jdr|qS)z	.egg-info)endswith)rRfrMrMrNrTs	z$No files/directories in %s (from %s)rQkeycSs8|jtjjtjjr3|jtjjp6dS)Nr)countr}r~raltsep)rSrMrMrN<lambda>sz2InstallRequirement.egg_info_path.<locals>.<lambda>r)r`r\r[r}r~rlistdirwalkrdirnamesremovelistrextendr	rGlensort)rorHbase	filenamesdirsfilesrrM)rrNrns6		''z InstallRequirement.egg_info_pathcCso|j|}|sgSg}xI|jD];}|j}|s,|jdrZq,n|j|q,W|S)N#)r
splitlinesr|rrappend)rorHrJresultlinerMrMrNegg_info_linessz!InstallRequirement.egg_info_linescCs^t}|jd}|sAtjdt|jdn|j|pPd|jS)NzPKG-INFOzNo PKG-INFO file found in %s)rrrrrrfeedclose)roprJrMrMrNrs	#zInstallRequirement.pkg_infocCs
|jdS)Nzdependency_links.txt)r)rorMrMrNdependency_linkssz#InstallRequirement.dependency_linksz	\[(.*?)\]ccsd}xx|jdD]g}|jj|j}|rO|jd}qn|rx||krxtjd|qn|VqWdS)Nzrequires.txtrQzskipping extra %s)r_requirements_section_rematchrgrouprr)rorUin_extrarrrMrMrNrequirementsszInstallRequirement.requirementsccs5x.|jjD] \}}|dkr
|Vq
q
WdS)Nz==)rYrn)ro	qualifierversionrMrMrNabsolute_versionssz$InstallRequirement.absolute_versionscCs|jdS)Nr)r)rorMrMrNinstalled_versionsz$InstallRequirement.installed_versioncCsk|jst|j}||jkrDtjd||jfn#tjdt|j||fdS)Nz'Requested %s, but installing version %sz;Source in %s has version %s, which satisfies requirement %s)r[rGrrYrrrr)rorrMrMrNassert_source_matches_versions		z0InstallRequirement.assert_source_matches_versioncCs|js!tjd|jdS|js0t|js?t|jjdrUdSd|jkswtd|j|jsdS|jjdd\}}t	j
|}|r||j}|r|j|jq|j|jndstd|j|fdS)Nz>Cannot update repository at %s; repository location is unknownzfile:+zbad url: %rrQrz+Unexpected version control type (in %s): %s)
r^rinfor[r\rGrrresplitrget_backendobtainexport)rorvc_typer^backendvcs_backendrMrMrNupdate_editables(	"		z"InstallRequirement.update_editablecsd|js%td|jfn|jp4|j}t|}tjj|j	|j
d}tjj|j	dj|j
jdddd}|jdt
jd}|j
d	}t|}tjj|}	tjj|}
tjj|}|	s|
rR|	r)|}n|}|j||jd
rx|jd
jD]4}
tjjtjj||
}|j|qaWq|jdr|jdr|jdngxzfd
d|jdjDD]M}tjj|j	|}|j||j|d|j|dqWqn?|j	j|r|j|j	tjjtjj|j	d}|j|d|n|r^t|d}tjj|jj}|j||j	kstd||j|j	f|j|tjjtjj|d}|j||j	n3|rx*tj j!|D]}|j|qwWn|jdr5|j"dr5x|j#dD]o}t$|rt%}nt&}|jtjj||t'j(dkr|jtjj||dqqWn|jdrJt)j*}|j+t,|j-d|j.drJx|j/dD]\}}t$|rt%}nt&}|jtjj||t'j(dkr|jtjj||d|jtjj||d|jtjj||dqqWqJn|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-Nrz
.dist-infoz-py%srz.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)scriptswin32z.batzentry_points.txtconsole_scriptsz.exez
.exe.manifestz
-script.py)2check_if_existsr
rvrarbUninstallPathSetr}r~rregg_namerrr;PY_MAJORrraddrrrrrdirnameadd_pthr?normcasereadliner|rrGpipruninstallation_pathsmetadata_isdirmetadata_listdirrrrrplatformr&SafeConfigParserreadfpFakeFileget_metadata_lineshas_sectionitemsrrg)roauto_confirmdistpaths_to_removepip_egg_info_pathdist_info_pathdebian_egg_info_patheasy_install_eggdevelop_egg_linkpip_egg_info_existsdebian_egg_info_existsdist_info_existsrinstalled_filer~
top_level_pkgeasy_install_pthfhlink_pointerrbin_dirconfigrvvaluerM)r
rN	uninstalls
(	
!
	
.
		*	  -
zInstallRequirement.uninstallcCs4|jr|jjntjd|jfdS)Nz'Can't rollback %s, nothing uninstalled.)rgrollbackrerrorr)rorMrMrNrollback_uninstallYs		z%InstallRequirement.rollback_uninstallcCs4|jr|jjntjd|jfdS)Nz%Can't commit %s, nothing uninstalled.)rgcommitrr8r)rorMrMrNcommit_uninstall`s		z#InstallRequirement.commit_uninstallcCs|jstd}d|j|jf}tjj||}tjj|rtdt	|d}|dkrd}q|dkrt
jdt	|tj|q|dkrt
|}t
jd	t	|t	|ftj||qn|rtj|dtj}tjjtjj|j}xtj|D]\}	}
}d
|
kr~|
jd
nxl|
D]d}tjj|	|}|j||}
tj|jd|
d}d|_|j|dqWxb|D]Z}|tkrqntjj|	|}|j||}
|j||jd|
qWqSW|jt
jd8_t
jdt	|ndS)NTz	%s-%s.zipz/The file %s exists. (i)gnore, (w)ipe, (b)ackup iwr*FzDeleting %szBacking up %s to %szpip-egg-info/irrzSaved %s)r<r=r*i)r[rGrvrr}r~rrrrrrrrrrzipfileZipFileZIP_DEFLATEDrrr_clean_zip_nameZipInfo
external_attrwritestrrwriterrr)rorcreate_archivearchive_namearchive_pathresponse	dest_fileziprdirpathrrrrvzipdirrHrMrMrNarchivegsN		!
	
#
zInstallRequirement.archivecCse|j|tjjs/td||f|t|dd}|jtjjd}|S)Nz$name %r doesn't start with prefix %rrQr>)rrr}r~rrGrr)rorvprefixrMrMrNrCs
z"InstallRequirement._clean_zip_namecs|jr|j||dS|jrztjj|j}tjj||j|j	|jdd|d|_
dStjdd}t
jj|d}ztjg}|jd|jd|j|t|d	d
|g7}|js|dg7}ndk	r&|dg7}n|jr?|d
g7}n
|dg7}tr|dt
jjtjdddtg7}ntjd|jtjd7_z*t||d|jd|jddWdtjd8_Xt
jj|stjd|dSd|_
|jr$dSfdd}	t |}
xN|
D]1}|j!}|j"drI|	|}PqIqIWtj#d|dS|
j$g}
t |}
x[|
D]S}|j!}t
jj%|r|t
jj&7}n|
jt'|	||qW|
j$t t
jj|dd}
|
j(d j|
d |
j$Wdt
jj|rt
j)|nt
j*|XdS)!Nrstrip_file_prefixTz-recordzpip-zinstall-record.txtz-czimport 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-headersincludesiterzRunning setup.py install for %srrrrFzRecord file %s not foundcs4dkstjj|r#|St|SdS)N)r}r~isabsr)r~)rrMrNprepend_rootsz0InstallRequirement.install.<locals>.prepend_rootz	.egg-infoz;Could not find .egg-info directory in install record for %szinstalled-files.txtr=
)+r\install_editableis_wheelrr
wheel_versionr[check_compatibilityrvr8rfrrr}r~rrrrrrr_rkrrQr)rrrr rrr?r|rrrrrrrGrrmdir)roinstall_optionsglobal_optionsrrRr
temp_locationrecord_filenameinstall_argsrWrrr	new_linesrHrM)rrNrSs				
		
	
		


 
zInstallRequirement.installcCs|jstjj|jrWtjd|j|jrKt|jnd|_n|j	rtjj|j	rt|j	nd|_	dS)zVRemove the source files from this requirement, if they are marked
        for deletionzRemoving source in %sN)
	is_bundler}r~rdelete_marker_filenamerrr[rrc)rorMrMrNremove_temporary_sources	z*InstallRequirement.remove_temporary_sourcecCstjd|jtjd7_zWttjdd|jgt|ddgt|d|j	d|j
d	d
Wdtjd8_Xd|_dS)NzRunning setup.py develop for %srz-czimport setuptools, tokenize; __file__=%r; exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))developz	--no-depsrrrFT)rrrvrr rrrrr[rrf)ror^r_rMrMrNrYs7z#InstallRequirement.install_editablecCsatj}xKddddddddgD]+}tj||jr(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$)rNOTIFYrrr|INFO)rorlevelregexrMrMrNrs	
	z"InstallRequirement._filter_installcCs|jdkrdSyJ|jjdkrG|jrG|jjdkrGdStj|j|_Wntjk
rxdSYntjk
rtj|jj}|jrt	|r||_qt
rt|rtd|j|j
fqn	||_YnXdS)zFind an installed distribution that satisfies or conflicts
        with this requirement, and set self.satisfied_by or
        self.conflicts_with appropriately.NFrrTzVWill not install to the user site because it will lack sys.path precedence to %s in %s)rYrrbr;get_distributionrarVersionConflictrhrrrr	r)ro
existing_distrMrMrNrs(		z"InstallRequirement.check_if_existscCs|jod|jkS)Nz.whl)r^)rorMrMrNrZ=szInstallRequirement.is_wheelcCsu|jdk	r|jS|j}|s)dStjjtjj|dphtjjtjj|d|_|jS)NFzpip-manifest.txtzpyinstall-manifest.txt)rdrcr}r~rr)rorrMrMrNrdAs	!$zInstallRequirement.is_bundlec
csGx|jD]}tjj|}xtjD]}d}}tjj||j}tjj|r,|j	}t
|}|j}	|j|j
|	\}}Pq,q,W|rd|||f}nd}t||ddd|ddd|ddVq
Wx=|jD]2}tjj|}t||d|ddVq
WdS)	Nz%s+%s@%sr\Tr^reFr[rj)_bundle_editable_dirsr}r~basenamerbackendsrbundle_filerrvr?r@rparse_vcs_bundle_filerP_bundle_build_dirs)
rodest_dirpackagerr^revvcs_bundle_filerrIcontentrMrMrNbundle_requirementsMs,
		
z&InstallRequirement.bundle_requirementsc
Cs|j}|sttjj|d}tjj|d}g}g}x#|||f|||fgD]\}}	}
tjj|rjxtj|D]}tjj|	|}|
j|tjj|rtj	d|||fqntjj|	s(tj
d|	tj|	ntj
tjj|||qWtj|smtj|qmqjqjWd|_||_||_dS)NsrcbuildzZThe directory %s (containing package %s) already exists; cannot move source from bundle %szCreating directory %s)rcrGr}r~rrrrrrrrrrr]rtro)
rodest_build_dirdest_src_dirrsrc_dirrbundle_build_dirsbundle_editable_dirsr[rudir_collectionrdestrMrMrNmove_bundle_filesgs4	
	#		z$InstallRequirement.move_bundle_filescCsAt|j|j|d|jd|jd|d|jd|dS)NuserhomerrkrR)r8rvrYrhrirk)rowheeldirrrRrMrMrNr8s			z#InstallRequirement.move_wheel_filescCs%|jsttjj|jtS)N)r[rGr}r~rr)rorMrMrNresz)InstallRequirement.delete_marker_filename).__name__
__module____qualname__rpclassmethodryrrrrrpropertyrvrrrrrrrrrrcompilerrrrrrr6r9r;rPrCrSrfrYrrrZrdrzrr8rerMrMrMrNrP?sV-*
?*
	n)]!
rPc@sdeZdZddZddZddZddZd	d
ZddZd
dZ	dS)RequirementscCsg|_i|_dS)N)_keys_dict)rorMrMrNrps	zRequirements.__init__cCs|jS)N)r)rorMrMrNkeysszRequirements.keyscsfddjDS)Ncsg|]}j|qSrM)r)rRr)rorMrNrTs	z'Requirements.values.<locals>.<listcomp>)r)rorM)rorNvaluesszRequirements.valuescCs
||jkS)N)r)roitemrMrMrN__contains__szRequirements.__contains__cCs3||jkr"|jj|n||j|<dS)N)rrr)rorr5rMrMrN__setitem__szRequirements.__setitem__cCs|j|S)N)r)rorrMrMrN__getitem__szRequirements.__getitem__cs0fddjD}ddj|S)Ncs0g|]&}dt|t|fqS)z%s: %s)r)rRk)rorMrNrTs	z)Requirements.__repr__.<locals>.<listcomp>zRequirements({%s})z, )rr)rorrM)rorN__repr__szRequirements.__repr__N)
rrrrprrrrrrrMrMrMrNrsrc
@sBeZdZdddddddddddddZddZdd	Zd
dZedd
ZeddZ	eddZ
ddZdddZddZ
ddddZdddZddZddZddd d!Zfd"d#Zd$d%Zd&Zd'd(Zd)d*ZdS)+RequirementSetNFTcCs||_||_||_|r6tjj|}n||_||_||_|
|_	t
|_i|_g|_
|	|_g|_g|_g|_||_||_||_|pt|_|
|_||_dS)N)rrdownload_dirr}r~
expanduserdownload_cacheupgradeignore_installedforce_reinstallrrrequirement_aliasesunnamed_requirementsignore_dependenciessuccessfully_downloadedsuccessfully_installedreqs_to_cleanupr_rhrir-sessionrkwheel_download_dir)rorrrrrrr_rirrrhrrkrrMrMrNrps,																	zRequirementSet.__init__cCsLdd|jjD}|jddddjdd|DS)NcSsg|]}|js|qSrM)rZ)rRrYrMrMrNrTs	z*RequirementSet.__str__.<locals>.<listcomp>rcSs
|jjS)N)rvr)rYrMrMrNrsz(RequirementSet.__str__.<locals>.<lambda> cSsg|]}t|jqSrM)rrY)rRrYrMrMrNrTs	)rrrr)roreqsrMrMrNrszRequirementSet.__str__cCs|j}|j|_|j|_|j|_|j|_|sR|jj|ni|j|rtd||j	||fn||j
|<|j|kr||j|j<ndS)Nz5Double requirement given: %s (already in %s, name=%r))
rvr_rhrirkrrhas_requirementr	get_requirementrrr)roinstall_reqrvrMrMrNadd_requirements	
zRequirementSet.add_requirementcCsCx<||jfD](}||jks7||jkrdSqWdS)NTF)rrr)rorrvrMrMrNrszRequirementSet.has_requirementcCst|jjp|jS)N)rrrr)rorMrMrNhas_requirementsszRequirementSet.has_requirementscCsJtdd|jjDr&dStdd|jDrFdSdS)Ncss|]}|jVqdS)N)r\)rRrYrMrMrN	<genexpr>sz/RequirementSet.has_editables.<locals>.<genexpr>Tcss|]}|jVqdS)N)r\)rRrYrMrMrNrsF)rmrrr)rorMrMrN
has_editabless
"zRequirementSet.has_editablescCsg|jrctjj|j|_tjj|jr:dStjdtdt|jndS)NTz!Could not find download directoryz0Could not find or access download directory '%s'F)	rr}r~rrrfatalr	r)rorMrMrNis_downloads	
zRequirementSet.is_downloadcCslxU||jfD]A}||jkr3|j|S||jkr|j|j|SqWtd|dS)NzNo project with the name %r)rrrKeyError)rorrvrMrMrNrszRequirementSet.get_requirementcCs8x1|jjD] }|jd||jqWdS)Nr#)rrr6r;)ror#rYrMrMrNr6szRequirementSet.uninstallcCst|j}t|jj}xc|s3|r|rK|jd}n|jd}d}|jr|jr|j|jr|j	r|j
ot|js|j|_nd|_qd}n|jrt
jd|qn|jr |jdkrE|j|j|_qEn%|rE|j|j|j|_n|jdk	r'tjj|jr'td||jfq'q'WdS)NrTFz<Requirement already satisfied (use --upgrade to upgrade): %szCould 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?))rrrrpoprr\rrarrhrrbrrr[rrrrr}r~rr	)rounnamedrreq_to_installinstall_neededrMrMrNlocate_filess4
						%zRequirementSet.locate_filesc(Cst|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
rd}d}Yqtk
r
tjd}	YqX|
j|_n|s]|jo6t|jsH|j|_nd|_q]q`d}n|jr|rtjd|qtjd|qn|jrtjd|n^|r|jr|jjjd	rtjd
tt|jqtjd|ntjd7_zld}d}|jr|jdkri|j|j}
|
|_n	|j}
tjj |j!st"|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||
fn|jdkr|	rs|	n|j|d|j	}
nt-|j}
|
st.|
rcyY|
j/j0t1r|j2r|j2}d}n|j'}|j$}|j3|
|
||Wqit4k
r_}z5tj5d||ft6d|||
fWYdd}~XqiXnd}|r1|j7}|
o|
j/j0t1}|r|j8|j!|jx|j9D] }|j:||j;|qWn|j$r3|
|_|s|j%n|
r|
j<t=j>kr|j&|j'qny|rQ|
|_|
j|_n[|
|_|j%|r}|j%ddn|j?|r|jr|j@|d}n|js|jn|jr.|j	s|jr|jot|js|j|_nd|_q+tjd|d}q.q1n|rttAjB|
d}|jCsx|jD|_C|j;|n|jEsxd|jF|jGD]M}|jH|jIrqntJtK||}|j:||j;|qWqn&|s|jL|jM|jGr*tjddj)|jGn|jEsx|j|jGD]}ytAjNjO|jI}Wn?tPk
rtjd}tjQd|||fwFYnX|jH|rqFntJ||}|j:||j;|qFWn|jH|jRs|j;|qn|sE|j$s/|jSdk	rE|jTj:|qEn|r|jUj:||r|jr|jjdr|j@|qnWdtjd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 %srzsetup.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.
                        rz4Could not install requirement %s because of error %szDCould not install requirement %s because of HTTP error %s for URL %srz!Installing extra requirements: %r,z.Invalid requirement: %r (%s) in requirement %szfile:///)Vrrrrrrr\rrarrr^find_requirementrrrexc_inforhrrbrrrrrrr0rr[rrr}r~rrrrrrrPrrjrrtextwrapdedentr+rGrHrr:r
unpack_urlr(rr	rdrrzrrrrall_schemesrcopy_to_build_dirr;find_distributionsrYas_requirementrrequiresrUrrrPradd_dependency_linksrrWrX
ValueErrorr8rvrcrr)rofinderrbundlerrrrSbest_installed	not_foundr^rdrZrrrdo_downloadexcesubreqr$rYrvrMrMrN
prepare_files:sV
		


					!#			

	!								)	
		
		


		
					
	 	

	!zRequirementSet.prepare_filescCstjdtjd7_x|jD]}|jq&Wg}|jr_|j|jn|rx|j|jnx>|D]6}t	j
j|rtjd|t
|qqWtjd8_dS)zClean up files, remove builds.zCleaning up...rzRemoving temporary dir %s...N)rrrrrf_pip_has_created_build_dirrrrr}r~rrr)rorrY
remove_dirrrMrMrN
cleanup_files's

zRequirementSet.cleanup_filescCs1|jtko0tjjtjj|jtS)N)rr,r}r~rrr)rorMrMrNr>sz)RequirementSet._pip_has_created_build_dircCs|jr|jp|j}tjd|j|ftjj||j}t	j
|j|tdd|dgd|dddS)NzCopying %s to %srz%s/setup.pycleanrrzpython setup.py clean)
r\rrrrrvr}r~rrcopytreer[r )rorrirrMrMrNrBsz RequirementSet.copy_to_build_dircCs|dkr|j}nt|rL|r3|}n|}t|||nat|r~t||||rt|qn/t|||j||j|rt|ndS)N)	rr4r3r5r6rr7rr)rorrr
only_downloadlocrMrMrNrJs&	
zRequirementSet.unpack_urlc"Osdd|jjD}tjjd}xI|D]A}|jdkr5|j|kr5|j||j|q5q5W|rt	j
ddjdd|Dnt	jd7_zCx<|D]4}|jd	kr0y=tjjd
}	tj
d}
|
|	kr|
|_nWq0tjk
r,Yq0Xn|jrt	j
d|jt	jd7_z|jdd
Wdt	jd8_Xny|j||||Wn+|jr|jr|jnYn X|jr|jr|jn|jqWWdt	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.7rz!Installing collected packages: %sz, cSsg|]}|jqSrM)rv)rRrYrMrMrNrT{s	rrzdistribute<0.7zFound existing installation: %sr#TN)rrr;rWrXrvrrrrrrrrlrbrr6rSrfr9r;rfr)ror^r_argskwargs
to_installdistribute_reqrYrequirementdistribute_requirementexisting_distributerMrMrNrSisJ	

*
		

zRequirementSet.installcCstj|dtj}g}xJ|jdf|jdffD]*\}}tjjtjj|}xtj	|D]\}}}xt
jD]}	|	}
d}}|
j|krxR|D]}
|j
|
rPqqW|
jtjj||\}}|j||
j}|
ji|d6|d6}|j|
jPqqWd|kre|jdnxQ|D]I}tjj||}|j||}|j|d|ddqlWx_|D]W}|tkrqntjj||}|j||}|j||d|qW|rwtjj||}|j||}|j|d||qwqwWq=W|jd	|j|jdS)
Nr=r|r{r^rwzpip-egg-infor>rzpip-manifest.txt)r@rArBrrr}r~rrrrrqrrrget_inforrrrguiderrCrFrrGrzr)robundle_filenamerMvcs_dirsrrprNrrrrvcs_urlvcs_revvcs_dirrx	vcs_guiderrvrHrMrMrN
create_bundlesL+	


	
 
#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|jjDD]#}|jd|j|jfq)W|jdxAdd|jjDD]#}|jd|j|jfqzWdj|S)NcSsg|]}|js|qSrM)rZ)rRrYrMrMrNrTs	z6RequirementSet.bundle_requirements.<locals>.<listcomp>z%s==%s
zC# These packages were installed to satisfy the above requirements:
cSsg|]}|jr|qSrM)rZ)rRrYrMrMrNrTs	r)
BUNDLE_HEADERrrrrvrr)ropartsrYrMrMrNrzs#!
#!z"RequirementSet.bundle_requirementscCse|j|tjjs/td||f|t|dd}|jtjjd}|S)Nz$name %r doesn't start with prefix %rrQr>)rrr}r~rrGrr)rorvrQrMrMrNrCs
zRequirementSet._clean_zip_name)rrrrprrrrrrrrr6rrrrrrrSrrrzrCrMrMrMrNrs2		
'E7rcCstj|t|dS)N)r}rr)rrMrMrNrs
rz^(http|https|file):c
cs|dkrt}nd}|r-|jnd}|rKtj|}ntjjtjj|}t|d|d|\}}xzt	|j
D]f\}	}
|	d7}	|
j}
tjdd|
}
|
s|
j
drqn|r|j|
rqn|
j
ds&|
j
dr|
j
drN|
d	dj}n%|
tddjjd
}tj|rtj||}n3tj|stjjtjj||}nx3t||d|d|d|D]}|VqWq|
j
ds|
j
d
rq|
j
ds=|
j
dr|
j
dre|
d	dj}
n%|
tddjjd
}
tjj||
}
tjj|
r|
}
n|r|jj|
qq|
j
ds|
j
drY|
j
dr|
d	dj}
n%|
tddjjd
}
|r|
g|_qq|
j
dr|
tddjjd
}
|r|jj|
qq|
j
drd|_q|
j
drg|_q|
j
dr:|
tddjjd
}
|jtt|
jgO_q|
j
drUd|_q|
j
drgq|
j
dryq|
j
dr|
tddjjd
}
|j tt|
jgO_ q|
j
dr/|
tddjjd
}
|j tt|
jgO_ qd||	f}|
j
ds]|
j
dr|
j
dr|
d	dj}
n%|
tddjjd
}
t!j"|
d|d|r|j#nd}n$t!j$|
|d t%|d!d}|VqWdS)"NrZrrQz
(^|\s)#.*$rrz-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
--editablerurlpre)&r-skip_requirements_regexrrr}r~rrr.	enumeraterr|subrrrr
_scheme_rer#urljoinrparse_requirementslstripr
find_linksr
index_urls	use_wheelallow_externalsetr"rallow_all_externalallow_unverifiedrPryrurgetattr)rHrrZrr
skip_match
skip_regex
reqs_file_dirryline_numberrreq_urlrrelative_to_reqs_filerYrMrMrNrs	
%$(%	%%%'%'%'%'$rcCs.tjd|}|r*|jd}n|S)z2
        Strip req postfix ( -dev, 0.2, etc )
    z^(.*?)(?:-dev|-\d.*)$rQ)rrr)rYrrMrMrN_strip_postfixgsrcCspdd|jdddjdD}d}|ddkrO|d}n|dd
krl|d}n|S)NcSsg|]}|r|qSrMrM)rRrrMrMrNrTts	z'_build_req_from_url.<locals>.<listcomp>rrQrr>rtagsbranchestagbranchtrunk)ztagszbranchesztagzbranchr)r)r^rrYrMrMrN_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)rrfindalldict	Exception)rYregexpmatchedretoptionrvr5rMrMrN_build_editable_options}s	
rc
Csm|}d}tjd|}|rE|jd}|jd}n|}tjj|rtjjtjj|dstd|nt	|}n|j
jdr|rd|tj
jd|jfSd|dfSnx;tD]3}|j
jd	|rd
||f}PqqWd|kr_|rL|d|}q_td|n|jddd
j
}tj|sd|djddtjDd}t|nyt|}	Wn8tk
rtjd}
td||
fYnX|	s"d|	krJt|}|sTtd|qTn
|	d}t|}|||	fS)zSParses svn+http://blahblah@rev#egg=Foobar into a requirement
    (Foobar) and a URLNz^(.+)(\[[^\]]+\])$rQrzsetup.pyz;Directory %r is not installable. File 'setup.py' not found.zfile:__placeholder__z%s:z%s+%srzb%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|]}|jdqS)z+URL)rv)rRrrMrMrNrTs	z"parse_editable.<locals>.<listcomp>z is currently supportedz*--editable=%s error in editable options:%seggz@--editable=%s is not the right format; it must have #egg=Package)rrrr}r~rrrr	r1rrrr;rWrXrUrrrrqrr
rrr
r)
rtrur^rUm
url_no_extrasversion_controlr
error_messagermessagerYrvrMrMrNrqsT! 
$

rqc@seZdZdZddZddZddZdd	Zd
dZdd
Z	ddZ
dddZddZddZ
dS)rzMA set of file paths to be removed in the uninstallation of a
    requirement.cCs@t|_t|_i|_||_d|_g|_dS)N)rpaths_refusepthr$save_dir_moved_paths)ror$rMrMrNrps			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
_permittedszUninstallPathSet._permittedcCsFt|jsBtjd|jjt|jjtjfdSdS)Nz1Not uninstalling %s at %s, outside environment %sFT)	rr$rrrrrrrQ)rorMrMrN_can_uninstalls
	&zUninstallPathSet._can_uninstallcCst|}tjj|s"dS|j|rD|jj|n|jj|tjj|ddkrt	r|jt
j|ndS)NrQz.py)rr}r~rrrrrsplitextr%impcache_from_source)ror~rMrMrNrs"zUninstallPathSet.addcCskt|}|j|rW||jkr@t||j|<n|j|j|n|jj|dS)N)rrrUninstallPthEntriesrr)ropth_fileentryrMrMrNrszUninstallPathSet.add_pthcsYt}xIt|dtD]5tfdd|Ds|jqqW|S)zCompact 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.rcsJg|]@}j|oCt|jtjjtjjkqSrM)rrrrstripr}r~r)rR	shortpath)r~rMrNrT
s	z,UninstallPathSet.compact.<locals>.<listcomp>)rsortedrrmr)rorshort_pathsrM)r~rNcompacts	
zUninstallPathSet.compactcCs5tjj|jtjj|djtjjS)NrQ)r}r~rr
splitdriverr)ror~rMrMrN_stashs	zUninstallPathSet._stashFcCs|jsdS|js4tjd|jjdStjd|jjtjd7_t|j|j}z6|rd}n-x|D]}tj|qWt	dd}|j
rtjdx*|j|j
D]}tj|qWn|dkrtjd	d
dd|_
xK|D]C}|j|}tjd
||jj|t||q"Wx!|jjD]}|jqyWtjd|jjnWdtjd8_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:ryzProceed (y/n)? nz.Not removing or modifying (outside of prefix):suffixz
-uninstallrQzpip-zRemoving file or directory %szSuccessfully uninstalled %s)r.r/)r rrrr$rrr)r+rrrrrr-rrrrrrr)ror#rrKr~new_pathrrMrMrNrs<		
	

zUninstallPathSet.removecCs|jdkr*tjd|jjdStjd|jjx>|jD]3}|j|}tjd|t	||qKWx|j
D]}|jqWdS)z1Rollback the changes previously made by remove().Nz'Can't roll back %s; was not uninstalledFzRolling back uninstall of %szReplacing %s)rrr8r$rrrr-rrrr7)ror~tmp_pathrrMrMrNr79szUninstallPathSet.rollbackcCs5|jdk	r1t|jd|_g|_ndS)z?Remove temporary save dir: rollback will no longer be possible.N)rrr)rorMrMrNr:Fs
	zUninstallPathSet.commitN)rrr__doc__rprr rrr+r-rr7r:rMrMrMrNrs	
%
rc@s@eZdZddZddZddZddZd	S)
r$cCsGtjj|s%td|n||_t|_d|_dS)Nz.Cannot remove entries from nonexistent file %s)r}r~rr
r{rentries_saved_lines)ror%rMrMrNrpOs
	zUninstallPthEntries.__init__cCsatjj|}tjdkrMtjj|drM|jdd}n|jj|dS)Nr
r\r>)	r}r~rrrr,rr4r)ror&rMrMrNrVs&zUninstallPthEntries.addcCstjd|jt|jd}|j}||_|jtdd|Drgd}nd}xR|jD]G}y,tjd||j	t
||Wqwtk
rYqwXqwWt|jd}|j||jdS)	NzRemoving pth entries from %s:r=css!|]}td|kVqdS)z
N)r*)rRrrMrMrNrgsz-UninstallPthEntries.remove.<locals>.<genexpr>z
rXzRemoving entry: %swb)
rrr{r?	readlinesr5rrmr4rr*r
writelines)ror1linesendliner&rMrMrNr`s"	
	
	
zUninstallPthEntries.removecCsk|jdkr'tjd|jdStjd|jt|jd}|j|j|jdS)Nz.Cannot roll back changes to %s, none were madeFz!Rolling %s back to previous stater7T)r5rr8r{rr?r9r)ror1rMrMrNr7us
zUninstallPthEntries.rollbackN)rrrrprrr7rMrMrMrNr$Ns
r$c@s:eZdZdZddZddZddZdS)	rzQWrap a list of lines in an object with readline() to make
    ConfigParser happy.cCsdd|D|_dS)Ncss|]}|VqdS)NrM)rRlrMrMrNrsz$FakeFile.__init__.<locals>.<genexpr>)_gen)ror:rMrMrNrpszFakeFile.__init__cCsTy7yt|jSWntk
r5|jjSYnXWntk
rOdSYnXdS)Nr)nextr=	NameError
StopIteration)rorMrMrNrs

zFakeFile.readlinecCs|jS)N)r=)rorMrMrN__iter__szFakeFile.__iter__N)rrrr3rprrArMrMrMrNrs	r)bemail.parserrr}r"rArrrrrr@distutils.utilr
pip.locationsrrrrrpip.exceptionsr	r
rrr
rrpip.vcsrpip.logrpip.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<rOobjectrPrrrrIrrrr
rrqrr$rrMrMrMrN<module>sT(4p:LWN	cA|2