id@ dZddlZddlZddlZddlmZmZmZmZm Z m Z ddl m Z ddl mZmZddlmZddlmZddlmZmZdd lmZdd lmZdd lmZdd lmZdd lm Z ddl!m"Z"ddl#m$Z$ddl%m&Z&ddl'm(Z(m)Z)gdZ*ej+e,Z-ej./Z0de1de e1ee1ffdZ2dee1dee1fdZ3de1de ee1e1ee1ffdZ4de1ddfdZ5de1de1fdZ6GddZ7de1de7fd Z8 d;dd!ddd!d!d!dd"de1d#ee ee1fd$ee9d%e9d&eee1d'eee1ee1fd(e9d)e9d*e9d+eee1e e1ee1ffdefd,Z:d-e1de9fd.Z;de1d-e1dee1fd/Z da~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)DictListOptionalSetTupleUnion)Marker)InvalidRequirement Requirement) Specifier)InstallationError)PyPITestPyPI)Link)Wheel)ParsedRequirement)InstallRequirement)is_archive_file)is_installable_dir)get_requirement) path_to_url)is_urlvcs)install_req_from_editableinstall_req_from_lineparse_editablepathreturnctjd|}d}|r+|d}|d}n|}||fS)Nz^(.+)(\[[^\]]+\])$)rematchgroup)rmextraspath_no_extrass S/opt/cloudlinux/venv/lib/python3.11/site-packages/pip/_internal/req/constructors.py _strip_extrasr)*sQ &--A F 6 !!r&ct|stStd|zjS)N placeholder)setrlowerr&)r&s r(convert_extrasr/6s1 uu =6<<>>9 : : AAr* editable_reqc|}t|\}}tj|rt |}|drSt|j}|r,||td|zj fS||tfStD]5}||dr |d|}n6t|}|j s4dtj}t!|d|d|j}|s"t!d|||tfS) aParses 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] zfile:r,:+z, zq is not a valid editable requirement. It should either be a path to a local project or a VCS URL (beginning with z).zZCould not detect requirement name for '{}', please specify one with #egg=your_package_name)r)osrisdirrr. startswithr egg_fragmentrr&r-ris_vcsjoin all_schemesr format)r0url url_no_extrasr& package_nameversion_controllinkbackendss r(rr<s C*#..M6 w}}]##3#M22 ''00 6M**7  6   >??F   5 5 99;; ! !_"7"7"7 8 8 $,,s,,C E  99D ; 99S_-- , ,' , , ,   $L   **0&*>*>    cee ##r*filenamect|dd5}dd|DD}|D]}d|vr|d|d}|dr-|dd t |d z}t |ddddS ddddS#1swxYwYdS) a Check if file is parsable as a requirements file. This is heavily based on ``pkg_resources.parse_requirements``, but simplified to just check the first meaningful line. :raises InvalidRequirement: If the first meaningful line cannot be parsed as an requirement. zutf-8ignore)encodingerrorsc3HK|]}||d|VdS)#N)r6.0lines r( z2check_first_requirement_in_file..~sR   !OOC00       r*c3>K|]}|VdSN)striprIs r(rLz2check_first_requirement_in_file..s*44$444444r*z #N\)openfindendswithrOnextr )rBflinesrKs r(check_first_requirement_in_filerYssP h : : :a  44!444      Dt||-diioo-.}}T"" ;CRCy((4r??:     ! sBB<<CCreqctj|sd|dSd} t||d|dz }n+#t$rt d|YnwxYw|S)zReturns helpful msg in case requirements file does not exist, or cannot be parsed. :params req: Requirements file path z File 'z' does not exist.z The path does exist. zThe argument you provided (zx) appears to be a requirements file. If that is the case, use the '-r' flag to install the packages specified within it.z&Cannot parse '%s' as requirements file)r4rexistsrYr loggerdebug)rZmsgs r(deduce_helpful_msgr`s 7>>#  0///// "C  ',,,  2 2 2 2  DDD =sCCCCCD JsA%A*)A*c VeZdZdeedeedeedeefdZ dS)RequirementParts requirementr@markersr&c>||_||_||_||_dSrN)rcr@rdr&)selfrcr@rdr&s r(__init__zRequirementParts.__init__s%'   r*N) __name__ __module__ __qualname__rr rr rstrrgr*r(rbrbs` k* tn &!  C      r*rbct|\}}}|2 t|}n##t$rtd|dwxYwd}t |}t ||d|S)NInvalid requirement: '')rr r r rrb)r0namer<extras_overriderZr@s r(parse_req_from_editablerrs!/ !=!=D#  F)4T):):CC! F F F#$DT$D$D$DEE E F 99D Ct_ = ==s 'AF) use_pep517isolatedglobal_options hash_options constraint user_suppliedpermit_editable_wheelsconfig_settings comes_fromrsrtrurvrwrxryrzcvt|} t| j||d|| j|||||| | j S)NT) r{rxeditableryr@rwrsrtrurvrzr&)rrrrcr@r&) r0r{rsrtrurvrwrxryrzpartss r(rrsV $L 1 1E  #5 Z%!'|   r*rpctjj|vrdStjjtjj|vrdS|drdSdS)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)r4rsepaltsepr6)rps r(_looks_like_pathrsS w{dt w~!bgn&<&<t st 5r*ct|rPtj|r1t |rt |St d|dt|sdStj|rt |S| dd}t|dkrt|dsdSt d|t |S) aK First, it checks whether a provided path is an installable directory. 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. z Directory zC 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) rr4rr5rrr risfilesplitlenr]warning)rrp urlreq_partss r(_get_url_from_pathrs "'--"5"5 d # # %t$$ $  * * * *    4 t w~~d!4   ::c1%%L <A&6|A&G&Gt NNK  t  r* line_sourcec 2t|rd}nd}||vrB||d\}}|}|sd}nt|}nd}|}d}tjtj|}d}d}t|rt|}n3t|\} }t| |} | t| }|r|j dkrutj d|jr[tttjtj|j}|jr&t#|j} | jd| j}n |j}n|}t-|} dt.dt.ffd d t.dt0ffd } | | |}nd}t3|||| S) Nz; ;r filez\.\./z==textrcs|S|ddS)Nz (from )rl)rrs r( with_sourcez(parse_req_from_line..with_sourceNs' K--{----r* req_as_stringc t}|jD];}t|}|drd|d}t |._parse_req_string..Zs922(*m#222222r*z,= is not a valid operator. Did you mean == ?rRzInvalid requirement: z Hint: ) r specifierrkrUr r r4rrr`any operators)rrZspecspec_strr_add_msgrs` r(_parse_req_stringz.parse_req_from_line.._parse_req_stringSsO 1!-00C(  1 1t99$$S))1?8???C+C0001 1'" ) ) )w{m++1-m<<< %%c2222.7222//%I+GmGGHHC ,+'+++#C(( ( )0 s ABC)rrrOr r4rnormpathabspathrr)rschemer"searchr<ris_wheelrrBrpversionr7r/rkr rb)rpr marker_sepmarkers_as_stringrdrrr@extras_as_stringpr<wheelr&rrZrs ` @r(parse_req_from_linersB d||  T"&**Z";";-3355  0GG.//GG ::<rse ::::::::::::::::000000NNNNNNNN66666666666655555555******,,,,,,888888<<<<<<999999777777999999000000))))))))     8 $ $  % % ' '  " "c8C=&8 9 " " " "B8C=BSXBBBB 4$4$x}c3s8/K)L4$4$4$4$ncd8CC2         ># >2B > > > >*<@"&*.37#(BF13678    T#Y' 4T#Y/0!d3c49n(=#=>?@34&S DW8cW8 W8BRW8W8W8W8x<@""&*.37!%BF""" "s$6678" "  " T#Y' "4T#Y/0""#""d3c49n(=#=>?"""""N04!% ###+,## #  #  ####P!%BF %%!%%% % d3c49n(=#=>? %  %%%%P (r*