from casa_system import procmgr
for info in [ (['dbus-daemon'],'dbus'),
(['CrashReportPoster'],'crashPoster'),
(['ipcontroller','ipcontroller-2.6'], 'ipcontroller'),
(['ipengine','ipengine-2.6'], 'ipengine') ]:
if casa['helpers']['info']:
casa['helpers'][entry] = (lambda fd: fd.readline().strip('\n'))(os.popen(casa['helpers']['info'] + " --exec 'which " + exe + "'"))
if casa['helpers'][entry] and os.path.exists(casa['helpers'][entry]):
casa['helpers'][entry] = None
for srchdir in [ __casapath__ + '/MacOS', __casapath__ + '/lib/casa/bin', '/usr/lib64/casa/01/bin', '/opt/casa/01/bin', '/opt/casa/02/bin' ] :
dd = srchdir + os.sep + exe
if os.path.exists(dd) and os.access(dd,os.X_OK) :
casa['helpers'][entry] = dd
if casa['helpers'][entry] is not None:
if casa['helpers'][entry] is None:
for srchdir in os.getenv('PATH').split(':') :
dd = srchdir + os.sep + exe
if os.path.exists(dd) and os.access(dd,os.X_OK) :
casa['helpers'][entry] = dd
if casa['helpers'][entry] is not None:
if casa['helpers']['dbus'] is not None :
dbus_conf= __casapath__ + "/etc/dbus/casa.conf"
if not os.path.exists(dbus_conf):
dbus_conf = __casapath__ + "/Resources/dbus/casa.conf"
argv_0_path = os.path.dirname(os.path.abspath(sys.argv[0]))
dbus_path = os.path.dirname(os.path.abspath(casa['helpers']['dbus']))
args = [casa['helpers']['dbus'],'--print-address', str(w)]
if dbus_conf is not None and os.path.exists(dbus_conf) :
args = args + ['--config-file',dbus_conf]
args = args + ['--session']
procmgr.create("dbus",args)