\bgb^ddlZddlZddlZddlZddlZddlZddlZddlZddl m Z m Z m Z m Z mZmZmZmZmZmZmZmZmZddlmZddlmZmZddlmZmZddlm Z ddl!m"Z"ddl#m$Z$m%Z%dd l&m'Z'm(Z(m)Z)dd l*m+Z+dd l,m-Z-dd l.m/Z/m0Z0dd l1m2Z2ddl3m4Z4ee5ej6fZ7ej8e9Z:GddeZ;dee5dfdee5dfde5fdZ<GddeZ=GddeZ>GddZ?GddeZ@Gdd e@ZAGd!d"e@ZBdS)#N) IOAny Collection ContainerDictIterableIteratorList NamedTupleOptionalProtocolTupleUnion) Requirement)InvalidSpecifier SpecifierSet)NormalizedNamecanonicalize_name)Version)NoneMetadataError) site_packages user_site)DIRECT_URL_METADATA_NAME DirectUrlDirectUrlValidationError) stdlib_pkgs)egg_link_path_from_sys_path)is_localnormalize_path) url_to_path) msg_to_jsoncbeZdZedefdZedefdZedefdZdS)BaseEntryPointreturnctNNotImplementedErrorselfs l/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/pip/_internal/metadata/base.pynamezBaseEntryPoint.name2!###ctr'r(r*s r,valuezBaseEntryPoint.value6r.r/ctr'r(r*s r,groupzBaseEntryPoint.group:r.r/N)__name__ __module__ __qualname__propertystrr-r1r3r/r,r$r$1s $c$$$X$$s$$$X$$s$$$X$$$r/r$entry.infor%c|rB|ddkr6|r |ddkr|dz }n |dd}|dd}|r |ddk6ttjg||RS)aConvert a legacy installed-files.txt path into modern RECORD path. The legacy format stores paths relative to the info directory, while the modern format stores paths relative to the package root, e.g. the site-packages directory. :param entry: Path parts of the installed-files.txt entry. :param info: Path parts of the egg-info directory relative to package root. :returns: The converted entry. For best compatibility with symlinks, this does not use ``abspath()`` or ``Path.resolve()``, but tries to work with path parts: 1. While ``entry`` starts with ``..``, remove the equal amounts of parts from ``info``; if ``info`` is empty, start appending ``..`` instead. 2. Join the two directly. r..)r=Nr!r8pathlibPath)r:r;s r,_convert_installed_files_pathrB?s* E!H$$ tBx4'' GODD9Dabb  E!H$$ w|*T*E*** + ++r/c.eZdZUeed<eed<eed<dS) RequiresEntry requirementextramarkerN)r4r5r6r8__annotations__r9r/r,rDrD]s. JJJ KKKKKr/rDc JeZdZededdfdZededededdfdZedd d eddfd Zdefd Z defd Z e de efdZ e de efdZe de efdZe de efdZe defdZe defdZe defdZe defdZe defdZe defdZe defdZe defdZe de efdZe defdZe defdZe defdZ e defdZ!e defdZ"e defd Z#d!e$defd"Z%de&efd#Z'd!e$defd$Z(de)e*fd%Z+de,j-j.fd&Z/e0j1de,j-j.fd'Z2e de3ee4ffd(Z5e de efd)Z6e defd*Z7e de8fd+Z9d:d-e:ede)e;fd.Zde e&efd1Z?de e&efd2Z@de e&efd3ZAde&eBfd4ZCde)efd5ZDde)efd6ZEd7e,j-j.dd8fd9ZFd8S);BaseDistribution directoryr%ct)zLoad the distribution from a metadata directory. :param directory: Path to a metadata directory, e.g. ``.dist-info``. r()clsrKs r,from_directoryzBaseDistribution.from_directoryd "###r/metadata_contentsfilename project_namect)aLoad the distribution from the contents of a METADATA file. This is used to implement PEP 658 by generating a "shallow" dist object that can be used for resolution without downloading or building the actual dist yet. :param metadata_contents: The contents of a METADATA file. :param filename: File name for the dist with this metadata. :param project_name: Name of the project this dist represents. r()rMrPrQrRs r,from_metadata_file_contentsz,BaseDistribution.from_metadata_file_contentsls "###r/wheelWheelr-ct)aLoad the distribution from a given wheel. :param wheel: A concrete wheel definition. :param name: File name of the wheel. :raises InvalidWheel: Whenever loading of the wheel causes a :py:exc:`zipfile.BadZipFile` exception to be thrown. :raises UnsupportedWheel: If the wheel is a valid zip, but malformed internally. r()rMrUr-s r, from_wheelzBaseDistribution.from_wheel~"###r/c6|jd|jd|jdS)N z ())raw_name raw_versionlocationr*s r,__repr__zBaseDistribution.__repr__s(-FF$"2FFdmFFFFr/c$|jd|jS)Nr[)r]r^r*s r,__str__zBaseDistribution.__str__s-44$"2444r/ct)aWhere the distribution is loaded from. A string value is not necessarily a filesystem path, since distributions can be loaded from other sources, e.g. arbitrary zip archives. ``None`` means the distribution is created in-memory. Do not canonicalize this value with e.g. ``pathlib.Path.resolve()``. If this is a symbolic link, we want to preserve the relative path between it and files in the distribution. r(r*s r,r_zBaseDistribution.locationrYr/c|j}|r)|rt|jSnt |j}|r|jSdS)zThe project location for editable distributions. This is the directory where pyproject.toml or setup.py is located. None if the distribution is not installed in editable mode. N) direct_urlis_local_editabler urlrr]r_)r+re egg_link_paths r,editable_project_locationz*BaseDistribution.editable_project_locationsd_  %++-- 3":>222 3 8 FFM %}$tr/ct)aThe distribution's "installed" location. This should generally be a ``site-packages`` directory. This is usually ``dist.location``, except for legacy develop-installed packages, where ``dist.location`` is the source code location, and this is where the ``.egg-link`` file is. The returned location is normalized (in particular, with symlinks removed). r(r*s r,installed_locationz#BaseDistribution.installed_locations"###r/ct)a/Location of the .[egg|dist]-info directory or file. Similarly to ``location``, a string value is not necessarily a filesystem path. ``None`` means the distribution is created in-memory. For a modern .dist-info installation on disk, this should be something like ``{location}/{raw_name}-{version}.dist-info``. Do not canonicalize this value with e.g. ``pathlib.Path.resolve()``. If this is a symbolic link, we want to preserve the relative path between it and other files in the distribution. r(r*s r, info_locationzBaseDistribution.info_locations"###r/cd|j}|sdStj|S)aWhether this distribution is installed with legacy distutils format. A distribution installed with "raw" distutils not patched by setuptools uses one single file at ``info_location`` to store metadata. We need to treat this specially on uninstallation. F)rmr@rAis_filer+rms r,installed_by_distutilsz'BaseDistribution.installed_by_distutilss5*  5|M**22444r/cB|j}|sdS|dS)zWhether this distribution is installed as an egg. This usually indicates the distribution was installed by (older versions of) easy_install. Fz.egg)r_endswithr+r_s r,installed_as_eggz!BaseDistribution.installed_as_eggs,= 5  (((r/c|j}|sdS|dsdStj|S)aWhether this distribution is installed with the ``.egg-info`` format. This usually indicates the distribution was installed with setuptools with an old pip version or with ``single-version-externally-managed``. Note that this ensure the metadata store is a directory. distutils can also installs an ``.egg-info``, but as a file, not a directory. This property is *False* for that case. Also see ``installed_by_distutils``. Fz .egg-informrsr@rAis_dirrps r,"installed_with_setuptools_egg_infoz3BaseDistribution.installed_with_setuptools_egg_infosP*  5%%k22 5|M**11333r/c|j}|sdS|dsdStj|S)aaWhether this distribution is installed with the "modern format". This indicates a "modern" installation, e.g. storing metadata in the ``.dist-info`` directory. This applies to installations made by setuptools (but through pip, not directly), or anything using the standardized build backend interface (PEP 517). Fz .dist-inforwrps r,installed_with_dist_infoz)BaseDistribution.installed_with_dist_infosP*  5%%l33 5|M**11333r/ctr'r(r*s r,canonical_namezBaseDistribution.canonical_namer.r/ctr'r(r*s r,versionzBaseDistribution.versionr.r/ctr'r(r*s r,r^zBaseDistribution.raw_versionr.r/c8|jddS)zConvert a project name to its setuptools-compatible filename. This is a copy of ``pkg_resources.to_filename()`` for compatibility. -_)r]replacer*s r,setuptools_filenamez$BaseDistribution.setuptools_filenames }$$S#...r/c( |t}n#t$rYdSwxYw tj|S#t t jtf$r2}t dt|j |Yd}~dSd}~wwxYw)zObtain a DirectUrl from this distribution. Returns None if the distribution has no `direct_url.json` metadata, or if `direct_url.json` is invalid. NzError parsing %s for %s: %s) read_textrFileNotFoundErrorr from_jsonUnicodeDecodeErrorjsonJSONDecodeErrorrloggerwarningr})r+contentes r,rezBaseDistribution.direct_url"s nn%=>>GG    44  &w// /   $    NN-(#     44444 s# ++AB'B  Bc |d}n#tttf$rYdSwxYw|D]}|}|r|cSdS)N INSTALLER)rOSError ValueErrorr splitlinesstrip)r+installer_textline cleaned_lines r, installerzBaseDistribution.installer<s !^^K88NN%67   22 "--// $ $D::<> ! "E ++DD " " "EG NN7DM1 5 5 5>> ! ! ! ! ! ! " sA B0B B Br9extrasct)zDependencies of this distribution. For modern .dist-info distributions, this is the collection of "Requires-Dist:" entries in distribution metadata. r()r+rs r,iter_dependenciesz"BaseDistribution.iter_dependenciesrOr/c8|jdgS)zRaw Requires-Dist metadata. Requires-Dist)rget_allr*s r,iter_raw_dependenciesz&BaseDistribution.iter_raw_dependenciess}$$_b999r/ct)ajExtras provided by this distribution. For modern .dist-info distributions, this is the collection of "Provides-Extra:" entries in distribution metadata. The return value of this function is expected to be normalised names, per PEP 685, with the returned value being handled appropriately by `iter_dependencies`. r(r*s r,iter_provided_extrasz%BaseDistribution.iter_provided_extrass"###r/c |d}n#t$rYdSwxYwdtj|DS)NRECORDc3dK|]+}ttj|dV,dS)rNr?).0rows r, zFBaseDistribution._iter_declared_entries_from_record..s8SScGLQ(())SSSSSSr/)rrcsvreaderr)r+texts r,"_iter_declared_entries_from_recordz3BaseDistribution._iter_declared_entries_from_recordsg >>(++DD    44 TSSZ@Q@Q5R5RSSSSs  &&c` |d}n#t$rYdSwxYwd|dD}|j}|j}|||S t j||n#t$r|cYSwxYwj s|Sfd|DS)Nzinstalled-files.txtc3K|]}||V dSr'r9)rps r,rzFBaseDistribution._iter_declared_entries_from_legacy..s'AAqqAAAAAAAr/F)keependsc3pK|]0}ttj|jjV1dSr')rBr@rAparts)rrinfo_rels r,rzFBaseDistribution._iter_declared_entries_from_legacy..sN   *',q//*? P P      r/) rrrr_rmr@rA relative_torr)r+rpathsrootr;rs @r,"_iter_declared_entries_from_legacyz3BaseDistribution._iter_declared_entries_from_legacys >>"788DD    44 AADOOUO;;AAA}! <4<L |D))55d;;HH   LLL ~ L        s '''B BBcR|p|S)aIterate through file entries declared in this distribution. For modern .dist-info distributions, this is the files listed in the ``RECORD`` metadata file. For legacy setuptools distributions, this comes from ``installed-files.txt``, with entries normalized to be compatible with the format used by ``RECORD``. :return: An iterator for listed entries, or None if the distribution contains neither ``RECORD`` nor ``installed-files.txt``. )rrr*s r,iter_declared_entriesz&BaseDistribution.iter_declared_entriess,  3 3 5 5 96688 r/c#K |d}n#t$rYdSwxYwdx}}|D]}|}|r|dr.|drB|dr-|dd\}}}t||| VdS) aParse a ``requires.txt`` in an egg-info directory. This is an INI-ish format where an egg-info stores dependencies. A section name describes extra other environment markers, while each entry is an arbitrary string (not a key-value pair) representing a dependency as a requirement string (no markers). There is a construct in ``importlib.metadata`` called ``Sectioned`` that does mostly the same, but the format is currently considered private. z requires.txtNr#[]z[]:)rErFrG)rrrrrrs partitionrD)r+rrFrGrrs r,_iter_requires_txt_entriesz+BaseDistribution._iter_requires_txt_entriess  nn^44GG     FF &&(( N ND::<#>>>X> X$$$ 3$+AV$$$$:x}:::: $h~&> $ $ $ $THXc]4KTTTT HXc]4K    * x '>    NH],CNNNN2x}(Xc]((((83u}/D3333333r/rJceZdZdZeddZedeeeddfdZ dededfdZ de dfd Z de e fd Zd ed d d fd edeedededede e f dZdS)BaseEnvironmentz6An environment containing distributions to introspect.r%ctr'r()rMs r,defaultzBaseEnvironment.defaultIr.r/rctr'r()rMrs r, from_pathszBaseEnvironment.from_pathsMr.r/r-rJct)zGiven a requirement name, return the installed distributions. The name may not be normalized. The implementation must canonicalize it for lookup. r()r+r-s r,get_distributionz BaseEnvironment.get_distributionQrOr/ct)aIterate through installed distributions. This function should be implemented by subclass, but never called directly. Use the public ``iter_distribution()`` instead, which implements additional logic to make sure the distributions are valid. r(r*s r,_iter_distributionsz#BaseEnvironment._iter_distributionsYrr/c#K|D]U}tjd|jtj}|s't d|j|jQ|VVdS)zBIterate through all installed distributions without any filtering.z)^([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])$)flagsz%Ignoring invalid distribution %s (%s)N)rrematchr} IGNORECASErrr_)r+distproject_name_valids r,iter_all_distributionsz&BaseEnvironment.iter_all_distributionsbs,,..  D "$<#m"""  & ;'M JJJJ#  r/TF local_onlyskipinclude_editableseditables_only user_onlyc|}|r d|D}|s d|D}|r d|D}|r d|D}fd|DS)a/Return a list of installed distributions. This is based on ``iter_all_distributions()`` with additional filtering options. Note that ``iter_installed_distributions()`` without arguments is *not* equal to ``iter_all_distributions()``, since some of the configurations exclude packages by default. :param local_only: If True (default), only return installations local to the current virtualenv, if in a virtualenv. :param skip: An iterable of canonicalized project names to ignore; defaults to ``stdlib_pkgs``. :param include_editables: If False, don't report editables. :param editables_only: If True, only report editables. :param user_only: If True, only report installations in the user site directory. c3(K|] }|j |VdSr')rrds r,rz?BaseEnvironment.iter_installed_distributions..s)++17+!++++++r/c3(K|] }|j |VdSr'rrs r,rz?BaseEnvironment.iter_installed_distributions..s)22qz2!222222r/c3(K|] }|j |VdSr'rrs r,rz?BaseEnvironment.iter_installed_distributions..s)..1:.!......r/c3(K|] }|j |VdSr')rrs r,rz?BaseEnvironment.iter_installed_distributions..s)111=1!111111r/c3.K|]}|jv |VdSr')r})rrrs r,rz?BaseEnvironment.iter_installed_distributions..s0>>a!1!=!=!=!=!=!=>>r/)r )r+rrrrrits ` r,iter_installed_distributionsz,BaseEnvironment.iter_installed_distributionsws0 ( ( * *  ,++R+++B  322R222B  /..R...B  211R111B>>>>2>>>>r/N)r%r)r4r5r6__doc__rrr r r8rrr rrJr rrrrr9r/r,rrFsH@@$$$[$$xS 2$7H$$$[$$S$X6H-I$$$$$X.@%A$$$$1A(B. *"&$ !?!?!?n!? !?  !?  !? " #!?!?!?!?!?!?r/rc0eZdZUeed<dejfdZdS)rVr_r%ctr'r(r*s r, as_zipfilezWheel.as_zipfilerr/N)r4r5r6r8rHzipfileZipFiler!r9r/r,rVrVs<MMM$GO$$$$$$r/rVc4eZdZdeddfdZdejfdZdS)FilesystemWheelr_r%Nc||_dSr')r_rts r,__init__zFilesystemWheel.__init__s   r/c8tj|jdSNT) allowZip64)r"r#r_r*s r,r!zFilesystemWheel.as_zipfilest}>>>>r/)r4r5r6r8r'r"r#r!r9r/r,r%r%sS!!!!!!?GO??????r/r%cDeZdZdedeeddfdZdejfdZ dS) MemoryWheelr_streamr%Nc"||_||_dSr')r_r-)r+r_r-s r,r'zMemoryWheel.__init__s   r/c8tj|jdSr))r"r#r-r*s r,r!zMemoryWheel.as_zipfilest{t<<<rAs    ;:::::KKKKKKKKIIIIIIII111111666666<<<<<<<< 322222DDDDDD========000000 g&& '  8 $ $ $ $ $ $ $X $ $ $, c?, S/, ,,,,<J `3`3`3`3`3x`3`3`3FR?R?R?R?R?R?R?R?j$$$$$H$$$?????e???=====%=====r/