CMS 3D CMS Logo

Functions
EnviromentSettings Namespace Reference

Functions

def detectEnviroment ()
 

Function Documentation

def EnviromentSettings.detectEnviroment ( )

Definition at line 1 of file EnviromentSettings.py.

References join().

2  global environmentString,CMSSW_Release,CMSSW_Release_Number
3  import sys,os
4  envVariables={"CMSSW_BASE":"","CMSSW_DATA_PATH":"","CMSSW_RELEASE_BASE":"","CMSSW_SEARCH_PATH":"",
5  "CMSSW_VERSION":CMSSW_Release,"LD_LIBRARY_PATH":"","POOL_OUTMSG_LEVEL":"","POOL_STORAGESVC_DB_AGE_LIMIT":"",
6  "PYTHONPATH":"","PATH":"","ROOTSYS":"","SEAL":"","SEAL_KEEP_MODULES":"","SEAL_PLUGINS":"","TNS_ADMIN":"",
7  "XDAQ_DOCUMENT_ROOT":"","XDAQ_OS":"","XDAQ_PLATFORM":"","XDAQ_ROOT":"","XDAQ_SETUP_ROOT":"",
8  "XDAQ_ZONE":"","SCRAM_ARCH":""}
9  cmd='env | grep -E "(%s)" | sort' % "|".join(["^%s=" % v for v in envVariables.keys()])
10  fpd=os.popen(cmd)
11  line=fpd.readline()
12  while line:
13  k,v=line.split("=")
14  envVariables[k]=v.strip()
15  line=fpd.readline()
16  fpd.close()
17  ppath=":".join(sys.path)
18  ppath=ppath.strip(":")
19  envVariables["PYTHONPATH"]=ppath
20  envVariables["PATH"]="%s:${PATH}" % envVariables["PATH"]
21  envVariables["XDAQ_SETUP_ROOT"]=envVariables["XDAQ_ROOT"]+"/share"
22  envVariables["XDAQ_ZONE"]="cdaq"
23  CMSSW_Release=envVariables["CMSSW_VERSION"]
24  CMSSW_Release_Number=CMSSW_Release.split("_",1)[1]
25  #envVariables["LD_LIBRARY_PATH"]=envVariables["XDAQ_ROOT"]+"/lib:/nfshome0/dqmpro/lib_"+CMSSW_Release_Number
26  for (key,value) in envVariables.items():
27  envVariables[key]=value.replace("/cmsnfshome0","")
28  return " ".join(["%s=%s" % (k,v) for (k,v) in envVariables.items()])
static std::string join(char **cmd)
Definition: RemoteFile.cc:18