diff options
author | shadchin <shadchin@yandex-team.com> | 2024-02-07 09:25:06 +0300 |
---|---|---|
committer | shadchin <shadchin@yandex-team.com> | 2024-02-07 09:40:03 +0300 |
commit | 3139d9ab6df2a7014d19b87582466d17b4f496e2 (patch) | |
tree | 7fcb26a72dac212aa26beaaa7cd769fb1e396b5e /contrib/tools/python3/src/Lib/site.py | |
parent | 4c04a8d1e278e6ca7ff16c11b74b2f16fc144253 (diff) | |
download | ydb-3139d9ab6df2a7014d19b87582466d17b4f496e2.tar.gz |
Update Python 3 to 3.11.8
Diffstat (limited to 'contrib/tools/python3/src/Lib/site.py')
-rw-r--r-- | contrib/tools/python3/src/Lib/site.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/contrib/tools/python3/src/Lib/site.py b/contrib/tools/python3/src/Lib/site.py index 7a45a185c1..bce2841b60 100644 --- a/contrib/tools/python3/src/Lib/site.py +++ b/contrib/tools/python3/src/Lib/site.py @@ -74,6 +74,7 @@ import os import builtins import _sitebuiltins import io +import stat # Prefixes for site-packages; add additional prefixes like /usr/local here PREFIXES = [sys.prefix, sys.exec_prefix] @@ -168,6 +169,14 @@ def addpackage(sitedir, name, known_paths): else: reset = False fullname = os.path.join(sitedir, name) + try: + st = os.lstat(fullname) + except OSError: + return + if ((getattr(st, 'st_flags', 0) & stat.UF_HIDDEN) or + (getattr(st, 'st_file_attributes', 0) & stat.FILE_ATTRIBUTE_HIDDEN)): + _trace(f"Skipping hidden .pth file: {fullname!r}") + return _trace(f"Processing .pth file: {fullname!r}") try: # locale encoding is not ideal especially on Windows. But we have used @@ -221,7 +230,8 @@ def addsitedir(sitedir, known_paths=None): names = os.listdir(sitedir) except OSError: return - names = [name for name in names if name.endswith(".pth")] + names = [name for name in names + if name.endswith(".pth") and not name.startswith(".")] for name in sorted(names): addpackage(sitedir, name, known_paths) if reset: |