pok 6ddlmZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z m Z mZmZddlmZmZmZmZmZddlmZddlmZmZddlmZmZddlmZdd l m!Z!dd l"m#Z#m$Z$dd l%m&Z&m'Z'm(Z(dd l)m*Z*dd l+m,Z,ddl-m.Z.m/Z/ddl0m1Z1ddl2m3Z3ee4ej5fZ6ej7e8Z9GddeZ:d&dZ;GddeZ<GddeZ=GddZ>Gd d!eZ?Gd"d#e?Z@Gd$d%e?ZAdS)') annotationsN) Collection ContainerIterableIterator)IOAny NamedTupleProtocolUnion) 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_jsoncVeZdZeddZeddZeddZdS)BaseEntryPointreturnstrctNNotImplementedErrorselfs m/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib/python3.11/site-packages/pip/_internal/metadata/base.pynamezBaseEntryPoint.name-!###ctr%r&r(s r*valuezBaseEntryPoint.value1r,r-ctr%r&r(s r*groupzBaseEntryPoint.group5r,r-Nr"r#)__name__ __module__ __qualname__propertyr+r/r1r-r*r!r!,sr $$$X$$$$X$$$$X$$$r-r!entrytuple[str, ...]infor"r#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<Nrr#pathlibPath)r8r:s r*_convert_installed_files_pathrA:s* E!H$$ tBx4'' GODD9Dabb  E!H$$ w|*T*E*** + ++r-c.eZdZUded<ded<ded<dS) RequiresEntryr# requirementextramarkerN)r3r4r5__annotations__r7r-r*rCrCXs.JJJKKKKKr-rCc*eZdZedNdZedOd ZedPd ZdQdZdQdZe dRdZ e dRdZ e dRdZ e dRdZ e dSdZe dSdZe dSdZe dSdZe dTdZe dUdZe dQdZe dQdZe dVd!Ze dQd"Ze dSd#Ze dSd$Ze dSd%Ze dSd&Ze dSd'ZdWd*ZdXd,ZdYd-ZdZd/Z d[d1Z!e"j#d[d2Z$e d\d4Z%e dRd5Z&e dQd6Z'e d]d8Z(d^d_d=Z)d`d?Z*dadAZ+dbdCZ,dbdDZ-dbdEZ.dcdGZ/d`dHZ0d`dIZ1dddLZ2dMS)eBaseDistribution directoryr#r"ct)zLoad the distribution from a metadata directory. :param directory: Path to a metadata directory, e.g. ``.dist-info``. r&)clsrJs r*from_directoryzBaseDistribution.from_directory_ "###r-metadata_contentsbytesfilename 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&)rLrOrQrRs r*from_metadata_file_contentsz,BaseDistribution.from_metadata_file_contentsgs "###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&)rLrUr+s r* from_wheelzBaseDistribution.from_wheely"###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- str | Nonect)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_editablerurlrr]r_)r)rf 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-boolcd|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)rnr?r@is_filer)rns r*installed_by_distutilsz'BaseDistribution.installed_by_distutilss5*  5|M**22444r-cR|j}|sdStj|jdkS)zWhether this distribution is installed as an egg. This usually indicates the distribution was installed by (older versions of) easy_install. Fz.egg)r_r?r@suffixr)r_s r*installed_as_eggz!BaseDistribution.installed_as_eggs2= 5|H%%,66r-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-infornendswithr?r@is_dirrrs 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-inforyrrs r*installed_with_dist_infoz)BaseDistribution.installed_with_dist_infosP*  5%%l33 5|M**11333r-rctr%r&r(s r*canonical_namezBaseDistribution.canonical_name r,r-rctr%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-DirectUrl | Nonec( |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*rfzBaseDistribution.direct_urls 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.installer9s !^^K88NN%67   22 "--// $ $D::<> ! "E ++DD " " "EG NN7DM1 5 5 5>> ! ! ! ! ! ! " sA B0B B Br7extrasCollection[str]Iterable[Requirement]ct)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_dependenciesrNr- Iterable[str]c8|jdgS)zRaw Requires-Dist metadata. Requires-Dist)rget_allr(s r*iter_raw_dependenciesz&BaseDistribution.iter_raw_dependenciess}$$_b999r-Iterable[NormalizedName]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-Iterator[str] | Nonec |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%r7)rps r*rzFBaseDistribution._iter_declared_entries_from_legacy..s'AAqqAAAAAAAr-F)keependsc3pK|]0}ttj|jjV1dSr%)rAr?r@parts)rrinfo_rels r*rzFBaseDistribution._iter_declared_entries_from_legacy..sN   *',q//*? P P      r-) rrrr_rnr?r@ 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-Iterator[RequiresEntry]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[]:)rDrErF)rrrrrrz partitionrC)r)rrErFrrs r*_iter_requires_txt_entriesz+BaseDistribution._iter_requires_txt_entriess  nn^44GG     FF &&(( N ND::<>>X> X$$$$$$:::: $ $ $ $TTTT    *    NNNN2((((8333333r-rIcneZdZdZeddZeddZdd Zdd Zdd Z de dddfddZ dS)BaseEnvironmentz6An environment containing distributions to introspect.r"ctr%r&)rLs r*defaultzBaseEnvironment.defaultFr,r-rlist[str] | Nonectr%r&)rLrs r* from_pathszBaseEnvironment.from_pathsJr,r-r+r#BaseDistribution | Nonect)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_distributionNrNr-Iterator[BaseDistribution]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_distributionsVrr-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_distributions_s,,..  D "$<#m"""  & ;'M JJJJ#  r-TF local_onlyroskipContainer[str]include_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%rr$s r*rz?BaseEnvironment.iter_installed_distributions..s)22qz2!222222r-c3(K|] }|j |VdSr%r'r$s r*rz?BaseEnvironment.iter_installed_distributions..s)..1:.!......r-c3(K|] }|j |VdSr%)rr$s r*rz?BaseEnvironment.iter_installed_distributions..s)111=1!111111r-c3.K|]}|jv |VdSr%)r)rr%rs r*rz?BaseEnvironment.iter_installed_distributions..s0>>a!1!=!=!=!=!=!=>>r-)r)r)rrrr r!its ` r*iter_installed_distributionsz,BaseEnvironment.iter_installed_distributionsts0 ( ( * *  ,++R+++B  322R222B  /..R...B  211R111B>>>>2>>>>r-N)r"r)rr r"r)r+r#r"r)r"r) rrorrrror ror!ror"r) r3r4r5__doc__rr r rrrrr,r7r-r*rrCs@@$$$[$$$$[$$$$$$$$$. *"&$ !?!?!?!?!?!?!?r-rc"eZdZUded<ddZdS)rVr#r_r"zipfile.ZipFilectr%r&r(s r* as_zipfilezWheel.as_zipfilerr-Nr"r/)r3r4r5rGr1r7r-r*rVrVs3MMM$$$$$$r-rVceZdZd dZd dZdS) FilesystemWheelr_r#r"rc||_dSr%)r_rvs r*__init__zFilesystemWheel.__init__s   r-r/c8tj|jdSNT) allowZip64)zipfileZipFiler_r(s r*r1zFilesystemWheel.as_zipfilest}>>>>r-N)r_r#r"rr2r3r4r5r6r1r7r-r*r4r4s<!!!!??????r-r4ceZdZd dZd d Zd S) MemoryWheelr_r#stream IO[bytes]r"rc"||_||_dSr%)r_r?)r)r_r?s r*r6zMemoryWheel.__init__s   r-r/c8tj|jdSr8)r:r;r?r(s r*r1zMemoryWheel.as_zipfilest{t<<<r>s<======r-r>)r8r9r:r9r"r#)B __future__rr email.messageemailrrloggingr?rr:collections.abcrrrrtypingrr r r r "pip._vendor.packaging.requirementsr pip._vendor.packaging.specifiersrrpip._vendor.packaging.utilsrrpip._vendor.packaging.versionrpip._internal.exceptionsrpip._internal.locationsrrpip._internal.models.direct_urlrrrpip._internal.utils.compatrpip._internal.utils.egg_linkrpip._internal.utils.miscrrpip._internal.utils.urlsr_jsonrr#PurePathr getLoggerr3rr!rArCrIrrVr4r>r7r-r*rWs[""""""   EEEEEEEEEEEE;:::::KKKKKKKKIIIIIIII111111666666<<<<<<<< 322222DDDDDD========000000 g&& '  8 $ $ $ $ $ $ $X $ $ $,,,,<J b3b3b3b3b3xb3b3b3JR?R?R?R?R?R?R?R?j$$$$$H$$$?????e???=====%=====r-