kghkdZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl mZddlmZddlmZmZmZddlmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&ddl'm(Z(m)Z)ddl*m+Z+dd l,m-Z-dd l.m/Z/dd l0m1Z1dd l2m3Z3dd l4m5Z5m6Z6m7Z7ddl8m9Z9m:Z:ddl;mm?Z?m@Z@ddlAmBZBmCZCmDZDmEZEddlFmGZGmHZHmIZImJZJddlKmLZLGdde!ZMejNeOZPedeQZRe$eReQe%eSeQffZTdKdeQdeSde$eQeQffdZUdeQdeeQeffdZVdeQdeWfdZXdedeWfd ZYd!e5de$eeQeQfeeQeQfffd"ZZd#e"eQde eQfd$Z[d%eeTdee$eQeQeQffd&Z\d'eRd(eQdeQfd)Z]deQd(eQdeRfd*Z^d+eeeQd,eeReRfd-e#eRd.eeQd(eQdeeTf d/Z_d0eeQeQfdeeQfd1Z`Gd2d3ZaGd4d5ZbGd6d7e1Zcd8eQddfd9ZdGd:d;e+Ze dLd>eQd?e(d@eQdAe=dBeWdCeWdDe e:dEeWddfdFZfejgdGeQdedHfdIZh dLd>eQd@eQdAe=dGeQdBeWdCeWdDe e:dEeWddfdJZidS)MzFSupport for installing and building the "wheel" binary package format.N)urlsafe_b64encode)Message)chain filterfalsestarmap)IOAnyBinaryIOCallableDict GeneratorIterableIteratorListNewTypeOptionalProtocolSequenceSetTupleUnioncast)ZipFileZipInfo) ScriptMaker)get_export_entry)canonicalize_name)InstallationError)get_major_minor_version)BaseDistributionFilesystemWheelget_wheel_distribution)DIRECT_URL_METADATA_NAME DirectUrl) SCHEME_KEYSScheme)adjacent_tmp_filereplace) StreamWrapper ensure_dir hash_file partition) current_umaskis_within_directory2set_extracted_file_to_default_mode_plus_executablezip_item_is_executable) parse_wheelc6eZdZUded<eed<eed<ddZdS) File RecordPathsrc_record_path dest_pathchangedreturnNcdSNselfs /builddir/build/BUILD/imunify360-venv-2.6.0/opt/imunify360/venv/lib/python3.11/site-packages/pip/_internal/operations/install/wheel.pysavez File.saveCs r8N)__name__ __module__ __qualname____annotations__strboolr?r;r@r>r3r3>sH!!!!NNN MMM      r@r3r4path blocksizer8ct||\}}dt|ddz}|t |fS)z?Return (encoded_digest, length) for path using hashlib.sha256()zsha256=latin1=)r+rdigestdecoderstriprF)rIrJhlengthrNs r>rehashrSMs]$ **IAv *188::66==hGGNNsSS SF CKK  r@modec|dddS)zPReturn keyword arguments to properly open a CSV file in the given mode. utf-8)rTnewlineencodingr;)rTs r> csv_io_kwargsrZTsRW = ==r@c|tj|sJt|d5}|}|ds ddddSt jt j }d|ztj dz}| }dddn #1swxYwYt|d5}| || |dddn #1swxYwYdS) zQReplace #!python with #!/path/to/python Return True if file was changed. rbs#!pythonNFs#!asciiwbT) osrIisfileopenreadline startswithsys executableencodegetfilesystemencodinglinesepreadwrite)rIscript firstlineexenamerests r> fix_scriptro[s 7>>$    dD  VOO%% ##K00 .''(A(C(CDDGObj&7&7&@&@@ {{}}  dD  V Y T 4s*+C*A)CC#&C#:+D11D58D5metadatacZ|dddkS)NzRoot-Is-PurelibrVtrue)getlower)rps r>wheel_root_is_purelibruos( <<)2 . . 4 4 6 6& @@r@distci}i}|D]7}|jdkr|j||j<|jdkr|j||j<8||fS)Nconsole_scripts gui_scripts)iter_entry_pointsgroupvaluename)rvrxry entry_points r>get_entrypointsrsssOK--//>>   1 1 10;0AOK, - -  - / /,7,=K ( ) K ''r@scriptsc  |sdStjt}|D][}tj|}tj|}|||\dtj dd tj D tj tjtjtj fd|D}|sdSg}|D]\}}t%|}t'|dkr d|dd } n z5message_about_scripts_not_on_PATH..sX  ))!,,--44RV<<r@PATHrVci|]F\}}tjtj|vC||GSr;)r_rIrr)r parent_dirr not_warn_dirss r> z5message_about_scripts_not_on_PATH..sT%%% J 7  BG,,Z88 9 9 N N G N N Nr@zscript rz iszscripts {} are, z and zThe z installed in 'z' which is not on PATH.zeConsider adding {} to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.zthis directoryzthese directoriesc32K|]}||ddkVdS)r~Nr;rs r> z4message_about_scripts_not_on_PATH..sCQ ! r@ziNOTE: The current PATH contains path(s) starting with `~`, which may not be expanded by all applications. ) collections defaultdictsetr_rIdirnamebasenameaddenvironrssplitpathsepappendrrrdreitemssortedlenformatjoinany)rgrouped_by_dirdestfiler script_namewarn_for msg_lines dir_scriptssorted_scripts start_text last_line_fmtwarn_for_tildetilde_warning_msgrs @r>!message_about_scripts_not_on_PATHr~s t+6*A#*F*FN44W__X.. g&&x00 z"&&{3333++11"*==M  ))"'//#.*I*IJJKK%%%%#1#7#7#9#9%%%H tI#+>>#3#3    K$*;$7$7 ~  ! # #9>!#4999JJ)00 ."-..8>";MMJ  Q: Q Qj Q Q Q     C 9~~--.>??@@@@--.ABBCCCZ^^FB77==bjIIN, =  *+++ 99Y  r@outrowsc4td|DS)aNormalize the given rows of a RECORD file. Items in each row are converted into str. Rows are then sorted to make the value more predictable for tests. Each row is a 3-tuple (path, hash, size) and corresponds to a record of a RECORD file (see PEP 376 and PEP 427 for details). For the rows passed to this function, the size can be an integer as an int or string, or the empty string. c3BK|]\}}}||t|fVdSr:)rF)r record_pathhash_sizes r>rz&_normalized_outrows..sF,DKeSYY'r@)r)rs r>_normalized_outrowsrs2* HO  r@rlib_dircBtj||Sr:)r_rIr)rrs r>_record_to_fs_pathrs 7<< - --r@ctj|dtj|dkr tj||}|tjjd}td|S)Nr/r4)r_rI splitdrivertrelpathr(rr)rIrs r>_fs_to_record_pathrs w$"((**bg.@.@.I.I!.L.R.R.T.TTTwtW-- << S ) )D  d # ##r@ old_csv_rows installedr7 generatedcrg}|D]}t|dkrtd|td|d}|||}||vr!t t ||\} } n:t|dkr|dnd} t|dkr|dnd} ||| | f|D]<} t| |} t | \} } || | | f=|d| DzS) z_ :param installed: A map from archive RECORD path to installation RECORD path. z,RECORD line has more than three elements: %sr4rrrVcg|]}|ddfS)rVr;)rinstalled_record_paths r>rz.get_csv_rows_for_installed.. s-,A B'r@) rloggerwarningrpoprSrrrvalues) rrr7rrinstalled_rowsrowold_record_pathnew_record_pathrNrRfrIs r>get_csv_rows_for_installedrsa-/N A A s88a<< NNI3 O O O|SV44#--II g % %#$6$P$PQQNFFF"3xx!||SVVF"3xx!||SVVF?@@@@ 66!!W--tVV45555 ENEUEUEWEW r@consolec(|}g}|dd}|rdtjvr|d|ztjdddkr+|dt jdd||dtd|d |D}|D]}||=|d d}|radtjvr|d |z|d td|d |D}|D]}||=| tdj | |S)zk Given the mapping from entrypoint name to callable, return the relevant console script specs. pipNENSUREPIP_OPTIONSzpip = rV altinstallrz = c<g|]}tjd||S)zpip(\d+(\.\d+)?)?$rematchrks r>rz,get_console_script_specs..As*KKK1F(J(JK!KKKr@ easy_installzeasy_install = z easy_install-c<g|]}tjd||S)zeasy_install(-\d+\.\d+)?$rrs r>rz,get_console_script_specs..Ms:   "(+G"K"K    r@{} = {}) copyrr_rrrsrd version_inforextendrrr)rscripts_to_generate pip_scriptpip_epreasy_install_scripteasy_install_eps r>get_console_script_specsrs llnnGBUD))J  bj 0 0  & &x*'< = = = :>>-r 2 2l B B  & &'QS-=a-@'Q'QZ'Q'Q R R R""#S)@)B)B#S#Sz#S#STTTKKWKKK  A !++nd;;  bj 0 0  & &'8;N'N O O O"" O355 O O:M O O        !  A wy'7IIJJJ r@c:eZdZdedededdfdZdefdZd dZ dS) ZipBackedFiler5r6zip_filer8Nc>||_||_||_d|_dSNF)r5r6 _zip_filer7)r=r5r6rs r>__init__zZipBackedFile.__init__Zs% /"! r@c@|j|jSr:)rgetinfor5r<s r>_getinfozZipBackedFile._getinfobs~%%d&:;;;r@ctj|jrtj|j|}t |jd5}|jdkr]|j|5}t|jd}tj |||dddn #1swxYwYdddn #1swxYwYt|rt|jdSdS)Nr^rrH)r_rIexistsr6unlinkrra file_sizerminshutil copyfileobjr0r/)r=zipinfodestrrJs r>r?zZipBackedFile.saveess 7>>$. ) ) & Idn % % %--//$.$ ' ' ;4 1$$^((11;Q #G$5{ C CI&q$ :::;;;;;;;;;;;;;;; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; "' * * O >t~ N N N N N O Os6'&C ,C9 CC C C CC #C rA) rBrCrDr4rFrrrrr?r;r@r>rrYs})69EL <'<<<<OOOOOOr@rceZdZddZddZdS) ScriptFilefiler3r8Ncf||_|jj|_|jj|_d|_dSr)_filer5r6r7)r=rs r>rzScriptFile.__init__s- #z9- r@cj|jt|j|_dSr:)rr?ror6r7r<s r>r?zScriptFile.saves) !$.11 r@)rr3r8NrA)rBrCrDrr?r;r@r>rrs< 222222r@rc(eZdZdeddffd ZxZS)MissingCallableSuffixr~r8NcRtd|ddS)NzInvalid script entry point: z - A callable suffix is required. Cf https://packaging.python.org/specifications/entry-points/#use-for-scripts for more information.)superr)r=r~ __class__s r>rzMissingCallableSuffix.__init__s?  ;        r@)rBrCrDrFr __classcell__rs@r>rrsK C D          r@r specificationcrt|}|#|jtt|dSdSr:)rsuffixrrF)r entrys r>_raise_for_invalid_entrypointrs> ] + +E U\1#CJJ///11r@cXeZdZ ddedeeeefdeeffd ZxZ S)PipScriptMakerNr optionsr8cft|t||Sr:)rrmake)r=r rrs r>rzPipScriptMaker.makes+ &m444ww||M7333r@r:) rBrCrDrFrr r rrrr s@r>rrsnFJ44 4+3DcN+C4 c4444444444r@rTFr} wheel_zip wheel_pathscheme pycompilewarn_script_location direct_url requestedc  :;<=>?@t||\}} t| r|j@n|j@i?t ;g} d-dt dt dtddf;?@fd } dt dtfd } d t d t ddffd :d tdt dtt gdff:fd } d tdtdtt gdff:fd }dt dtfd}ttt | }t| |}t||\}}| |@}t!||}dt dtfd}t||\}}|||}t!||}t#||}t%t't)|}t+|\<>dddtf<>fd }t!||}t||}t!t,|}t#||}t }|D]~}t.j|j} | |vr$t7| || || |j|j|jdt@t ddff?@fd }!dt dt fd}"|rEtCj"tGj$tJj&5}#tOj(5tOj)d|!D]}$tUj+|$dd}%|%rk|"|$}&t.j,|&sJtd|&-t.jj.d}'| |'|& dddn #1swxYwYdddn #1swxYwYt^0|#1ted|j3}(d|(_4dh|(_5d|(_6to<})tqtsdj:>;}*|(<|)}+| =|+| =|(<|*d di|r+t}|+},|,t^?|,d!tz=tBjAdt d"tdt@tddff=fd# }-t.jD@|}.t.jD|.d$}/|-|/5}0|0Ed%dddn #1swxYwY| F|/|t.jD|.t}1|-|15}2|2E|HId&dddn #1swxYwY| F|1|r^t.jD|.d'}3t|3d(5 dddn #1swxYwY| F|3|Kd)}4tqtjM|4N}5t|5?;| @*}6t.jD|.d)}7|-|7fitd+5}8tjQtd,|8}9|9Rt|6ddddS#1swxYwYdS).aInstall a wheel. :param name: Name of the project to install :param wheel_zip: open ZipFile for wheel being installed :param scheme: Distutils scheme dictating the install directories :param req_description: String used in place of the requirement, for logging :param pycompile: Whether to byte-compile installed Python files :param warn_script_location: Whether to check that scripts are installed into a directory on PATH :raises UnsupportedWheel: * when the directory holds an unpacked wheel with incompatible Wheel-Version * when the .dist-info dir does not match the wheel Fsrcfilermodifiedr8Ncdt|}||<|r|dSdS)z6Map archive RECORD paths to installation RECORD paths.N)rr)rrrnewpathr7rrs r>record_installedz(_install_wheel..record_installedsH%Xw77$ '  ! KK  ! !r@rIc,|dS)Nr)endswithrIs r> is_dir_pathz#_install_wheel..is_dir_paths}}S!!!r@ dest_dir_path target_pathctt||s&d}t|||dS)NzRThe wheel {!r} has a file {!r} trying to install outside the target directory {!r})r.rr)r%r&messagers r>assert_no_path_traversalz0_install_wheel..assert_no_path_traversalsP"=+>> 5 $z; FF    r@rrr3c.dtddffd }|S)Nrr8r3ctj|}tj|}|t ||Sr:)r_rIrrr)r normed_pathr6r)rrs r>make_root_scheme_filezM_install_wheel..root_scheme_file_maker..make_root_scheme_filesR'**;77K T;77I $ $T9 5 5 5 iBB Br@)r4)rrr-r)s`` r>root_scheme_file_makerz._install_wheel..root_scheme_file_makersM Cz Cf C C C C C C C C %$r@rcXfdtDdtddffd }|S)Nc2i|]}|t|Sr;)getattr)rkeyrs r>rzB_install_wheel..data_scheme_file_maker..s%IIIcWVS11IIIr@rr8r3c tj|} |tjjd\}}}n&#t $rd d|d}t |wxYw |}nN#t$rAdt }d d|d|d|d }t |wxYwtj||} ||t|| S) NrzUnexpected file in z: zG. .data directory contents should be named like: '/'.rzUnknown scheme key used in z (for file zW). .data directory contents should be in subdirectories named with a valid scheme key ()) r_rIrrr ValueErrorrKeyErrorrrr) rr,_ scheme_key dest_subpathr( scheme_pathvalid_scheme_keysr6r) scheme_pathsrrs r>make_data_scheme_filezM_install_wheel..data_scheme_file_maker..make_data_scheme_filesl'**;77K 1.9.?.? Q.O.O+:|| 1 1 1M*MM MMM(000  1 1*:6  1 1 1$(IIf\.B.B$C$C!1*11 11!,11.111 (000 1 [,??I $ $[) < < < iBB Bs)A #A/3A<data_scheme_file_makerz._install_wheel..data_scheme_file_makerspJIII[III  Cz Cf C C C C C C C C C6%$r@c`|ddddS)Nrrr.data)rr"r#s r>is_data_scheme_pathz+_install_wheel..is_data_scheme_paths)zz#q!!!$--g666r@c|dd}t|dko&|ddo |ddkS)Nrrrr@rr)rrr")rIpartss r>is_script_scheme_pathz-_install_wheel..is_script_scheme_pathsJ 3""5zzA~V%("3"3G"<"<VqYAVVr@rc|j}tj|}|dr |dd}nf|dr |dd}n4|dr |dd}n|}|vp|vS)Nz.exez -script.pyiz.pya)r6r_rIrrtr")rrIr} matchnamerguis r>is_entrypoint_wrapperz-_install_wheel..is_entrypoint_wrapper+s~w%% ::<<  ( ( SbS II ZZ\\ " "< 0 0 TcT II ZZ\\ " "6 * * SbS IIIG#7yC'77r@c3"KttD]\}tj|}tj|sB|dsX|V]dS)Nz.py)rrrr_rIrr`r")installed_pathfull_installed_pathrrs r>pyc_source_file_pathsz-_install_wheel..pyc_source_file_pathsNs %S)9)9););%<%<== & &N"$',,w"G"G 7>>"566 &//66 % % % % %  & &r@c@tj|S)z8Return the path the pyc file would have been written to.) importlibutilcache_from_sourcer#s r>pyc_output_pathz'_install_wheel..pyc_output_path[s~//555r@ignoreT)forcequietr4rrVrrHikwargsc;Kt|fi|5}|Vdddn #1swxYwYtj|jt |j|dSr:)r'r_chmodr}r()rIrVrgenerated_file_modes r>_generate_filez&_install_wheel.._generate_files t . .v . . !GGG                ,---s "&& INSTALLERspip rW REQUESTEDr^RECORD)rr7rrwzIO[str])F)Tr1rupurelibplatlibrr4rFrGrr r&rrnamelistrr,maprr"r!rrrr_rIrr6r*rr?r5r7r contextlibredirect_stdoutr) from_streamrdstdoutwarningscatch_warningsfilterwarnings compileall compile_filerr(rrdebuggetvaluerrclobbervariantsset_moderlistrrr make_multiplerrrr-contextmanagerr r rrjrr#to_jsonrfra read_textcsvreader splitlinesrrZwriter writerowsr)Ar}rrrrrrrinfo_dirrprr r$r.r>rApaths file_pathsroot_scheme_pathsdata_scheme_pathsr-filesrDother_scheme_pathsscript_scheme_pathsr=other_scheme_files distributionrIscript_scheme_filesexisting_parentsrrrMrRrfrIsuccesspyc_pathpyc_record_pathmakerrgui_scripts_to_generategenerated_console_scriptsmsgrZ dest_info_dirinstaller_pathinstaller_filedirect_url_pathdirect_url_filerequested_path record_text record_rowsrowsr record_fileryr)r7rrYrHrrsA ` @@@@@@@r>_install_wheelrs 2%Y55HhX&&!.. /1I"uuGI>C!!!'*!6:! !!!!!!!!"*"""""#$ % %!$ % :,& ' % % % % % % % %#) % :,& ' % % % % % % %D7*77777 j!9#5#5#7#7 8 8E[%00J+45H*+U+U((229gFF 57HIIEWJW4WWWW/80//++329fEE24FGG %+ , ,E* ##$L#<00LGS8F8t8888888 +.2++&&;=PQQj*=>> %, - -Euu M MW__T^44 - - - z " " "   , , , -t~t|LLLL &9S$_#= & & & & & & &6c6c6666 (  '  %cj 1 1  D (** D D'1111133DDD(5d$dSSSGD#2?4#8#8!w~~h77777*.((*:*:27;*L*L++)((CCCD D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D  V__&&''' 4 0 0EEM TEN EN37;;"79+;SYY[[#I#IJJ % 3 34G H H ./// U(()@5$-PPQQQ /0IJJ ? NN3   =??"22SCIhd>R4S GLL(33MW\\-==N  ' ''>X&&&''''''''''''''' ^$$$',,}6NOO ^O , , H  ! !*"4"4"6"6"="=g"F"F G G G H H H H H H H H H H H H H H H))))m[AA .$ ' '                  (((((22Ksz+"8"8":":;;<req_error_contextrsb0  000 install_wheelrs   - - -   / /   %#%9%#                                     s3AA AA A A AA"%A")rH)TTNF)j__doc__rrjrcrvrOloggingos.pathr_rrrdrgbase64r email.messager itertoolsrrrtypingrr r r r r rrrrrrrrrrrzipfilerrpip._vendor.distlib.scriptsrpip._vendor.distlib.utilrpip._vendor.packaging.utilsrpip._internal.exceptionsrpip._internal.locationsrpip._internal.metadatar r!r"pip._internal.models.direct_urlr#r$pip._internal.models.schemer%r&pip._internal.utils.filesystemr'r(pip._internal.utils.miscr)r*r+r,pip._internal.utils.unpackingr-r.r/r0pip._internal.utils.wheelr1r3 getLoggerrBrrFr4intInstalledCSVRowrSrZrGrorurrrrrrrrrrrrrrsrrr;r@r>rsLL  $$$$$$!!!!!!1111111111&%$$$$$$$333333555555999999666666;;;;;; POOOOOOO;;;;;;;;EEEEEEEETTTTTTTTTTTT 211111     8     8 $ $ W\3 ' '  CsCx89!!!!5c?!!!!>>S#X>>>>ST(AGAAAAA(*(uT#s(^T#s(^5S/T((((E x}E #E E E E P o & %S# 4.J......$S$3$:$$$$tCy/J *+_Cy     / @Hd38nHcHHHHV#O#O#O#O#O#O#O#OL 2 2 2 2 2 2 2 2     -   000000 44444[444!%&*^4^4 ^4^4^4  ^4  ^4  ^4#^4^4 ^4^4^4^4B  0s0y9I/J0000!%&*       # r@