diff options
author | prettyboy <[email protected]> | 2025-03-19 10:41:02 +0300 |
---|---|---|
committer | prettyboy <[email protected]> | 2025-03-19 11:04:10 +0300 |
commit | c616b6639fc99067edbe32b7b6c8d34bacecf114 (patch) | |
tree | ae168fefedbfce54141cb223291e5292ba164e36 | |
parent | 0e1caabad3646646eebcfa6a48c5ab1760031544 (diff) |
[library/python/runtime_py3/importer.pxi] Support trailing newline in root.path files
Для того чтобы работал сценарий
```
echo `arc root` > /tmp/.root.path
```
commit_hash:255b16f66c1a610cea5322a3842edc492634faaf
-rw-r--r-- | library/python/runtime_py3/importer.pxi | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/library/python/runtime_py3/importer.pxi b/library/python/runtime_py3/importer.pxi index d449bc9bddc..51bc3020a3f 100644 --- a/library/python/runtime_py3/importer.pxi +++ b/library/python/runtime_py3/importer.pxi @@ -91,10 +91,13 @@ def _init_venv(): raise RuntimeError(f'{cfg_source_root} key not found in {virtual_conf}') -def file_bytes(path): +def file_bytes(path, strip=False): # 'open' is not avaiable yet. with FileIO(path, 'r') as f: - return f.read() + data = f.read() + if strip: + return data.strip() + return data def _guess_source_root(): @@ -103,7 +106,7 @@ def _guess_source_root(): while tail: guidence_file = _path_join(path, '.root.path') if _path_isfile(guidence_file): - return file_bytes(guidence_file) + return file_bytes(guidence_file, strip=True) if _path_isfile(_path_join(path, '.arcadia.root')): return _b(path) |