diff options
author | Alexander Smirnov <alex@ydb.tech> | 2024-04-16 09:11:59 +0000 |
---|---|---|
committer | Alexander Smirnov <alex@ydb.tech> | 2024-04-16 09:11:59 +0000 |
commit | 25de1d521ca218e2b040739fea77a39e9fc543e9 (patch) | |
tree | 21521d8866cf1462dbd52c071cf369974c29650e /library/python/runtime_py3/sitecustomize.pyx | |
parent | bf444b8ed4d0f6bf17fd753e2cf88f9440012e87 (diff) | |
parent | 0a63d9ddc516f206f2b8745ce5e5dfa60190d755 (diff) | |
download | ydb-25de1d521ca218e2b040739fea77a39e9fc543e9.tar.gz |
Merge branch 'rightlib' into mergelibs-240416-0910
Diffstat (limited to 'library/python/runtime_py3/sitecustomize.pyx')
-rw-r--r-- | library/python/runtime_py3/sitecustomize.pyx | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/library/python/runtime_py3/sitecustomize.pyx b/library/python/runtime_py3/sitecustomize.pyx index 46ca0f986e..7a73f3241b 100644 --- a/library/python/runtime_py3/sitecustomize.pyx +++ b/library/python/runtime_py3/sitecustomize.pyx @@ -8,7 +8,6 @@ import warnings from importlib.metadata import ( Distribution, DistributionFinder, - PackageNotFoundError, Prepared, ) from importlib.resources.abc import Traversable @@ -129,7 +128,7 @@ class ArcadiaDistribution(Distribution): return self._path.parent / path -class ArcadiaMetadataFinder(DistributionFinder): +class MetadataArcadiaFinder(DistributionFinder): prefixes = {} @classmethod @@ -148,8 +147,7 @@ class ArcadiaMetadataFinder(DistributionFinder): data = __res.resfs_read(resource).decode("utf-8") metadata_name = METADATA_NAME.search(data) if metadata_name: - metadata_name = Prepared(metadata_name.group(1)) - cls.prefixes[metadata_name.normalized] = resource[: -len("METADATA")] + cls.prefixes[Prepared(metadata_name.group(1)).normalized] = resource.removesuffix("METADATA") @classmethod def _search_prefixes(cls, name): @@ -160,12 +158,6 @@ class ArcadiaMetadataFinder(DistributionFinder): try: yield cls.prefixes[Prepared(name).normalized] except KeyError: - raise PackageNotFoundError(name) + pass else: yield from sorted(cls.prefixes.values()) - - -# monkeypatch standart library -import importlib.metadata - -importlib.metadata.MetadataPathFinder = ArcadiaMetadataFinder |