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]
评论列表
文章目录