Current File : //lib/python2.7/site-packages/pip/req/req_set.pyo
�
��abc@@sddlmZddlmZddlmZddlZddlZddlm Z ddlm
Z
ddlmZddl
mZmZmZmZmZdd lmZmZmZmZmZmZmZmZmZmZdd
lmZddl m!Z!m"Z"m#Z#m$Z$ddl%m&Z&dd
l'm(Z(ddl)m*Z*ddl+m,Z,ddl-m.Z.ej/e0�Z1de2fd��YZ3de2fd��YZ4d�Z5de4fd��YZ6de4fd��YZ7de4fd��YZ8de2fd��YZ9dS(i(tabsolute_import(tdefaultdict(tchainN(t
pkg_resources(trequests(t
expanduser(tis_file_urlt
is_dir_urlt
is_vcs_urlturl_to_patht
unpack_url(
tInstallationErrortBestVersionAlreadyInstalledtDistributionNotFoundtPreviousBuildDirErrort HashErrort
HashErrorstHashUnpinnedtDirectoryUrlHashUnsupportedtVcsHashUnsupportedtUnsupportedPythonVersion(tInstallRequirement(tdisplay_pathtdist_in_usersitet
ensure_dirtnormalize_path(t
MissingHashes(t
indent_log(tcheck_dist_requires_python(tvcs(tWheeltRequirementscB@sGeZd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(cC@sg|_i|_dS(N(t_keyst_dict(tself((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pyt__init__!s cC@s|jS(N(R (R"((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pytkeys%scC@s!g|jD]}|j|^q
S(N(R R!(R"tkey((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pytvalues(scC@s
||jkS(N(R (R"titem((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pyt__contains__+scC@s3||jkr"|jj|�n||j|<dS(N(R tappendR!(R"R%tvalue((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pyt__setitem__.scC@s|j|S(N(R!(R"R%((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pyt__getitem__3scC@sJg|j�D]&}dt|�t||�f^q
}ddj|�S(Ns%s: %ssRequirements({%s})s, (R$treprtjoin(R"tkR&((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pyt__repr__6s9( t__name__t
__module__R#R$R&R(R+R,R0(((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pyRs tDistAbstractioncB@s)eZdZd�Zd�Zd�ZRS(stAbstracts out the wheel vs non-wheel prepare_files logic.
The requirements for anything installable are as follows:
- we must be able to determine the requirement name
(or we can't correctly handle the non-upgrade case).
- we must be able to generate a list of run-time dependencies
without installing any additional packages (or we would
have to either burn time by doing temporary isolated installs
or alternatively violate pips 'don't start installing unless
all requirements are available' rule - neither of which are
desirable).
- for packages with setup requirements, we must also be able
to determine their requirements without installing additional
packages (for the same reason as run-time dependencies)
- we must be able to create a Distribution object exposing the
above metadata.
cC@s
||_dS(N(treq_to_install(R"R4((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pyR#NscC@st|j��dS(s Return a setuptools Dist object.N(tNotImplementedErrortdist(R"tfinder((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pyR6QscC@st|j��dS(s3Ensure that we can get a Dist for this requirement.N(R5R6(R"((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pyt
prep_for_distUs(R1R2t__doc__R#R6R8(((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pyR3;s cC@s@|jrt|�S|jr2|jjr2t|�St|�SdS(s�Factory to make an abstract dist object.
Preconditions: Either an editable req with a source_dir, or satisfied_by or
a wheel link, or a non-editable req with a source_dir.
:return: A concrete DistAbstraction.
N(teditabletIsSDisttlinktis_wheeltIsWheel(R4((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pytmake_abstract_distZs
R>cB@seZd�Zd�ZRS(cC@sttj|jj��dS(Ni(tlistRtfind_distributionsR4t
source_dir(R"R7((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pyR6ls cC@sdS(N((R"((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pyR8ps(R1R2R6R8(((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pyR>js R;cB@seZd�Zd�ZRS(cC@s;|jj�}|jd�r7|j|jd��n|S(Nsdependency_links.txt(R4tget_distthas_metadatatadd_dependency_linkstget_metadata_lines(R"R7R6((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pyR6ws
cC@s|jj�|jj�dS(N(R4trun_egg_infotassert_source_matches_version(R"((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pyR8�s
(R1R2R6R8(((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pyR;us t InstalledcB@seZd�Zd�ZRS(cC@s
|jjS(N(R4tsatisfied_by(R"R7((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pyR6�scC@sdS(N((R"((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pyR8�s(R1R2R6R8(((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pyRI�s tRequirementSetcB@s�eZeeeeeeeeeeeeeeed�Zd�Zd�Zeed�Zd�Z e
d��Ze
d��Zd�Z
ed�Zd �Zd
�Zd�Zeed�Zd
�Zd�Zfd�ZRS(cC@s|dkrtd��n||_||_||_||_||_||_|
|_t �|_
i|_g|_| |_
||_g|_g|_g|_||_||_||_||_|
|_||_|r�t|�}n||_||_||_tt�|_dS(s3Create a RequirementSet.
:param wheel_download_dir: Where still-packed .whl files should be
written to. If None they are written to the download_dir parameter.
Separate to download_dir to permit only keeping wheel archives for
pip wheel.
:param download_dir: Where still packed archives should be written to.
If None they are not saved, and are deleted immediately after
unpacking.
:param wheel_cache: The pip wheel cache, for passing to
InstallRequirement.
s?RequirementSet() missing 1 required keyword argument: 'session'N(tNonet TypeErrort build_dirtsrc_dirtdownload_dirtupgradetupgrade_strategytignore_installedtforce_reinstallRtrequirementstrequirement_aliasestunnamed_requirementstignore_dependenciestignore_requires_pythontsuccessfully_downloadedtsuccessfully_installedtreqs_to_cleanuptas_eggt
use_user_sitet
target_dirtsessiont pycompiletisolatedRtwheel_download_dirt_wheel_cachetrequire_hashesRR@t
_dependencies(R"RNRORPRQRRRSR]R_RXRTR^R`RaRbRctwheel_cacheReRY((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pyR#�s< cC@sgg|jj�D]}|js|^q}|jdd��djg|D]}t|j�^qK�S(NR%cS@s
|jj�S(N(tnametlower(treq((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pyt<lambda>�tt (RUR&t
comes_fromtsortR.tstrRj(R"Rjtreqs((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pyt__str__�scC@s}g|jj�D]}|^q}|jdd��djg|D]}t|j�^qB�}d|jjt|�|fS(NR%cS@s
|jj�S(N(RhRi(Rj((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pyRk�Rls, s"<%s object; %d requirement(s): %s>( RUR&RoR.RpRjt __class__R1tlen(R"RjRqtreqs_str((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pyR0�s
"+c C@s�|j}|j|�s5tjd|j|j�gS|jr�|jjr�t|jj�}|j �s�t
d|j��q�n|j|_|j|_|j
|_
|j|_|dk|_|s�|jj|�|gSy|j|�}Wntk
r d}nX|dkrm|rm|jrm|j|jkrm|jj|jjkrmt
d|||f��n|s�||j|<|j�|kr�||j|j�<n|g}n�g}|jrv|jrv|jr|jo�|jj|jjkr|jj|�t
d|��nt|_tt t!|j�j"t!|j����|_tj#d||j�|g}n|}|r�|j|�}|j$|j|�n|SdS(s'Add install_req as a requirement to install.
:param parent_req_name: The name of the requirement that needed this
added. The name is used because when multiple unnamed requirements
resolve to the same name, we could otherwise end up with dependency
links that point outside the Requirements set. parent_req must
already be added. Note that None implies that this is a user
supplied requirement, vs an inferred one.
:param extras_requested: an iterable of extras used to evaluate the
environement markers.
:return: Additional requirements to scan. That is either [] if
the requirement is not applicable, or [install_req] if the
requirement is applicable and has just been added.
s6Ignoring %s: markers '%s' don't match your environments-%s is not a supported wheel on this platform.s5Double requirement given: %s (already in %s, name=%r)shCould not satisfy constraints for '%s': installation from path or url cannot be constrained to a versionsSetting %s extras to: %sN(%Rht
match_markerstloggertwarningtmarkersR<R=Rtfilenamet supportedRR]R^R_RaRLt is_directRWR)tget_requirementtKeyErrort
constrainttextrasRjt specifierRURiRVtpathR\tFalsettupletsortedtsettuniontdebugRf( R"tinstall_reqtparent_req_nametextras_requestedRhtwheeltexisting_reqtresultt
parent_req((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pytadd_requirement�sp
cC@s[|j�}||jkr,|j|jsS||jkrW|j|j|jrWtStS(N(RiRURRVtTrueR�(R"tproject_nameRh((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pythas_requirement3scC@s&td�|jj�D��p%|jS(Ncs@s|]}|js|VqdS(N(R(t.0Rj((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pys <genexpr>>s(R@RUR&RW(R"((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pythas_requirements<scC@sa|jr]t|j�|_tjj|j�r4tStjd�tdt |j���nt
S(Ns!Could not find download directorys0Could not find or access download directory '%s'(RPRtosR�texistsR�RwtcriticalRRR�(R"((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pytis_downloadAs
cC@slxU||j�fD]A}||jkr3|j|S||jkr|j|j|SqWtd|��dS(NsNo project with the name %r(RiRURVR~(R"R�Rh((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pyR}NscC@sGx@|jj�D]/}|jr%qn|jd|�|j�qWdS(Ntauto_confirm(RUR&Rt uninstalltcommit_uninstall(R"R�Rj((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pyR�Vs
c C@s|jrt|j�n|j|jj�}|jpKtd�|D��}|rl|jrltd��ng}t �}xot
||�D]^}y,|j|j||d|d|j
��Wq�tk
r�}||_|j|�q�Xq�W|r�|�ndS(sY
Prepare process. Create temp directories, download and/or unpack files.
cs@s|]}|jVqdS(N(thas_hash_options(R�Rj((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pys <genexpr>iss�--egg is not allowed with --require-hashes mode, since it delegates dependency resolution to setuptools and could thus result in installation of unhashed packages.ReRXN(RcRRWRUR&RetanyR]RRRtextendt
_prepare_fileRXRRjR)(R"R7t root_reqsRetdiscovered_reqsthash_errorsRjtexc((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pyt
prepare_files]s, cC@s.|jo-|jdkp-|jdko-|jS(Nteagersonly-if-needed(RQRRR|(R"Rj((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pyt_is_upgrade_allowed�s cC@s�|j�|jr�|j|�}t}|r�|jp=|js�y|j||�Wq�tk
rmt}q�t k
r}q�Xn|s�|j
o�t|j�s�|j|_nd|_q�n|r�d}n|jdkr�d}nd}|SdSdS(sCheck if req_to_install should be skipped.
This will check if the req is installed, and whether we should upgrade
or reinstall it, taking into account all the relevant user options.
After calling this req_to_install will only have satisfied_by set to
None if the req_to_install is to be upgraded/reinstalled etc. Any
other value will be a dist recording the current thing installed that
satisfies the requirement.
Note that for vcs urls and the like we can't assess skipping in this
routine - we simply identify that we need to pull the thing down,
then later on it is pulled down and introspected to assess upgrade/
reinstalls etc.
:return: A text reason for why it was skipped, or None.
salready up-to-datesonly-if-neededs%not upgraded as not directly requiredsalready satisfiedN(tcheck_if_existsRJR�R�RTR<tfind_requirementRR�R
R^Rtconflicts_withRLRR(R"R4R7tupgrade_allowedtbest_installedtskip_reason((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pyt_check_skip_installed�s2
c
@s��js�jrgSt�_�jr;tjd��n��jsY�j�|�}n�jrxtjd|��nV�j r��j j
dkr�t�j j�}tjdt
|��ntjd��t����jrZ|r�td���n�j�j��j�j�t��}|j��jrM�j�j�n�j�n��jr�|rytjd�nt��}n��j�j�tjjtjj�j d��r�t!d ��j f��n�j"|�j#��|��j }|rbt$|�rt%��n$t&|�r?t'|�r?t(��n�j)rb�j*rbt+��qbn�j,d
|�} |r�| r�t-�} ny��j}
t}�j j.r��j/r��j/}
n�j j.r�|
r�t}q�t0}nt1�j �j |
|d�j2d| �WnEt3j4k
rU}tj5d
�|�td�|�j f��nXt��}|j��jr��j j
t6j7kr��j�j�q�n�js��j�n�jr�j8s��jr�j9o�t:�j�s��j�_;nd�_qtjd��n|j=|�}
yt>|
�Wn@t?k
rw}�j@rgtjA|jBd�qx�jC��nXg����fd�}�jD�jE�s��jF�d�n|s{�jGr�tjddj�jG��ntHtI�jG�tI|
jG��}x!|D]}tjAd|
|�qWtHtI|
jG�tI�jG�@�}x*|
jJ|�D]}||d|�q^Wn�jKjL���jr��jr��jMjL��nWdQX�S(sxPrepare a single requirements file.
:return: A list of additional InstallRequirements to also install.
sObtaining %ssRequirement %s: %stfiles
Processing %ss
Collecting %ssoThe editable requirement %s cannot be installed when requiring hashes, because there is no single file to hash.s�Since it is already installed, we are trusting this package without checking its hash. To ensure a completely repeatable environment, install into an empty virtualenv.ssetup.pys�pip can't proceed with requirements '%s' due to a pre-existing build directory (%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.ttrust_internetR`thashess4Could not install requirement %s because of error %ssDCould not install requirement %s because of HTTP error %s for URL %ss<Requirement already satisfied (use --upgrade to upgrade): %sic@sMtt|��d�jd�j�}�j�j|�jd|��dS(NRbRgR�(RRpRbRdR�R�Rh(tsubreqR�tsub_install_req(t more_reqsR4R"(s3/usr/lib/python2.7/site-packages/pip/req/req_set.pytadd_req�s s!Installing extra requirements: %rt,s"%s does not provide the extra '%s'R�N(NRtpreparedR�R:RwtinfoRSR�RJR<tschemeR turlRRRtensure_has_source_dirROtupdate_editableR�R?R8tarchiveRPR�R�RIRNR�R�R�R.RBRt
populate_linkR�RRRRRt
original_linkt is_pinnedRR�RR=RcR�R
R`Rt HTTPErrorR�Rtall_schemesRQR^RR�RLR6RRRYRxtargstremove_temporary_sourceR�RhR�R�R�R�trequiresR\R)RZ(R"R7R4ReRXR�R�t
abstract_distR<R�RPtautodelete_unpackedR�R6teR�tmissing_requestedtmissingtavailable_requestedR�((R�R4R"s3/usr/lib/python2.7/site-packages/pip/req/req_set.pyR��s
cC@s?tjd�t��#x|jD]}|j�q!WWdQXdS(sClean up files, remove builds.sCleaning up...N(RwR�RR\R�(R"Rj((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pyt
cleanup_files�s
c@sOg�t������fd��x!�jj�D]}�|�q7W�S(s�Create the installation order.
The installation order is topological - requirements are installed
before the requiring thing. We break cycles at an arbitrary point,
and make no other guarantees.
c@sf|js|�krdS|jr&dS�j|�x�j|D]}�|�qAW�j|�dS(N(RJRtaddRfR)(Rjtdep(tordertordered_reqstscheduleR"(s3/usr/lib/python2.7/site-packages/pip/req/req_set.pyR��s
(R�RUR&(R"R�((R�R�R�R"s3/usr/lib/python2.7/site-packages/pip/req/req_set.pyt_to_install�s
cO@s!|j�}|rDtjddjg|D]}|j^q(��nt���x�|D]�}|jr�tjd|j�t��|jdt�WdQXny|j ||||�Wn*|jr�|j
r�|j�n�n X|jr|j
r|j�n|j
�qUWWdQX||_dS(sl
Install everything in this set (after having downloaded and unpacked
the packages)
s!Installing collected packages: %ss, sFound existing installation: %sR�N(R�RwR�R.RhRR�R�R�tinstalltinstall_succeededtrollback_uninstallR�R�R[(R"tinstall_optionstglobal_optionsR�tkwargst
to_installRjtrequirement((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pyR��s:)
(R1R2R�RLR�R#RrR0R�R�tpropertyR�R�R}R�R�R�R�R�R�R�R�(((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pyRK�s2 4 [
' C� (:t
__future__RtcollectionsRt itertoolsRtloggingR�tpip._vendorRRt
pip.compatRtpip.downloadRRRR R
tpip.exceptionsRRR
RRRRRRRtpip.req.req_installRt pip.utilsRRRRtpip.utils.hashesRtpip.utils.loggingRtpip.utils.packagingRtpip.vcsRt pip.wheelRt getLoggerR1RwtobjectRR3R?R>R;RIRK(((s3/usr/lib/python2.7/site-packages/pip/req/req_set.pyt<module>s0(F"