frappyman: inherit PYTHONPATH from starting process

on SINQ instruments, when frappy is started from nicos,
nicos.conf contains PYTHONPATH  = /home/<instr>:/home/<instr>/.local...
this should be applied to the frappy process too
This commit is contained in:
zolliker 2022-06-20 15:03:39 +02:00
parent 34e13ccc67
commit a3453e6b0e

View File

@ -76,6 +76,13 @@ class FrappyManager(ServiceManager):
cfgpaths = self.config_dirs(ins, service)
if cfgpaths:
env['FRAPPY_CONFDIR'] = os.pathsep.join(cfgpaths)
# merge PYTHONPATH from servicemanager.cfg with the one from environment
pypathlist = []
for pypath in env.get('PYTHONPATH'), os.environ.get('PYTHONPATH'):
if pypath is not None:
pypathlist.extend(p for p in pypath.split(':') if p not in pypathlist)
if pypathlist:
env['PYTHONPATH'] = os.environ['PYTHONPATH'] = ':'.join(pypathlist)
return start_dir, env
def do_start(self, ins, service=None, cfg='', restart=False, wait=False, logger=None):