def resolve_env_to_prefix(name_or_prefix):
"""Convert an env name or path into a canonical prefix path.
Returns:
Absolute path of prefix or None if it isn't found.
"""
if os.path.isabs(name_or_prefix):
return name_or_prefix
json = info()
root_prefix = json.get('root_prefix', None)
if name_or_prefix == 'root':
return root_prefix
envs = json.get('envs', [])
for prefix in envs:
if os.path.basename(prefix) == name_or_prefix:
return prefix
return None
评论列表
文章目录