blob: 6da604d62e16f0496ea29019e1960da6467e436d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
import os
def is_root(path):
return os.path.exists(os.path.join(path, ".arcadia.root")) or os.path.exists(os.path.join(path, 'devtools', 'ya', 'ya.conf.json'))
def detect_root(path, detector=is_root):
return _find_path(path, detector)
def _find_path(starts_from, check):
p = os.path.realpath(starts_from)
while True:
if check(p):
return p
next_p = os.path.dirname(p)
if next_p == p:
return None
p = next_p
|