QgGdZddlZddlZddlZddlZddlmZddlmZm Z m Z m Z m Z m Z mZddlmZddlmZmZddlmZddlmZdd lmZmZdd lmZdd lmZdd lm Z dd l!m"Z"ddl#m$Z$ddl%m&Z&ddl'm(Z(ddl)m*Z*ddl+m,Z,m-Z-gdZ.ej/e0Z1ej23Z4de5de e5e e5ffdZ6de e5de e5fdZ7dede e5defdZ8de5de e e5e5e e5ffdZ9de5ddfdZ:de5de5fd Z;ed!"Gd#d$Zd*e>d+e e e5d,e e e5e e5fd-e>d.e>d/e>d0e e e5ee5e e5ffde"fd1Z?d2e5de>fd3Z@de5d2e5de e5fd4ZAd2e5d5e e5ded*e>d+e e e5d,e e e5e e5fd-e>d5e e5d.e>d0e e e5ee5e e5ffde"fd8ZC dCd9e5d(e e"d*e>d)e e>d.e>de"f d:ZD dDd;e d*e>d)e e>d.e>d0e e e5ee5e e5ffde"f d<ZEd=ed>e"de"fd?ZFd>e"de"fd@ZGd>e"dee5de"fdAZHdS)Ea~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) dataclass) CollectionDictListOptionalSetTupleUnion)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 ~/builddir/build/BUILD/imunify360-venv-2.5.0/opt/imunify360/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_extrasr18s1 uu =6<<>>9 : : AAr,req new_extrasctjdt|tj}|Jd|d|d}|d}||Jd|dd |r"d t|nd }t|||S) z Returns a new requirement based on the given one, with the supplied extras. If the given requirement already has extras those are replaced (or dropped if no new extras are given). z([\w\t .-]+)(\[[^\]]*\])?(.*))flagsNzregex match on requirement z! failed, this should never happenr"z®ex group selection for requirement z[{}],) r$ fullmatchstrASCIIr&formatjoinsortedr)r2r3r%prepostr(s r*_set_requirement_extrasrA>s &(\( Ch &&&E KSKKK QC++a..D D,,VVVV-,,-- R );); < < ??F   5 5 99;; ! !_"7"7"7 8 8 $,,s,,C E  99D ; 99S_-- , ,' , , ,   $L   =l = = =    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)rH.0lines r* z2check_first_requirement_in_file..sR   !OOC00       r,c3>K|]}|VdSN)striprYs r*r\z2check_first_requirement_in_file..s*44$444444r,z #N\r8)openfindendswithr_nextr)rRflinesr[s r*check_first_requirement_in_filerhsP h : : :a  44!444      Dt||-diioo-.}}T"" ;CRCy((4r??: D ! ! ! ! sBB<<CCctj|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)rFrexistsrhr loggerdebug)r2msgs r*deduce_helpful_msgrns 7>>#  0///// "C  ',,,  2 2 2 2  DDD =sCCCCCD JsA%A*)A*T)frozencheZdZUeeed<eeed<eeed<ee ed<dS)RequirementParts requirementrPmarkersr(N) __name__ __module__ __qualname__rr __annotations__rr rr:r,r*rqrqsT+&&&& 4. f  Hr,rqct|\}}}|8 t|}n)#t$r}td|d|d}~wwxYwd}t |}t ||d|S)NInvalid requirement: : )rrr rrrq)rBnamerLextras_overrider2excrPs r*parse_req_from_editablers!/ !=!=D#  M)8)>)>CC! M M M#$KD$K$Kc$K$KLL L M 99D Ct_ = ==s' A AA F) use_pep517isolatedglobal_options hash_options constraint user_suppliedpermit_editable_wheelsconfig_settings comes_fromrrrrrrrrcvt|} t| j||d|| j|||||| | j S)NT) rreditablerrPrrrrrrr()rrrrrPr() rBrrrrrrrrrpartss r*rrsV $L 1 1E  #5 Z%!'|   r,r|ctjj|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)rFrsepaltseprH)r|s 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) rrFrrGrrrrisfilesplitlenrkwarning)rr| 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==textr cs|S|ddS)Nz (from )rx)rrs r* with_sourcez(parse_req_from_line..with_sourcecs' K--{----r, req_as_stringc@ tS#t$r}tjjvrd}|t z }n)dvr#t fdtDsd}nd}dd|}|r|d|z }t|d}~wwxYw) NzIt looks like a path.=c3 K|]}|vV dSr^rx)rZoprs r*r\zAparse_req_from_line.._parse_req_string..os922(*m#222222r,z,= is not a valid operator. Did you mean == ?r8rzr{z Hint: ) rr rFrrrnany operatorsr)rr~add_msgrmrs` r*_parse_req_stringz.parse_req_from_line.._parse_req_stringhs )"=11 1! ) ) )w{m++1-m<<< %%c2222.7222//%I+NmNNNNOOC ,+'+++#C(( ( )s BA;BB)rrr_r rFrnormpathabspathrr+rschemer$searchrLris_wheelrrRr|versionrIr1r:r rq)r|r marker_sepmarkers_as_stringrsrrrPextras_as_stringprLwheelr(rr2rs ` @r*parse_req_from_liner3sB d||  T"&**Z";";-3355  0GG.//GG ::<rs#  !!!!!!FFFFFFFFFFFFFFFFFF000000NNNNNNNN66666666666655555555******,,,,,,888888<<<<<<999999777777999999000000))))))))     8 $ $  % % ' '  " "c8C=&8 9 " " " "B8C=BSXBBBB 33#c(3{333324$4$x}c3s8/K)L4$4$4$4$ncd8CC2 $ ># >2B > > > >*<@"&*.37#(BF13678    T#Y' 4T#Y/0!d3c49n(=#=>?@34&S DL8cL8 L8BRL8L8L8L8b<@""&*.37!%BF""" "s$6678" "  " T#Y' "4T#Y/0""#""d3c49n(=#=>?"""""N04!% ###+,## #  #  ####P!%BF %%!%%% % d3c49n(=#=>? %  %%%%P ($"49K4  sOr,