util.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:anarel-manage 作者: slaclab 项目源码 文件源码
def whichCondaInstall(condaInstallBaseDir):
    '''takes a look at where os comes from, should be something like
     /reg/g/psdm/sw/conda/inst/miniconda2-dev-rhel7/envs/myenv/lib/os.py

    checks that this starts with the condaInstallBaseDir arg, then 
    checks that inst is the next subdir, then returns what follows, i.e, 
    returns miniconda2-dev-rhel7 for above
    '''
    pythonLib = os.path.split(os.__file__)[0]
    if not pythonLib.startswith(condaInstallBaseDir):
        warning("whichMiniCondaInstall called for non central install, basedir arg=%s but os imports from %s"  % (condaInstallBaseDir, pythonLib))
        return 'non-central-miniconda-install'
    relpath = pythonLib.split(condaInstallBaseDir)[1]
    dirs = relpath.split(os.path.sep)
    if dirs[0]=='': dirs.pop(0)
    assert dirs[0]=='inst', "unexpected - central install conda dir layout has changed. Expected 'inst' at start of %s" % relpath
    return dirs[1]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号