()
| 111 | |
| 112 | |
| 113 | def _guess_source_root(): |
| 114 | path, tail = _os.getcwd(), 'start' |
| 115 | |
| 116 | root = None |
| 117 | while tail: |
| 118 | guidence_file = _path_join(path, '.root.path') |
| 119 | if _path_isfile(guidence_file): |
| 120 | # return immediately when guidence file is found |
| 121 | return file_bytes(guidence_file, strip=True) |
| 122 | |
| 123 | if _path_isfile(_path_join(path, '.arcadia.root')) and not root: |
| 124 | # save as a fallback but continue searching for a guidence file |
| 125 | # NOTE: .arcadia.root may be a symlink if it's set in DATA macros |
| 126 | # and it may be a regular file if ya:copydata tag is set |
| 127 | # in addition to that. So it's not very reliable. |
| 128 | root = _b(path) |
| 129 | |
| 130 | path, tail = _path_split(path) |
| 131 | return root |
| 132 | |
| 133 | |
| 134 | def _get_source_root(): |
no test coverage detected