summaryrefslogtreecommitdiffstats
path: root/library/python
diff options
context:
space:
mode:
authoralevitskii <[email protected]>2026-02-09 09:22:11 +0300
committeralevitskii <[email protected]>2026-02-09 09:48:10 +0300
commit66f7efe2b8b20bbd9f761c259f6023ef3e18ba12 (patch)
treec3d0f3d00f0492402687646efd0f08dd39fd7c9d /library/python
parent8ff4e432a038fc6afd0e25583c6123f19aaa792d (diff)
Prefer guidance file when searching for repo root in ext-py
commit_hash:9c636406274e7aaae314e8d32be5863fdd2944fd
Diffstat (limited to 'library/python')
-rw-r--r--library/python/runtime_py3/__res.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/library/python/runtime_py3/__res.py b/library/python/runtime_py3/__res.py
index efbef0d564a..3b896e322d4 100644
--- a/library/python/runtime_py3/__res.py
+++ b/library/python/runtime_py3/__res.py
@@ -113,15 +113,22 @@ def file_bytes(path, strip=False):
def _guess_source_root():
path, tail = _os.getcwd(), 'start'
+ root = None
while tail:
guidence_file = _path_join(path, '.root.path')
if _path_isfile(guidence_file):
+ # return immediately when guidence file is found
return file_bytes(guidence_file, strip=True)
- if _path_isfile(_path_join(path, '.arcadia.root')):
- return _b(path)
+ if _path_isfile(_path_join(path, '.arcadia.root')) and not root:
+ # save as a fallback but continue searching for a guidence file
+ # NOTE: .arcadia.root may be a symlink if it's set in DATA macros
+ # and it may be a regular file if ya:copydata tag is set
+ # in addition to that. So it's not very reliable.
+ root = _b(path)
path, tail = _path_split(path)
+ return root
def _get_source_root():