kghddlZddlZddlZddlZddlZddlZddlmZm Z m Z m Z m Z m Z ddlmZmZmZmZddlmZmZddlmZddlmZmZmZmZddlmZeje Z!d e"d e#fd Z$Gd d Z%GddeZ&dS)N)IteratorListOptionalSequenceSetTuple)InvalidWheelFilenameNormalizedNamecanonicalize_nameparse_wheel_filename)BaseDistributionBaseEnvironment)WHEEL_EXTENSION) BadMetadataBasePathget_dist_canonical_nameget_info_location) Distributionlocationreturnc"|tsdStj|sdS t tj|n#t$rYdSwxYwtj |S)NF) endswithrospathisfiler basenamer zipfile is_zipfile)rs /builddir/build/BUILD/imunify360-venv-2.6.0/opt/imunify360/venv/lib/python3.11/site-packages/pip/_internal/metadata/importlib/_envs.py_looks_like_wheelr!s   _ - -u 7>>( # #uRW--h778888 uu  h ' ''s,A,, A:9A:ceZdZdZeejjee fZ d dZ de de e fdZde de efdZde de efdZdS) _DistributionFindera$Finder to locate distributions. The main purpose of this class is to memoize found distributions' names, so only one distribution is returned for each package name. At lot of pip code assumes this (because it is setuptools's behavior), and not doing the same can potentially cause a distribution in lower precedence path to override a higher precedence one if the caller is not careful. Eventually we probably want to make it possible to see lower precedence installations as well. It's useful feature, after all. rNc,t|_dSN)set _found_names)selfs r __init__z_DistributionFinder.__init__4s14rc#xKt|rdStj|gD]}t |} t |}n8#t $r+}td||j Yd}~Rd}~wwxYw||j vrd|j |||fVdS)z!Find distributions in a location.N)rzSkipping %s due to %s) r! importlibmetadata distributionsrrrloggerwarningreasonr'add)r(rdist info_locationnamees r _find_implz_DistributionFinder._find_impl7s X & &  F&448*4EE & &D-d33M .t44   6 qxPPP t(((   ! !$ ' ' ' % % % % % & &sA B !!BB c#~K||D]$\}}|d}n|j}t|||V%dS)ziFind distributions in a location. The path can be either a directory, or a ZIP archive. N)r7parentr)r(rr3r4installed_locations r findz_DistributionFinder.findLsj $(??8#<#< H H D-$9=""%2%9"t]4FGG G G G G  H Hr*c#Ktj|}|sdS|D]}|jdkr|5}d|D}t d|Dd}dddn #1swxYwY|sct||}| |D]\}} t|| |VdS)aRead location in egg-link files and return distributions in there. The path should be a directory; otherwise this returns nothing. This follows how setuptools does this for compatibility. The first non-empty line in the egg-link is read as a path (resolved against the egg-link's containing directory if relative). Distributions found at that linked location are returned. Nz .egg-linkc3>K|]}|VdSr%)strip.0lines r z<_DistributionFinder.find_legacy_editables..hs*44$444444r*c3K|]}||V dSr%r?s r rBz<_DistributionFinder.find_legacy_editables..is'"B"BDT"B4"B"B"B"B"B"Br*) pathlibPathis_diriterdirsuffixopennextstrjoinpathr7r) r(rrchildflines target_reltarget_locationr3r4s r find_legacy_editablesz)_DistributionFinder.find_legacy_editablesXsd|H%%{{}}  F\\^^ > >E|{** H44!444!"B"BE"B"B"BBGG  H H H H H H H H H H H H H H H !$-- ";";< >#m"4====== > > >s#'BB B )rN)__name__ __module__ __qualname____doc__rr,r-rrr FoundResultr)rMrr7r r;rTrDr*r r#r#%s   *7(9KKLK7777&3&8K+@&&&&* HS HX.>%? H H H H>c>h?O6P>>>>>>r*r#ceZdZdeeddfdZedefdZede e edefdZ de e fdZdede e fd ZdS) EnvironmentpathsrNc||_dSr%)_paths)r(r\s r r)zEnvironment.__init__rs  r*c,|tjSr%sysr)clss r defaultzEnvironment.defaultuss38}}r*cF||tjS||Sr%r`)rbr\s r from_pathszEnvironment.from_pathsys% =3sx== s5zzr*c#Kt}|jD]8}||Ed{V||Ed{V9dSr%)r#r^r;rT)r(finderrs r _iter_distributionszEnvironment._iter_distributionssy$&&  > >H{{8,, , , , , , , ,33H== = = = = = = = = > >r*r5ct|fd|D}t|dS)Nc32K|]}|jk |VdSr%)canonical_name)r@ distributionrks r rBz/Environment.get_distribution..s=  *n<< <<<<  r*)r iter_all_distributionsrL)r(r5matchesrks @r get_distributionzEnvironment.get_distributionsV*400    $ ; ; = =    GT"""r*)rUrVrWrrMr) classmethodrrcrrrerr rhrorDr*r r[r[qshsm[xS 2[ >X.>%?>>>> #S#X6F-G######r*r[)'importlib.metadatar,loggingrrFrartypingrrrrrrpip._vendor.packaging.utilsr r r r pip._internal.metadata.baser rpip._internal.utils.filetypesr_compatrrrr_distsr getLoggerrUr/rMboolr!r#r[rDr*r r{s  AAAAAAAAAAAAAAAAJIIIIIII999999VVVVVVVVVVVV  8 $ $ ( ( ( ( ( (I>I>I>I>I>I>I>I>X#####/#####r*