aboutsummaryrefslogtreecommitdiffstats
path: root/library/python/runtime_py3/sitecustomize.pyx
diff options
context:
space:
mode:
authorAlexander Smirnov <alex@ydb.tech>2024-04-16 09:11:59 +0000
committerAlexander Smirnov <alex@ydb.tech>2024-04-16 09:11:59 +0000
commit25de1d521ca218e2b040739fea77a39e9fc543e9 (patch)
tree21521d8866cf1462dbd52c071cf369974c29650e /library/python/runtime_py3/sitecustomize.pyx
parentbf444b8ed4d0f6bf17fd753e2cf88f9440012e87 (diff)
parent0a63d9ddc516f206f2b8745ce5e5dfa60190d755 (diff)
downloadydb-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.pyx14
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