U n aQ<@sdZddlZddlZddlZddlmZddlmZmZddl m Z ddl m Z m Z ddlmZddlmZmZdd lmZdd lmZdd lmZdd lmZdd lmZddlmZmZddl m!Z!ddl"m#Z#ddl$m%Z%m&Z&e!rddl'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-ddl.m/Z/dddgZ0e1e2Z3e j45Z6ddZ7ddZ8ddZ9ddZ:ddZ;Gd d!d!e<Z=d"d#Z>d1d%dZ?d&d'Z@d(d)ZAd*d+ZBd2d,dZCd3d-d.ZDd4d/d0ZEdS)5a~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. N)Marker)InvalidRequirement Requirement) Specifier)RequirementParseErrorparse_requirements)InstallationError)PyPITestPyPI)Link)Wheel)make_pyproject_path)InstallRequirement)ARCHIVE_EXTENSIONS)is_installable_dirsplitext)MYPY_CHECK_RUNNING) path_to_url)is_urlvcs)AnyDictOptionalSetTupleUnion)ParsedRequirementinstall_req_from_editableinstall_req_from_lineparse_editablecCs t|d}|tkrdSdS)z9Return True if `name` is a considered as an archive file.TF)rlowerr)nameextr$_C:\Users\vtejo\AppData\Local\Temp\pip-unpacked-wheel-6mt8ur68\pip\_internal\req\constructors.pyis_archive_file3sr&cCs6td|}d}|r*|d}|d}n|}||fS)Nz^(.+)(\[[^\]]+\])$r )rematchgroup)pathmextraspath_no_extrasr$r$r% _strip_extras<s   r/cCs|s tStd|jS)N placeholder)setrr!r-)r-r$r$r%convert_extrasIsr2c Csd|}t|\}}tj|rptjtj|dshdtj|}t|}tj |r`|d7}t |t |}| drt|j}|r||td| jfS||dfStD](}| d|rd||}qqd |krt d ||d d d  }t|ssz"parse_editable..z2For --editable={}, only {} are currently supportedzZCould not detect requirement name for '{}', please specify one with #egg=your_package_name)r/osr+isdirexistsjoinformatabspathr isfilerrr! startswithr egg_fragmentrr-rsplit get_backendbackends) editable_requrl url_no_extrasr-msgpyproject_path package_nameversion_controlvc_typerC error_messager$r$r%rPsb          c Csd}tj|rxd}z8t|d$}tt||d|7}W5QRXWqtk rtt j d|ddYqXn|d|7}|S) zReturns helpful msg in case requirements file does not exist, or cannot be parsed. :params req: Requirements file path z It does exist.rzThe 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.z2Cannot parse '{}' as requirements fileT)exc_infoz File '{}' does not exist.) r8r+r:opennextrreadr<rloggerdebug)reqrGfpr$r$r%deduce_helpful_msgs&  rWc@seZdZddZdS)RequirementPartscCs||_||_||_||_dSN) requirementlinkmarkersr-)selfrZr[r\r-r$r$r%__init__szRequirementParts.__init__N)__name__ __module__ __qualname__r^r$r$r$r%rXsrXcCsbt|\}}}|dk rHz t|}WqLtk rDtd|YqLXnd}t|}t||d|S)NInvalid requirement: '{}')rrrrr<r rX)rDr"rEextras_overriderUr[r$r$r%parse_req_from_editables rdFcCs\t|}t|j|d|j||||r,|dgng|r>|dgng|rP|dini|jd S)NTinstall_optionsglobal_optionshashes) comes_fromeditabler[ constraint use_pep517isolatedrerf hash_optionsr-)rdrrZr[getr-)rDrhrkrloptionsrjpartsr$r$r%rs cCs>tjj|krdStjjdk r,tjj|kr,dS|dr:dSdS)akChecks 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). TN.F)r8r+sepaltsepr?r4r$r$r%_looks_like_paths  rtcCst|r6tj|r6t|r$t|Stdjftt |sBdStj |rVt|S| dd}t |dkr~t|ds~dSt d|t|S)ad 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. zUDirectory {name!r} is not installable. Neither 'setup.py' nor 'pyproject.toml' found.N@r r'rzARequirement %r looks like a filename, but the file does not exist)rtr8r+r9rrrr<localsr&r>rAlenrSwarning)r+r" urlreq_partsr$r$r%_get_url_from_path s(   rzcst|rd}nd}||krF||d\}}|}|s.with_sourcezIt looks like a path.=c3s|]}|kVqdSrYr$)r5op) req_as_stringr$r% lsz&parse_req_from_line..z,= is not a valid operator. Did you mean == ?rMzInvalid requirement: {!r}z Hint: {})rrAstriprr8r+normpathr=r r/rzschemer(searchrEris_wheelr filenamer<rvr@r2rrrrrWany operatorsrrX)r"r~ marker_sepmarkers_as_stringr\r+r[extras_as_stringprEwheelr-rrUadd_msgrGr$)r~rr%parse_req_from_line,sj         rc Cs`t||}t|j||j|j|||r.|dgng|r@|dgng|rR|dini||jd S)aCreates 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. rerfrg) r[r\rkrlrerfrmrjr-)rrrZr[r\rnr-)r"rhrkrlrorjr~rpr$r$r%r|s cCszz t|}Wn"tk r.td|YnXtjtjg}|jrj|rj|jrj|jj |krjtd|j |t ||||dS)NrbzkPackages installed from PyPI cannot depend on packages which are not also hosted on PyPI. {} depends on {} )rlrk) rrrr<r file_storage_domainr rEr[netlocr"r) req_stringrhrlrkrUdomains_not_allowedr$r$r%install_req_from_req_strings,  rc CsD|jr t|j|j||j|d}n t|j|j|||j|j|jd}|S)N)rhrkrjrl)rhrkrlrorjr~) is_editablerrZrhrjrror~) parsed_reqrlrkrUr$r$r%#install_req_from_parsed_requirements$  r)NNFNF)NNFNFN)NFN)FN)F__doc__loggingr8r(Zpip._vendor.packaging.markersrZ"pip._vendor.packaging.requirementsrrZ pip._vendor.packaging.specifiersrZpip._vendor.pkg_resourcesrrpip._internal.exceptionsrpip._internal.models.indexr r pip._internal.models.linkr pip._internal.models.wheelr pip._internal.pyprojectr Zpip._internal.req.req_installrpip._internal.utils.filetypesrpip._internal.utils.miscrrpip._internal.utils.typingrpip._internal.utils.urlsrpip._internal.vcsrrtypingrrrrrrZpip._internal.req.req_filer__all__ getLoggerr_rS _operatorskeysrr&r/r2rrWobjectrXrdrrtrzrrrrr$r$r$r%sr                 K "R