Your IP : 3.135.206.19


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

�
�Rec@s�dZddlZddlZddlZddlmZddlmZmZddl	m
Z
ddlmZm
Z
ddlmZddlmZmZdd	lmZdd
lmZddlmZddlmZdd
lmZddlmZddlm Z m!Z!ddl"m#Z#ddl$m%Z%ddl&m'Z'm(Z(e#r�ddl)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/ddl0m1Z1ndddgZ2ej3e4�Z5e
j6j7�Z8d�Z9d�Z:d�Z;d�Z<d�Z=de>fd��YZ?d�Z@ddeBdeBeBd �ZCd!�ZDd"�ZEd#�ZFddeBdeBdeBd$�ZGdeBdeBd%�ZHeBdeBd&�ZIdS('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(tInstallationError(tPyPItTestPyPI(tLink(tWheel(tmake_pyproject_path(tInstallRequirement(t
deprecated(tARCHIVE_EXTENSIONS(tis_installable_dirtsplitext(tMYPY_CHECK_RUNNING(tpath_to_url(tis_urltvcs(tAnytDicttOptionaltSettTupletUnion(tParsedRequirementtinstall_req_from_editabletinstall_req_from_linetparse_editablecCs*t|�dj�}|tkr&tStS(s9Return True if `name` is a considered as an archive file.i(RtlowerRtTruetFalse(tnametext((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/req/constructors.pytis_archive_file1scCsOtjd|�}d}|r?|jd�}|jd�}n|}||fS(Ns^(.+)(\[[^\]]+\])$ii(tretmatchtNonetgroup(tpathtmtextrastpath_no_extras((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/req/constructors.pyt
_strip_extras:scCs$|s
t�Std|j��jS(Ntplaceholder(tsetRRR+(R+((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/req/constructors.pytconvert_extrasGscCs*|}t|�\}}tjj|�r�tjjtjj|d��s�djtjj|��}t|�}tjj	|�r�|d7}nt
|��nt|�}n|j�j
d�rt|�j}|r�||td|j��jfS||t�fSnxBtD]:}|j�j
dj|��rdj||�}PqqWd|krut
d	j|���n|jdd
�dj�}tj|�s�djgtjD]}	|	jd
^q��}
dj||
�}t
|��nt|�j}|st
dj|���n||t�fS(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:R.s{}:s{}+{}t+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+).iis, s+URLs2For --editable={}, only {} are currently supportedsZCould not detect requirement name for '{}', please specify one with #egg=your_package_name(R-tosR)tisdirtexiststjointformattabspathRtisfileRRRt
startswithR	tegg_fragmentRR+R/Rtsplittget_backendtbackendsR"(teditable_reqturlt
url_no_extrasR+tmsgtpyproject_pathtpackage_nametversion_controltvc_typetbendsR=t
error_message((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/req/constructors.pyRNsN!

,cCs�d}tjj|�r�d}yEt|d��0}tt|j���|dj|�7}WdQXWq�tk
r�t	j
d|dt�q�Xn|dj|�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 ({}) appears to be a requirements file. If that is the case, use the '-r' flag to install the packages specified within it.Ns&Cannot parse '%s' as requirements filetexc_infos File '{}' does not exist.(R2R)R4topentnextRtreadR6RtloggertdebugR (treqRAtfp((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/req/constructors.pytdeduce_helpful_msg�s
tRequirementPartscBseZd�ZRS(cCs(||_||_||_||_dS(N(trequirementtlinktmarkersR+(tselfRTRURVR+((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/req/constructors.pyt__init__�s			(t__name__t
__module__RX(((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/req/constructors.pyRS�scCs�t|�\}}}|dk	r]yt|�}Wqctk
rYtdj|���qcXnd}t|�}t||d|�S(NsInvalid requirement: '{}'(RR'RRRR6R	RS(R>R"R?textras_overrideRPRU((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/req/constructors.pytparse_req_from_editable�s
cCs�t|�}t|jd|d|dtd|jd|d|d|d|r]|jdg�ngd	|r{|jd	g�ngd
|r�|jdi�nid|j�S(
Nt
comes_fromt
user_suppliedteditableRUt
constraintt
use_pep517tisolatedtinstall_optionstglobal_optionsthash_optionsthashesR+(R\RRTR RUtgetR+(R>R]RaRbtoptionsR`R^tparts((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/req/constructors.pyR�s		cCsUtjj|krtStjjdk	r>tjj|kr>tS|jd�rQtStS(skChecks whether the string "looks like" a path on the filesystem.

    This does not check whether the target actually exists, only judge from the
    appearance.

    Returns true if any of the following conditions is true:
    * a path separator is found (either os.path.sep or os.path.altsep);
    * a dot is found (which represents the current directory).
    t.N(R2R)tsepR taltsepR'R9R!(R"((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/req/constructors.pyt_looks_like_path�s$cCs�t|�rOtjj|�rOt|�r4t|�Stdjt����nt	|�s_dStjj|�r{t|�S|jdd�}t
|�dkr�t|d�r�dStjd|�t|�S(sd
    First, it checks whether a provided path is an installable directory
    (e.g. it has a setup.py). If it is, returns the path.

    If false, check if the path is an archive file (such as a .whl).
    The function checks if the path is a file. If false, if the path has
    an @, it will treat it as a PEP 440 URL requirement and return the path.
    sUDirectory {name!r} is not installable. Neither 'setup.py' nor 'pyproject.toml' found.t@iiisARequirement %r looks like a filename, but the file does not existN(RmR2R)R3RRRR6tlocalsR$R'R8R;tlenRNtwarning(R)R"turlreq_parts((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/req/constructors.pyt_get_url_from_paths"


#cs�t|�rd}nd}||kri|j|d�\}}|j�}|sZd}qot|�}nd}|j�}d�tjjtjj|��}d}d}t|�r�t	|�}n<t
|�\}}t||�}	|	dk	rt	|	�}n|r�|jdkr\t
jd|j�r\t	ttjjtjj|j����}n|jr�t|j�}
djt���q�|j�n|�t|�}�fd�}�dk	r�yt��}
Wn�tk
r�tjj�kr
d}|t��7}n8d	�kr?t�fd
�tD��r?d}nd}|d
j���}|rv|dj|�7}nt|��q�Xxc|
jD]O}t |�}|j!d�r�dj|�}d}t"|d|dd�q�q�Wnd}
t#|
|||�S(Ns; t;itfiles\.\./s{wheel.name}=={wheel.version}cs�s
|Sdj|��S(Ns{} (from {})(R6(ttext(tline_source(s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/req/constructors.pytwith_source_ssIt looks like a path.t=c3s|]}|�kVqdS(N((t.0top(t
req_as_string(s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/req/constructors.pys	<genexpr>mss,= is not a valid operator. Did you mean == ?RHsInvalid requirement: {!r}s	
Hint: {}t]sExtras after version '{}'.s+moving the extras before version specifierstreplacementtgone_ins21.0($RR;tstripR'RR2R)tnormpathR7R	R-RstschemeR%tsearchR?Rtis_wheelR
tfilenameR6RoR:R0RRRkRRtanyt	operatorsRt	specifiertstrtendswithR
RS(R"Rwt
marker_septmarkers_as_stringRVR)RUtextras_as_stringtpR?twheelR+RxRPtadd_msgRAtspectspec_strtreplace((RwR|s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/req/constructors.pytparse_req_from_line-sp		$-	
	 c	Cs�t||�}t|j|d|jd|jd|d|d|rT|jdg�ngd|rr|jdg�ngd|r�|jdi�nid	|d
|jd|�
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.
    RURVRaRbRcRdReRfR`R+R^(R�RRTRURVRgR+(	R"R]RaRbRhR`RwR^Ri((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/req/constructors.pyR�s	c	Cs�yt|�}Wn&tk
r8tdj|���nXtjtjg}|jr�|r�|jr�|jj	|kr�tdj|j
|���nt||d|d|d|�S(NsInvalid requirement: '{}'skPackages installed from PyPI cannot depend on packages which are not also hosted on PyPI.
{} depends on {} RbRaR^(RRRR6Rtfile_storage_domainRR?RUtnetlocR"R(t
req_stringR]RbRaR^RPtdomains_not_allowed((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/req/constructors.pytinstall_req_from_req_string�s"
cCs�|jr?t|jd|jd|d|jd|d|�}nEt|jd|jd|d|d|jd|jd|jd|�}|S(NR]RaR`RbR^RhRw(tis_editableRRTR]R`RRhRw(t
parsed_reqRbRaR^RP((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/req/constructors.pyt#install_req_from_parsed_requirement�s$										(Jt__doc__tloggingR2R%tpip._vendor.packaging.markersRt"pip._vendor.packaging.requirementsRRt pip._vendor.packaging.specifiersRtpip._vendor.pkg_resourcesRRtpip._internal.exceptionsRtpip._internal.models.indexRRtpip._internal.models.linkR	tpip._internal.models.wheelR
tpip._internal.pyprojectRtpip._internal.req.req_installRtpip._internal.utils.deprecationR
tpip._internal.utils.filetypesRtpip._internal.utils.miscRRtpip._internal.utils.typingRtpip._internal.utils.urlsRtpip._internal.vcsRRttypingRRRRRRtpip._internal.req.req_fileRt__all__t	getLoggerRYRNt
_operatorstkeysR�R$R-R0RRRtobjectRSR\R'R!RRmRsR�RR�R�(((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/req/constructors.pyt<module>	sp.				
		K				"	] 

?>