????

Your IP : 216.73.216.152


Current Path : /usr/lib/python2.7/site-packages/pip/_internal/req/
Upload File :
Current File : //usr/lib/python2.7/site-packages/pip/_internal/req/constructors.pyc

�
}�\]c@sdZddlZddlZddlZddlmZddlmZmZddl	m
Z
ddlmZm
Z
ddlmZmZmZddlmZdd	lmZmZdd
lmZddlmZddlmZdd
lmZmZddl m!Z!ddl"m#Z#ddl$m%Z%e!ruddl&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,ddl-m.Z.ndddgZ/ej0e1�Z2e
j3j4�Z5d�Z6d�Z7d�Z8dde:dde:d�Z;dde:dde:dd�Z<de:ddd�Z=dS(s~Backing implementation for InstallRequirement's various constructors

The idea here is that these formed a major chunk of InstallRequirement's size
so, moving them and support code dedicated to them outside of that class
helps creates for better understandability for the rest of the code.

These are meant to be used elsewhere within pip to create instances of
InstallRequirement.
i����N(tMarker(tInvalidRequirementtRequirement(t	Specifier(tRequirementParseErrortparse_requirements(tis_archive_filetis_urlturl_to_path(tInstallationError(tPyPItTestPyPI(tLink(tmake_pyproject_path(tInstallRequirement(tis_installable_dirtpath_to_url(tMYPY_CHECK_RUNNING(tvcs(tWheel(tAnytDicttOptionaltSettTupletUnion(t
WheelCachetinstall_req_from_editabletinstall_req_from_linetparse_editablecCsOtjd|�}d}|r?|jd�}|jd�}n|}||fS(Ns^(.+)(\[[^\]]+\])$ii(tretmatchtNonetgroup(tpathtmtextrastpath_no_extras((s=/tmp/pip-install-ewDPok/pip/pip/_internal/req/constructors.pyt
_strip_extras/scCs|}t|�\}}tjj|�r�tjjtjj|d��s�djtjj|��}t|�}tjj	|�r�|d7}nt
|��nt|�}n|j�j
d�r	t|�j}|r�||td|j��jfS||dfSnx;tD]3}|j�j
d|�rd||f}PqqWd|krkt
d	j|���n|jdd
�dj�}tj|�s�d|d
jgtjD]}	|	jd^q��d}
t
|
��nt|�j}|st
d|��n||dfS(sParses an editable requirement into:
        - a requirement name
        - an URL
        - extras
        - editable options
    Accepted requirements:
        svn+http://blahblah@rev#egg=Foobar[baz]&subdirectory=version_subdir
        .[some_extra]
    ssetup.pysMFile "setup.py" not found. Directory cannot be installed in editable mode: {}sb
(A "pyproject.toml" file was found, but editable mode currently requires a setup.py based build.)sfile:tplaceholders%s:s%s+%st+s�{} is not a valid editable requirement. It should either be a path to a local project or a VCS URL (beginning with svn+, git+, hg+, or bzr+).iisFor --editable=%s only s, s+URLs is currently supportedsZCould not detect requirement name for '%s', please specify one with #egg=your_package_nameN(R&tosR"tisdirtexiststjointformattabspathR
tisfileR	Rtlowert
startswithRtegg_fragmentRR$R Rtsplittget_backendtbackendstname(teditable_reqturlt
url_no_extrasR$tmsgtpyproject_pathtpackage_nametversion_controltvc_typetbackendt
error_message((s=/tmp/pip-install-ewDPok/pip/pip/_internal/req/constructors.pyR<sL!

1
cCs�d}tjj|�r�d}yPt|d��;}tt|j���|dd|ddd7}Wd	QXWq�tk
r�tj	d
|dt
�q�Xn|d|7}|S(
s�Returns helpful msg in case requirements file does not exist,
    or cannot be parsed.

    :params req: Requirements file path
    ts It does exist.trs The argument you provided s(%s) appears to be as" requirements file. If that is thes# case, use the '-r' flag to installs" the packages specified within it.Ns2Cannot parse '%s' as requirements             filetexc_infos File '%s' does not exist.(R)R"R+topentnextRtreadRtloggertdebugtTrue(treqR:tfp((s=/tmp/pip-install-ewDPok/pip/pip/_internal/req/constructors.pytdeduce_helpful_msg�s
cCs�t|�\}}}	|jd�r3t|�}
nd}
|dk	r|yt|�}Wq�tk
rxtd|��q�Xnd}t||d|
dtdt	|�d|d|d|d	|r�|nid
|d|	p�d�	S(
Nsfile:sInvalid requirement: '%s't
source_dirteditabletlinkt
constraintt
use_pep517tisolatedtoptionstwheel_cacheR$((
RR1RR RRR	RRIR(R7t
comes_fromRQRRRSRTRPR6R8textras_overrideRMRJ((s=/tmp/pip-install-ewDPok/pip/pip/_internal/req/constructors.pyR�s(

cs�t|�rd}nd}||kri|j|d�\}}	|	j�}	|	sZd}
qot|	�}
nd}
|j�}d�tjjtjj|��}d}d}
t|�r�t	|�}n�t
|�\}}
tjj|�o,tjj|kp,tjj
dk	r tjj
|kp,|jd�}|rit|�sTtd|��nt	t|��}nFt|�r�tjj|�s�tjd|�nt	t|��}n|rF|jdkr	tjd|j�r	t	ttjjtjj|j����}n|jr:t|j�}d	|j|jf�qL|j�n|�|
rnt d
|
j!��j"}nd}�dk	rhyt ��}Wqnt#k
rdtjj�kr�d}|t$��7}n8d�kr�t%�fd
�t&D��r�d}nd}|dkrd}ndj'|�}dj'�|�}|rU|dj'|�7}nt|��qnXnd}t(||d|d|
d|d|d|r�|nid|d|d|�S(sCreates an InstallRequirement from a name, which might be a
    requirement, directory containing 'setup.py', filename, or URL.

    :param line_source: An optional string describing where the line is from,
        for logging purposes in case of an error.
    s; t;it.sODirectory %r is not installable. Neither 'setup.py' nor 'pyproject.toml' found.sARequirement %r looks like a filename, but the file does not existtfiles\.\./s%s==%sR'sIt looks like a path.t=c3s|]}|�kVqdS(N((t.0top(t
req_as_string(s=/tmp/pip-install-ewDPok/pip/pip/_internal/req/constructors.pys	<genexpr>%ss,= is not a valid operator. Did you mean == ?RAs
 (from {})sInvalid requirement: {!r}{}s	
Hint: {}ROtmarkersRQRRRSRTRPR$N(()RR3tstripR RR)R"tnormpathR.RR&R*tseptaltsepR1RR	RRR/RGtwarningtschemeRtsearchR8tis_wheelRtfilenameR6tversionR2RR0R$RRLtanyt	operatorsR-R(R6RURQRRRSRTRPtline_sourcet
marker_septmarkers_as_stringR^R"ROtextras_as_stringtptlooks_like_dirtwheelR$RJtadd_msgtsourceR:((R]s=/tmp/pip-install-ewDPok/pip/pip/_internal/req/constructors.pyR�s�		$

$-	
		cCs�yt|�}Wn!tk
r3td|��nXtjtjg}|jr�|r�|jr�|jj|kr�td|j	|f��nt
||d|d|d|�S(NsInvalid requirement: '%s'skPackages installed from PyPI cannot depend on packages which are not also hosted on PyPI.
%s depends on %s RRRTRQ(RRR	R
tfile_storage_domainRR8ROtnetlocR6R(t
req_stringRURRRTRQRJtdomains_not_allowed((s=/tmp/pip-install-ewDPok/pip/pip/_internal/req/constructors.pytinstall_req_from_req_string@s
(>t__doc__tloggingR)Rtpip._vendor.packaging.markersRt"pip._vendor.packaging.requirementsRRt pip._vendor.packaging.specifiersRtpip._vendor.pkg_resourcesRRtpip._internal.downloadRRRtpip._internal.exceptionsR	tpip._internal.models.indexR
Rtpip._internal.models.linkRtpip._internal.pyprojectR
tpip._internal.req.req_installRtpip._internal.utils.miscRRtpip._internal.utils.typingRtpip._internal.vcsRtpip._internal.wheelRttypingRRRRRRtpip._internal.cacheRt__all__t	getLoggert__name__RGt
_operatorstkeysRjR&RRLR tFalseRRRx(((s=/tmp/pip-install-ewDPok/pip/pip/_internal/req/constructors.pyt<module>	sX.		
	J	!q