o ai_+@sRddlZddlZddlZddlZddlZddlmZmZm Z m Z m Z m Z m Z mZmZddlmZddlmZmZddlmZddlmZmZddlmZmZmZddlmZdd l m!Z!dd l"m#Z#erkdd lm$Z$ne%Z$eeefZ&e'e(Z)Gd d d e$Z*Gddde$Z+GdddZ,Gddde$Z-Gddde-Z.Gddde-Z/dS)N) IO TYPE_CHECKING Collection ContainerIterableIteratorListOptionalUnion) Requirement)InvalidSpecifier SpecifierSet)NormalizedName) LegacyVersionVersion)DIRECT_URL_METADATA_NAME DirectUrlDirectUrlValidationError) stdlib_pkgs)egg_link_path_from_sys_path) url_to_path)Protocolc@sBeZdZedefddZedefddZedefddZdS) BaseEntryPointreturncCtNNotImplementedErrorselfr /builddir/build/BUILDROOT/alt-python310-pip-21.3.1-5.el8.x86_64/opt/alt/python310/lib/python3.10/site-packages/pip/_internal/metadata/base.pyname+zBaseEntryPoint.namecCrrrrr r r!value/r#zBaseEntryPoint.valuecCrrrrr r r!group3r#zBaseEntryPoint.groupN)__name__ __module__ __qualname__propertystrr"r$r%r r r r!r*src@seZdZdefddZdefddZedeefddZedeefdd Z edeefd d Z ede fd d Z ede fddZedeefddZedefddZedefddZedefddZedefddZedefddZdedefddZdeefdd Zedejjfd!d"Zedeefd#d$Zedefd%d&Z ede!fd'd(Z"d0d*e#edee$fd+d,Z%deefd-d.Z&d/S)1BaseDistributionrcCs|jd|jd|jdS)N z ())raw_nameversionlocationrr r r!__repr__9szBaseDistribution.__repr__cCs|jd|jS)Nr,)r.r/rr r r!__str__<szBaseDistribution.__str__cCr)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. rrr r r!r0?s zBaseDistribution.locationcCs8|j}|r|rt|jSdSt|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.r0)rr3 egg_link_pathr r r!editable_project_locationMs  z*BaseDistribution.editable_project_locationcCr)a'Location of the .[egg|dist]-info directory. 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. rrr r r!info_directorycszBaseDistribution.info_directorycCrrrrr r r!canonical_namesr#zBaseDistribution.canonical_namecCrrrrr r r!r/wr#zBaseDistribution.versionc Csrz|t}Wn tyYdSwzt|WSttjtfy8}zt dt|j |WYd}~dSd}~ww)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_jsonUnicodeDecodeErrorjsonJSONDecodeErrorrloggerwarningr9)rcontenter r r!r3{s*   zBaseDistribution.direct_urlcCrrrrr r r! installerr#zBaseDistribution.installercCs t|jSr)boolr7rr r r!editables zBaseDistribution.editablecCrrrrr r r!localr#zBaseDistribution.localcCrrrrr r r! in_usersiter#zBaseDistribution.in_usersitecCrrrrr r r!in_site_packagesr#z!BaseDistribution.in_site_packagesr"cCr)zRead a file in the .dist-info (or .egg-info) directory. Should raise ``FileNotFoundError`` if ``name`` does not exist in the metadata directory. rrr"r r r!r:zBaseDistribution.read_textcCrrrrr r r!iter_entry_pointsz"BaseDistribution.iter_entry_pointscCr)z?Metadata of distribution parsed from e.g. METADATA or PKG-INFO.rrr r r!metadataszBaseDistribution.metadatacCs |jdS)zDValue of "Metadata-Version:" in distribution metadata, if available.zMetadata-Version)rNgetrr r r!metadata_versions z!BaseDistribution.metadata_versioncCs|jd|jS)z*Value of "Name:" in distribution metadata.Name)rNrOr9rr r r!r.szBaseDistribution.raw_namec Csl|jd}|dur tSz tt|}W|Sty5}zd}t||j|tWYd}~Sd}~ww)zValue of "Requires-Python:" in distribution metadata. If the key does not exist or contains an invalid value, an empty SpecifierSet should be returned. zRequires-PythonNz-Package %r has an invalid Requires-Python: %s)rNrOr r*r r@rAr.)rr$specrCmessager r r!requires_pythons z BaseDistribution.requires_pythonr extrascCr)zDependencies of this distribution. For modern .dist-info distributions, this is the collection of "Requires-Dist:" entries in distribution metadata. r)rrUr r r!iter_dependenciesrKz"BaseDistribution.iter_dependenciescCr)zExtras provided by this distribution. For modern .dist-info distributions, this is the collection of "Provides-Extra:" entries in distribution metadata. rrr r r!iter_provided_extrasrKz%BaseDistribution.iter_provided_extrasN)r )'r&r'r(r*r1r2r)r r0r7r8rr9DistributionVersionr/rr3rDrErFrGrHrIr:rrrLemailrSMessagerNrPr.r rTrr rVrWr r r r!r+8sJ r+c@seZdZdZedddZedeeeddfddZ deded fd d Z de d fd d Z de d fddZ dedddfdedeedededede ef ddZdS)BaseEnvironmentz6An environment containing distributions to introspect.rcCrrr)clsr r r!defaultr#zBaseEnvironment.defaultpathscCrrr)r\r^r r r! from_pathsr#zBaseEnvironment.from_pathsr"r+cCr)z=Given a requirement name, return the installed distributions.rrJr r r!get_distributionr#z BaseEnvironment.get_distributioncCr)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. rrr r r!_iter_distributionssz#BaseEnvironment._iter_distributionsccsF|D]}tjd|jtjd}|std|j|jq|VqdS)z(Iterate through installed distributions.z)^([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])$)flagsz%Ignoring invalid distribution %s (%s)N)rarematchr9 IGNORECASEr@rAr0)rdistproject_name_validr r r!iter_distributionss  z"BaseEnvironment.iter_distributionsTF local_onlyskipinclude_editableseditables_only user_onlycsb|}|r dd|D}|sdd|D}|rdd|D}|r(dd|D}fdd|DS)aReturn a list of installed distributions. :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. cs|]}|jr|VqdSr)rG.0dr r r! +z?BaseEnvironment.iter_installed_distributions..css|]}|js|VqdSrrFror r r!rr-rscsrnrrtror r r!rr/rscsrnr)rHror r r!rr1rsc3s|] }|jvr|VqdSr)r9rorjr r!rr2s)rh)rrirjrkrlrmitr rur!iter_installed_distributionssz,BaseEnvironment.iter_installed_distributionsN)rr[)r&r'r(__doc__ classmethodr]r rr*r_r`rrarhrrErr+rwr r r r!r[s6  r[c@s&eZdZUeed<dejfddZdS)Wheelr0rcCrrrrr r r! as_zipfile8rMzWheel.as_zipfileN)r&r'r(r*__annotations__zipfileZipFiler{r r r r!rz5s rzc@s.eZdZdeddfddZdejfddZdS)FilesystemWheelr0rNcCs ||_dSr)r0)rr0r r r!__init__=s zFilesystemWheel.__init__cCtj|jddSNT) allowZip64)r}r~r0rr r r!r{@zFilesystemWheel.as_zipfile)r&r'r(r*rr}r~r{r r r r!r<src@s6eZdZdedeeddfddZdejfddZ dS) MemoryWheelr0streamrNcCs||_||_dSr)r0r)rr0rr r r!rEs zMemoryWheel.__init__cCrr)r}r~rrr r r!r{IrzMemoryWheel.as_zipfile) r&r'r(r*rbytesrr}r~r{r r r r!rDsr)0 email.messagerYr>loggingrcr}typingrrrrrrrr r Z"pip._vendor.packaging.requirementsr Z pip._vendor.packaging.specifiersr r pip._vendor.packaging.utilsrZpip._vendor.packaging.versionrrpip._internal.models.direct_urlrrrpip._internal.utils.compatrpip._internal.utils.egg_linkrpip._internal.utils.urlsrrobjectrX getLoggerr&r@rr+r[rzrrr r r r!s4,       2L