def find_workspace_path():
""" Look for a workspace root somewhere in the upper directories
hierarchy
"""
head = os.getcwd()
tail = True
while tail:
tsrc_path = os.path.join(head, ".tsrc")
if os.path.isdir(tsrc_path):
return path.Path(head)
tbuild_yml_path = os.path.join(head, "tbuild.yml")
if os.path.exists(tbuild_yml_path):
return path.Path(head)
else:
head, tail = os.path.split(head)
raise tsrc.Error("Could not find current workspace")
评论列表
文章目录